In conjunction with the proposed extended script functions, functions to look for, query, and set local variables in scripts and objects should be added; specifically:
short xVariableExists <ref>, <string>
long xGetLongVariable <ref>, <string>
short xGetShortVariable <ref>, <string>
float xGetFloatVariable <ref>, <string>
xSetLongVariable <ref>, <string>, <long>
xSetShortVariable <ref>, <string>, <short>
xSetFloatVariable <ref>, <string> <float>
Functions to iterate over the local variables in a reference should also be added; i.e. something like
ref, type, name xFirstVariable <ref>
ref, type, name xNextVariable <ref>
xVariableExists should return the type of the variable (short, long, or float).
If an xGet or xSet is used with an inappropriate type, the value should be converted to the desired type (if possible) before being returned or set. (That is, if xGetLongVariable is used with a short, the short should be converted to a long before being returned).
Logged In: YES
user_id=1784528
Originator: NO
This would be amazingly useful for what I am writing at present
Logged In: NO
I'm not sure if variables are stored as anything except an index:
http://www.bethsoft.com/bgsforums/index.php?s=&showtopic=553402&view=findpost&p=10006392
Iterating could work though.
- bungadunga