cmdrmcdonald / EliteDangerousDataProvider

Apache License 2.0
134 stars 31 forks source link

Problem with lastsystem in fsd engaged #267

Closed Astilane closed 7 years ago

Astilane commented 7 years ago

Hello, I have some liitle problem with the lastsystem object during the "FSD engaged" script. For exemple with 4 systems A, B, C and D. If i start the game in A system and i jump to B, and a after to C If i put a sentence like You go away from {P(lastsystem.name)} for {P{system.name} For A==>B I have You go away from for B and B==> C You go away from A to C and finally for C==>D You go away from B to D and so on after I didn't change anithing from the EDI script axcept the sentence I had

To arrange this, I put at the start of the script {set MyLastSystem to (system)}

and i replace all the lastsystem by MyLastSystem and it work fime, but I don't really understand why. Any clue somewhere?

Tkael commented 7 years ago

Inserted the following into my 'FSD Jumped' event to test this & confirmed that it is not behaving as expected:

    {if lastsystem.name:
       Last system was {P(lastsystem.name)},
       Current system is {P(system.name)}
    }

Jumping from AAsgananu to Baldr (having visited Lembava prior), the result was "Last system was Lembava, Current system is Baldr". Expected: AAsgananu, Actual: Baldr

This looks like a timing issue where when the 'FSD Engaged' script triggers, {system.name} has already been updated to the destination system.

You can get around this using the SetState function to set the current system state to a custom variable (see https://github.com/cmdrmcdonald/EliteDangerousDataProvider/blob/master/SpeechResponder/Help.md#setstate). I'd recommend setting the state when the following events occur: