Warning: Parameter 1 to Language::getMagic() expected to be a reference, value given in /var/www/sda/2/c/digigrids/wiki/includes/StubObject.php on line 58

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/sda/2/c/digigrids/wiki/includes/MagicWord.php on line 675
Scripting/Variables - DigiWiki

Scripting/Variables

De DigiWiki.

(Voir également)
 
Ligne 1 : Ligne 1 :
 +
__NOTOC__
{{Languages}}
{{Languages}}
 +
{{ScriptingNav}}
 +
Une '''variable''' est un élément dans lequel une information (nombre, chaine de caractères...) est stockée.
Une '''variable''' est un élément dans lequel une information (nombre, chaine de caractères...) est stockée.
Ligne 30 : Ligne 33 :
I found this confusing at first, this may make it a little clearer:
I found this confusing at first, this may make it a little clearer:
The same rules apply to any variable type, a local variable name will overide any global variable previously defined
The same rules apply to any variable type, a local variable name will overide any global variable previously defined
-
<lsl>string  j = "Global Hi";
+
<lsl>
 +
string  j = "Global Hi";
integer i = 50;
integer i = 50;
Ligne 41 : Ligne 45 :
         llOwnerSay(j); //Will say "Global Hi", this is the global variable that can be accessed anywhere in the script
         llOwnerSay(j); //Will say "Global Hi", this is the global variable that can be accessed anywhere in the script
     }
     }
-
}</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.
-
 
<lsl>
<lsl>
integer i = 50;
integer i = 50;
Ligne 57 : Ligne 60 :
         llOwnerSay((string) j); //Will say "60". the local integer has been changed ( cast ) to a string.
         llOwnerSay((string) j); //Will say "60". the local integer has been changed ( cast ) to a string.
     }
     }
-
}</lsl>
+
}
 +
</lsl>
A global variable can be defined with or without a value and the value can be changed later in the script.
A global variable can be defined with or without a value and the value can be changed later in the script.
Note that in setting the value of j, only the name was used, the type ( integer) is already set globally,
Note that in setting the value of j, only the name was used, the type ( integer) is already set globally,
Ligne 74 : Ligne 78 :
         integer k = 70; //Name, type and value set within a local scope
         integer k = 70; //Name, type and value set within a local scope
     }
     }
-
}</lsl>
+
}
 +
</lsl>
== Voir également ==
== Voir également ==
-
* [[string]]
+
<ul style="{{NewStyle|column-width|20.5em|moz=*|webkit=*}}">
-
* [[key]]
+
*[[Scripting/Types/string|string]]
-
* [[integer]]
+
*[[Scripting/Types/key|key]]
-
* [[float]]
+
*[[Scripting/Types/integer|integer]]
-
* [[list]]
+
*[[Scripting/Types/float|float]]
-
* [[vector]]
+
*[[Scripting/Types/list|list]]
-
* [[rotation]]
+
*[[Scripting/Types/vector|vector]]
 +
*[[Scripting/Types/rotation|rotation]]
 +
</ul>

Version actuelle en date du 2 octobre 2014 à 05:08

Outils personnels
donate
Google Ads