Author Topic: Dealing with a delay  (Read 818 times)

Malic

  • Full Member
  • ***
  • Posts: 105
Dealing with a delay
« on: January 19, 2020, 03:45:00 PM »
So, trying to figure out the best way to do a function in Elite.

Issue is that the way the player journal works, some of the outputs can be delayed up to a half a second from doing it in the game to it being output on the player journal.

For example, I have an existing button that lets me boost, but it has a check to compare to the player journal, to see if the landing gear is down, or cargo scoop is down.  If i press it and those are down, it will retract those and let you boost.

However, the issue is if I spam the command, like if you are panicing in an emergency, and the journal has not caught up, you are boosting, but also the gear and cargo scoop is retracting and deploying over and over as the journal is still showing it as out, as it has not updated yet.

What I am thinking of doing is setting a series of commands with a boolean for AskCargoScoop to differ what I want vs what it is

I am just now trying to figure out the best way to have it press it once, but during the next xxxx period of time, try to account for the delay, and extra inputs will not try to press the buttons and undo what I am really asking it to do.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Dealing with a delay
« Reply #1 on: January 19, 2020, 03:59:04 PM »
If you need to wait for a certain period of time before a command can be triggered again, you can set a date value in the future, then check whether that point in time has passed.

E.G.
Code: [Select]
Begin Date Compare : [>>{CMDWHENISAY}waitBetweenInputs] Is Before Current Date/Time
    Set date [>>{CMDWHENISAY}waitBetweenInputs] to [>>{CMDWHENISAY}waitBetweenInputs] plus [5] seconds
End Condition - Exit when condition not met
would allow the command to execute once, after which it cannot be executed again within five seconds of that first execution.

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Dealing with a delay
« Reply #2 on: January 21, 2020, 05:16:24 PM »
The easiest way I have found to deal with these journal delays is to not use the journal. What I mean by that is to track the state of something yourself and then use the journal to "fix" the state just in case it's gotten out of sync. HTH
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.