Talk:OBSE Wish List

Revision as of 15:19, 3 August 2006 by imported>DragoonWraith (→‎CellScan: what's better about this over magic effect scripts?)

Disputed Changes

If you think something should have stayed on the list or if you think a change in one of the items misinterpretted what was meant, please let us know.

Dejaside's Binary Examples

these Is______ functions suggested by Dejaside (unless noted otherwise)

  • IsEmpty - checks if container is empty
  • IsBook - checks if item is a book
  • IsSkillBook - checks if book teaches a skill
  • IsWeapon - checks if item is a weapon
    • IsMelee - checks if weapon is melee
    • IsRanged - checks if weapon is ranged
    • IsAmmo - checks if weapon is ammo
    • IsStaff - checks if weapon is a staff (DragoonWraith)
  • IsEdible - checks if item is edible (note: the ai uses 'restore fatigue' to determine edibility)
  • IsIngredient - checks if item can be used in a potion
  • IsActivator - checks if object is an activator
  • IsDoor - checks if object is a door
  • IsLoadDoor - checks if door loads a new cell
  • IsContainer - checks if object is a container
  • IsAnimated - checks whether object has an animation (?)
  • IsApparel - checks if item can be worn
  • IsArmor - checks if item has armor rating
  • IsRing - checks if item is a ring
  • IsAmulet - checks if item is an amulet
  • IsKey - checks if item is a key
  • IsApparatus - checks if item can be used to make potions
  • IsMisc - checks if item has no value beyond its value in gold


Just wondered if consolidating some suggested functions might make things easier to read. i.e., for the various isMisc, isClothing functions, wouldn't they be better served by a single getObjectType function? Don't want the list to become overwhelming, that's all. Scruggs 22:26, 1 August 2006 (EDT)
Dragoon Wraith TALK 09:35, 2 August 2006 (EDT): Yes, as mentioned in the thread, I'm going to in charge of keeping this clean. That project comes as soon as I finally finish Danger Sense for Addiktive (tonight, probably). It'll be cleaned up by the weekend.
Dragoon Wraith TALK 12:07, 2 August 2006 (EDT): See, it's cleaned up now! And it's only Wednesday!
Anyway, Dejaside's idea was that these functions would be very easy to create for the OBSE developers, and combinations of them could be more useful than a simple GetObjectType function - for example, an ingredient with Restore Health is both edible and an ingredient - GetObjectType would only return one of these pieces of information, while having these binary tests would allow you to determine both.

CellScan

This is to discuss the different approaches taken by former Script Extenders to realise a "Cell Scan". MWSE did it that way: it used three different functions to chose from three different items lists (I suppose these were pre-defined by the game):

  • FirstNPC - to select the NPC/Creature list
  • FirstStatic - to select the Statics list
  • FirstItem - to select the list containing other items in a cell

All these returned the first ref on the list. Then, there was NextRef which took a reference (like the ones returned by the commands above or this very command) as a parameter and returned the next ref after the one specified. Refs could be encoded in long type variables and used in a similar manner as in Oblivion (imho better, one could actualy access variables on the refs).

Afaik MWE could only search for NPCs/Creatures which it calls "Livings" so the command was named NextLiving. MWE remembered the last encountered ref automatically. It returned a "-1" value (to a remote variable) if the scan is through. ClearLiving was used to reset the search to the first item on the list.
[there was also a third command needed to succeed, but this is of no interest here]

Now, I think the question whether such a function is necessary is redundant. Mandatory though is the question how this should work. Personally, I like the MWSE approach a bit more, but it showed to be slower (though cdcooley said this was because it wasn't optimized; I can't tell).

Then, there is the concept used in the OBSE for Inventory Scan. Iterate using a number instead of a reference.

Grey's proposal

I was about to propose a mix of MWSE and MWE approaches. One command to actually select a list (or item type) to scan and one command to actually iterate through the list:

CellScan [short_integer]

Takes a mandatory integer as a parameter. Returns the current state set in the parameter, and "-1" if none.

0 should be "all" ?
1 should be NPCs/Creatures
2-... should be additional lists / types of items

NextRef [optional: ref]

This returns the next reference after the currently selected (or the first on the list if none). Returns "-1" if there is no "next" reference.

The optional parameter is to shorten the time needed to do the scan if we know two references are near each other. "-1" as a parameter resets to the beginning of the list.

====example:==== (simple, runs only once)

scn ExampleQuestScript

ref tempref ; takes the output of NextRef to work with the object

short damage ; only needed for this very example, in which we do a dnd-like "fortitude save"

CellScan 1 ; search for NPCs/Creatures

while done == 0
      set tempref to NextRef
      if tempref == -1
         set done to -1 ; we only want to loop once
      else
         if tempref.getav health <= 5 && tempref.GetDead != 1
            set damage to ( GetRandomPercent - tempref.getav endurance ) / 10
            if damage > 0
               tempref.modav health damage
            endif
         endif
      endif
endwhile

StopQuest ExampleQuest

I'll try to find a better example that uses all of the possibilities, but this should work for now. --Grey 15:50, 3 August 2006 (EDT)

Dragoon Wraith TALK 16:19, 3 August 2006 (EDT): Why can't we just use the tried-and-true method of casting a large-radius, LOS-ignoring scripted spell for getting nearby references? Is there a particular reason you need to be able to iterate through the cell rather than simply scripting everyone in the cell?
Return to "OBSE Wish List" page.