Scripting/Variables/en
De DigiWiki.
| Ligne 14 : | Ligne 14 : | ||
list entries = ["A list may contain many types of values such as", 2, 1.2, <0.4, 0.8, 1.6>]; | list entries = ["A list may contain many types of values such as", 2, 1.2, <0.4, 0.8, 1.6>]; | ||
vector vec_2 = <1,6,2>; //Generally used for position as xyz, but can be used to store 3 numbers to be parsed out later | vector vec_2 = <1,6,2>; //Generally used for position as xyz, but can be used to store 3 numbers to be parsed out later | ||
| - | rotation _rot = <1,2,3,4>; //Can also be used to store 4 numbers to be parsed out later</lsl> | + | rotation _rot = <1,2,3,4>; //Can also be used to store 4 numbers to be parsed out later |
| + | </lsl> | ||
== Scope of variables == | == Scope of variables == | ||
A variable can be limited to only certain parts of the script, depending upon where it is placed. This placement, and the areas where it is enabled is called the "scope." Variables that apply to the entire script are called global variables: they are defined at the top of the script above the state declarations. Variables that are within functions or within nested areas are considered local variables. | A variable can be limited to only certain parts of the script, depending upon where it is placed. This placement, and the areas where it is enabled is called the "scope." Variables that apply to the entire script are called global variables: they are defined at the top of the script above the state declarations. Variables that are within functions or within nested areas are considered local variables. | ||
| Ligne 47 : | Ligne 48 : | ||
} | } | ||
</lsl> | </lsl> | ||
| - | |||
| - | |||
Converting between variable types is know as casting. for example in the script above, the global variable i has a value of 50. This can be cast to a string to send the value as text to the chat window. This can also be done with local variables. | Converting between variable types is know as casting. for example in the script above, the global variable i has a value of 50. This can be cast to a string to send the value as text to the chat window. This can also be done with local variables. | ||
This is commonly used for debugging a script. | This is commonly used for debugging a script. | ||


