Creation/Dev/Script/Client/TGraalVar: Difference between revisions

From Graal Bible
mNo edit summary
 
mNo edit summary
Line 1: Line 1:
<pre>
=TGraalVar=
TGraalVar:
 
  initialized - boolean (read only)
==Variables==
  joinedclasses - object (read only)
{| border="1" cellpadding="2" width="100%"
  name - string (read only)
| '''Name'''
  scriptlogmissingfunctions - boolean
| '''Type'''
  timeout - float
| '''Description'''
  addarray(obj) - adds another array to this variable
|-
  cancelevents(str) - removes all previously scheduled events (scheduleevent) of the specified event name
| initialized
  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)
| boolean (read only)
  copyfrom(obj) - copies all variables and array values from another object, doesn't work for protected variables like players though
|-
  getdatablockvars() - returns object - gets the names of all variables which are pointing to datablocks (for Graal3D, will be removed soon)
| joinedclasses
  getdynamicvarnames() - returns object - gets the names of all static (built-in) subvariables of this object
| object (read only)
  geteditvarnames() - returns object - gets the names of all dynamic variables which can be modified
|-
  getfunctions() - returns 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")
| name
  getstaticvarnames() - returns object - gets the names of all dynamic (not built-in) subvariables of this object
| string (read only)
  getvarnames() - returns 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
| scriptlogmissingfunctions
  ignoreevents(str) - lets the object ignore all previously catched events of the specified object name
| boolean
  insertarray(int, obj) - inserts an array at the specified index
|-
  isinclass(str) - returns float - checks if the object has joined the specified class
| timeout
  join(str) - lets the object join a class and inherit all functions and event handlers of that class
| float
  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)
==Functions==
  loadstring(str) - loads the content of a file into the variable
{| border="1" cellpadding="2" width="100%"
  loadvars(str) - loads the variables from a file where each line has the format varname=value
| '''Name'''
  loadvarsfromarray(obj) - loads the variables from a string list of the format varname=value
| '''Return Type'''
  objecttype() - returns string - returns the object type, which can be TGraalVar, TProjectile etc.
| '''Description'''
  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)
| addarray(obj)
  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
| adds another array to this variable
  scheduleevent(float, str, params...) - returns 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'
| cancelevents(str)
  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
| removes all previously scheduled events (scheduleevent) of the specified event name
  sortdescending() - sorts the array in descending order (highest value first)
|-
  timershow() - lets the npc show the timeout variable, deprecated
| catchevent(str, str, str)
  trigger(str, params...) - invokes an event on the object (onEventname) with the specified event name and parameters, doesn't interrupt the current script
|
</pre>
| 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
|}

Revision as of 05:31, 27 January 2006

TGraalVar

Variables

Name Type Description
initialized boolean (read only)
joinedclasses object (read only)
name string (read only)
scriptlogmissingfunctions boolean
timeout float

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