RoverTX wrote:No that makes perfect sense. I just hadn't seen clear documentation of the context to which this was referring too. Sometimes how it is used I thought it might actually be referring to the top level of the file, instead of the next top level cue.
Also, is there any documentation of the mission director variable/value scope?
Let's say I have three cues structured like so
Code: Select all
<cue name="cue l1">
<cues>
<cue name="cue l2 1">
<cues>
<cue name="cue l3">
</cue>
</cues>
</cue>
</cues>
<cue name="cue l2 2">
</cue>
</cue>
If I declare a value via <set_value> in "cue l2 1" will I be able to access that value in "cue l2 2" or would I have to "declare" it in "cue l1" in order to do so?
Assuming the variable is called "cue l2 1.myvariable".
In cue l2 2 you could refer to that variable by using "cue l2 1.myvariable". So yes, that is possible. Even across files as technically afaik the game doesn't differentiate between code in terms of files but in terms of cues. Which is why it's impossible to have good unique cue names.
You also have the option of declaring a global variable by not putting a cue name before your variable in its definition / initiation / declaration: <set_value name="myglobalvariable" exact="1"/> as opposed to the normal <set_value name="mycuename.mylocalvariable" exact="1"/>.
However, as mentioned before, technically any cue can access any variable so you wouldn't need global variables. For safety reasons I'd generally recommend transferring data through libraries, however, and not by using the local variable of another cue.
Note that some generic mission libraries do some pretty advanced trickery using these practices. For example, you can transfer the String of the name of a cue through a parameter and then use that parameter to name your variable and assign it to a variable cue. But that's a lot more advanced stuff than what you're likely currently trying to understand.