If you see something like this in a LUA script:
Code: Select all
npc1 = 1
npc2 = 2
npc3 = 4
npc4 = 8
Code: Select all
setMaskBit(varname,position,state)
getMaskBit(varname,position)
isMaskFull(varname,size)
- You now have to use getVar to retrieve the value before using these functions!
- They are only useful for true/false values. If you need something more complex, then use setVar/getVar instead.
- They can be used to store a lot of true/false related to the same quest values in a single variable for quick lookup.
- The "varname" should be something unique to the quest, and is stored in the same place setVar stores things, so you should not try to share a name with another variable.
- Position should start from 0 and count up by 1 for each additional value you need to store. Do not leave gaps in positions.
- State is a true or false condition, and should by entered as true or false
- getMaskBit and isMaskFull return true or false, and can be evaluated without a comparison in an if statement.
- getMaskBit should be used to test a single position, while isMaskFull should be used to see if ALL of the positions are true.
- setMaskBit now returns a value! Be sure to update your variable with the value it returns or you will be testing against an outdated variable!
- Size should be the highest position number used in your quest.
- When you no longer need the mask, you erase it just like a normal variable via setVar(varname,0)
EDIT: The proper use of these functions has changed! Take a fresh look at Mamaulabion's script and the bold points above for changes!