Code: Select all
<cue name="Init">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_signalled cue="md.Setup.GameStart"/>
<event_player_created/>
</check_any>
</conditions>
<delay exact="5s"/>
<actions>
<set_value name="$thisStation" exact="null" />
<set_value name="$cachedStation" exact="null" />
</actions>
<cues>
<cue name="PLAYER_DOCKED" instantiate="true">
<conditions>
<event_object_docked object="player.entity" />
</conditions>
<actions>
<debug_to_file name="'docking_test.log'" text="'-- cue start: [%s] --'.[this.name]" />
<!-- event_object_docked -->
<set_value name="$thisStation" exact="event.param" />
<debug_to_file name="'lt.log'" text="'Player docked at [%s]'.[$thisStation.name]" />
<do_if value="not $thisStation.name == $cachedStation">
<set_value name="$cachedStation" exact="$thisStation" />
<debug_to_file name="'lt.log'" text="'cachedStation = [%s]'.[$cachedStation.]" />
</do_if>
<do_else>
<debug_to_file name="'lt.log'" text="'already cached station: [%s]'.[$cachedStation.]" />
</do_if>
</actions>
</cue>
</cues>
Player docked at Argon Equipment Factory
cachedStation = Argon Equipment Factory
Next, I undock and fly to a different station but then this check completely fails: <do_if value="not $thisStation.name == $cachedStation">
and the cached station isn't changed. All I get in the log is the notice that I docked at the station, there is no message that the new station name was cached:
Player docked at Medical Supply Factory I
My variable scope should be fine since the script stays instantiated until the game ends. Also, sometimes the do_else never executes even when the do_if is properly skipped because I dock at the same station I just undocked from.
Any advice?