Creation/Dev/Script/Client/TGraalVar: Difference between revisions
From Graal Bible
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Script_Object}} | |||
'''[[ | =Variables= | ||
''Note: Currently this doesn't include functions which are optimized at compile time, see [[Creation/Dev/Script/Starting_Guide#Standard_object_functions|Starting Guide: Standard object functions]] for those.'' | |||
{| border="1" cellpadding="2" width="100%" | |||
| '''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= | |||
{| border="1" cellpadding="2" width="100%" | |||
| '''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 name and event, third parameter is the name of 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 | |||
|- | |||
| escape() | |||
| string | |||
| adds \\ in front of ", ' and \\, and removes non-printable characters | |||
|- | |||
| 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 dynamic (not 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 static (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 | |||
|- | |||
| loadxml(str) | |||
| | |||
| | |||
|- | |||
| loadxmlfromstring(str) | |||
| | |||
| | |||
|- | |||
| 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) | |||
| object | |||
| saves the subvars in the format varname=value into an array, you must specify if it should be sorted | |||
|- | |||
| savexml(str, int) | |||
| | |||
| | |||
|- | |||
| savexmltostring() | |||
| string | |||
| | |||
|- | |||
| 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 an onTimeout 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) | |||
|- | |||
| subarray2(int, int, int, int) | |||
| object | |||
| extracts a two-dimensional array, specify startpos1, length1, startpos2, length2 | |||
|- | |||
| 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 | |||
|} | |||
{{:Creation/Dev/Script/Client}} |
Latest revision as of 04:02, 28 August 2007
This article is information on a script object - a pre-defined type of variable with its own set of static variables and functions. It is intended for use with the GS2 scripting language.
Variables
Note: Currently this doesn't include functions which are optimized at compile time, see Starting Guide: Standard object functions for those.
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 name and event, third parameter is the name of 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 | |
escape() | string | adds \\ in front of ", ' and \\, and removes non-printable characters |
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 dynamic (not 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 static (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 | |
loadxml(str) | ||
loadxmlfromstring(str) | ||
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) | object | saves the subvars in the format varname=value into an array, you must specify if it should be sorted |
savexml(str, int) | ||
savexmltostring() | string | |
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 an onTimeout 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) | |
subarray2(int, int, int, int) | object | extracts a two-dimensional array, specify startpos1, length1, startpos2, length2 |
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 |
- TGraalVar
- ActionMap
- DTSAniThread
- GameMovementInterpolate
- GameMovementList
- GameShape
- GuiControl
- GuiArrayCtrl
- GuiBitmapButtonCtrl
- GuiBitmapCtrl
- GuiButtonBaseCtrl
- GuiChunkedBitmapCtrl
- GuiContextMenuCtrl
- GuiDrawingPanel
- GuiFlash
- GuiFrameSetCtrl
- GuiGraal3DCtrl
- GuiGraalCtrl
- GuiMenuCtrl
- GuiMLTextCtrl
- GuiPlayerView
- GuiProgressCtrl
- GuiScrollCtrl
- GuiShapeNameHud
- GuiShowImgCtrl
- GuiSliderCtrl
- GuiStretchCtrl
- GuiTabCtrl
- GuiTextCtrl
- TerrainEditor
- WorldEditor
- GuiControlProfile
- GuiCursor
- GuiTabCtrlEntry
- GuiTextListEntry
- GuiTreeViewNode
- MRandomGenerator
- SimObject
- TDrawableObject
- TDrawingPanel
- Terraformer
- TFrameDetail
- TGaniParam
- TGraalAni
- TGraalAniPart
- TGraalAniSound
- TGraalAniSprite
- TGraalAniStep
- TGraalSpriteAttachment
- THTTPRequest
- TMovementRigid
- TParticle
- TParticleEmitter
- TParticleModifier
- TServerLevel
- TServerLevelLink
- TShapeMaterial
- TShowImg_Values
- TStaticVar
- TTilesLayer
- TUpdatePackage