could some one explain "set local var" &

The place to discuss scripting and game modifications for X²: The Threat.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
Kailric
Posts: 985
Joined: Sun, 7. Dec 03, 05:15
x3

could some one explain "set local var" &

Post by Kailric »

Could someone explain just how the "set local varable" and "set global varable" commands work...thanks!
"Try not. Do or do not, there is no try."-Yoda

"[Its] time for the human race to enter the solar system"-Dan Quayle
blackspell
Posts: 128
Joined: Sat, 6. Mar 04, 20:18
x2

Post by blackspell »

set local/global var are interface functions to be able to set persistent variables. global is of course with global scope (accessible from anywhere) and local is for current object (ship).

the name of the local/global variable is just a string with the vars name.

to set values:
set global variable: name='my.global.varname' value=5
set local variable: name='my.local.varname' value=2

to get values:
$myvar = get global variable: name='my.global.varname'
$myvar2 = get local variable: name='my.local.variable'

what to use them for?
you can use them like options, i.e. set a global variable 'logging' to true/false and have all your scripts read this var to see if they should write messages to player logbook.
User avatar
Kailric
Posts: 985
Joined: Sun, 7. Dec 03, 05:15
x3

Post by Kailric »

Yeah, thats it..i just wondered if the set local varable was for the current object or the sector or something else. So I can set a varable for an object and that varable will always stay with the object until it is destroyed right?
"Try not. Do or do not, there is no try."-Yoda

"[Its] time for the human race to enter the solar system"-Dan Quayle

Return to “X²: The Threat - Scripts and Modding”