Creation/Dev/Script/Client/TGraalVar: Difference between revisions
From Graal Bible
m (→Variables) |
m (→Variables) |
||
Line 9: | Line 9: | ||
| initialized | | initialized | ||
| boolean (read only) | | boolean (read only) | ||
|- | |- | ||
| joinedclasses | | joinedclasses | ||
| object (read only) | | object (read only) | ||
| | | List of joined classes | ||
|- | |- | ||
| name | | name | ||
| string (read only) | | string (read only) | ||
| | | Name of object | ||
|- | |- | ||
| scriptlogmissingfunctions | | scriptlogmissingfunctions | ||
| boolean | | boolean | ||
| | | Whether to log calls to undefined functions | ||
|- | |- | ||
| timeout | | timeout |
Revision as of 04:39, 27 January 2006
TGraalVar
Variables
Name | Type | Description |
initialized | boolean (read only) | |
joinedclasses | object (read only) | List of joined classes |
name | string (read only) | Name of object |
scriptlogmissingfunctions | boolean | Whether to log calls to undefined functions |
timeout | float | Time left in the timeout |
Functions
Name | Return Type | Description |
addarray(obj) | adds another array to this variable | |
cancelevents(str) | removes all previously scheduled events (scheduleevent) of the specified event name | |
catchevent(str, str, str) | adds an event handler for the specified object and event, third parameter is the function which receives the event (first parameter of the event will be the object for which the event occured) | |
copyfrom(obj) | copies all variables and array values from another object, doesn't work for protected variables like players though | |
getdatablockvars() | object | gets the names of all variables which are pointing to datablocks (for Graal3D, will be removed soon) |
getdynamicvarnames() | object | gets the names of all static (built-in) subvariables of this object |
geteditvarnames() | object | gets the names of all dynamic variables which can be modified |
getfunctions() | object | gets the names of all functions of the object as array, also each entry has subvariables which give more information about the function ("parameters", "description", "scope") |
getstaticvarnames() | object | gets the names of all dynamic (not built-in) subvariables of this object |
getvarnames() | object | gets the names of all subvariables of this object |
ignoreevent(str, str) | lets the object ignore an event (second parameter) of the specified object name | |
ignoreevents(str) | lets the object ignore all previously catched events of the specified object name | |
insertarray(int, obj) | inserts an array at the specified index | |
isinclass(str) | float | checks if the object has joined the specified class |
join(str) | lets the object join a class and inherit all functions and event handlers of that class | |
leave(str) | leaves a previously joined class | |
loadfolder(str, int) | loads the content of a folder into the variable, you must specify the folder name and pattern (e.g. "levels/bodies/*.png") and if it should be recursive | |
loadlines(str) | loads a file and adds it line by line to the variable (as array) | |
loadstring(str) | loads the content of a file into the variable | |
loadvars(str) | loads the variables from a file where each line has the format varname=value | |
loadvarsfromarray(obj) | loads the variables from a string list of the format varname=value | |
objecttype() | string | returns the object type, which can be TGraalVar, TProjectile etc. |
savelines(str, int) | saves the array line by line into a file, the second parameter is the save mode (0 - overwrite, 1 - append) | |
savestring(str, int) | saves the value as string into a file, the second parameter is the save mode (0 - overwrite, 1 - append) | |
savevars(str, int) | saves the subvars in the format varname=value into a file, the second parameter is the save mode (0 - overwrite, 1 - append) | |
savevarstoarray(bool) | returns object - saves the subvars in the format varname=value into an array, you must specify if it should be sorted | |
scheduleevent(float, str, params...) | object | invokes an event (onEventname) after the specified delay (in seconds), second parameter is the event name, followed by the parameters |
settimer(float) | invokes a timeout event after the specified time, similar to 'timeout=value' | |
sortascending() | sorts the array in ascending order (smallest value first) | |
sortbyvalue(str, str, bool) | sorts the array by the specified variable name, you must also say what variable type it is (e.g. string) and if it should be sorted ascending | |
sortdescending() | sorts the array in descending order (highest value first) | |
timershow() | lets the npc show the timeout variable, deprecated | |
trigger(str, params...) | invokes an event on the object (onEventname) with the specified event name and parameters, doesn't interrupt the current script |