Author Topic: stop commands if not true  (Read 1617 times)

haro

  • Guest
stop commands if not true
« on: November 28, 2018, 04:13:34 AM »
hi there,


i have made a command like:

Name: does not equal ship

Begin Text Compare: {TXT:Status vehicle} Does Not Equal 'ship'
   Say 'you are not in your ship' (and wait until it completes)
   Exit Command
End Condition

I now have my command
Name: landing gear
which looks like this

Execute command 'does not equal ship' (and wait until it completes)
Press L bla bla
Say 'deploying landing gear'

the problem now is simple, landing gear does continue to run until the end, instead of stopping after "does not equal ship" when i am in my srv.

"exit command" from "does not equal ship" only stops "does not equal ship" but not "landing gear".
how can i achieve stopping the "landing gear" after my "does not equal ship" does not meet the condition?

i know i can put all the stuff in to the "landing gear", that works fine.
but i just wanted to make the commands more modular.
and clearer to read. simplification is good. :-)

kind regards,
haro

fyi:
i am using eddi as va plugin.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: stop commands if not true
« Reply #1 on: November 28, 2018, 04:51:15 AM »
The "Exit Command" action stops the command it's placed in, not all commands in that execution chain.


You'll have to use a variable to communicate between the two commands, either like this:

landing gear
Code: [Select]
Set Text [~~callingCommand] to '{CMD}'
Execute command 'does not equal ship' (and wait until it completes)
Press L bla bla
Say 'deploying landing gear'

does not equal ship
Code: [Select]
Begin Text Compare: {TXT:Status vehicle} Does Not Equal 'ship'
   Say 'you are not in your ship' (and wait until it completes)
   Kill command, '{TXT:~~callingCommand}' (by name)
End Condition


Or like this:

landing gear
Code: [Select]
Execute command 'does not equal ship' (and wait until it completes)
Begin Boolean Compare : [~~notShip] Equals True
   Exit Command
End Condition
Press L bla bla
Say 'deploying landing gear'

does not equal ship
Code: [Select]
Begin Text Compare: {TXT:Status vehicle} Does Not Equal 'ship'
   Say 'you are not in your ship' (and wait until it completes)
   Set Boolean [~~notShip] to True
End Condition

haro

  • Guest
Re: stop commands if not true
« Reply #2 on: November 28, 2018, 06:31:22 AM »
hello pfeil,

thanks alot.
just to be curious. are you from germany?

kind regards,
haro

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: stop commands if not true
« Reply #3 on: November 28, 2018, 06:34:40 AM »
No, I am not.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: stop commands if not true
« Reply #4 on: November 28, 2018, 09:54:23 AM »
He *is* part machine, though.