[WIP] <RefObj> set local variable: name = <Var/String> value = <Value>

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Post Reply
mark_a_condren
Posts: 1385
Joined: Wed, 3. Aug 05, 05:05
x3tc

[WIP] <RefObj> set local variable: name = <Var/String> value = <Value>

Post by mark_a_condren » Thu, 9. Sep 10, 09:26

<RefObj> set local variable: name = <Var/String> value = <Value>


<RefObj> = The ship or station to have the information stored against.
<Var/String> = The string to set as the name for the information, this can be read in from a text file or entered directly as a string.
<Value> = The information being stored.


This instruction takes any script variable that is running, and stores its value on the object (ship or station) on which the script is running.
The term “local variable” is probably unfortunate – the concept is more akin to storing a file on a hard drive.
Think of <Var/String> as the file name, and <Value> as the data in the file.
Any variable type can be stored in this way, including an entire array.

The difference between a global variable and a local variable, as the set local and set global
instructions use the terms, is whether or not the value is stored locally on a particular ship or
base, or stored globally.
To continue the file analogy, the set local variable instruction is like storing a file in a directory, where each and every ship and station has its own directory.
The set global variable instruction is like storing the file in the root directory – any script running on any ship or base can access or change the value when it is stored as a global variable.


Example:

$station set local variable: name = 'my_local_variable_name' value = $info.to.be.stored

Further Resources:
Global Variables by Cycrow and includes info on Local Variables.


Command Location:

Post Reply

Return to “MSCI Reference”