Author Topic: Dynamic Boolean Variable  (Read 809 times)

Oss133

  • Newbie
  • *
  • Posts: 21
Dynamic Boolean Variable
« on: August 07, 2019, 08:12:48 AM »
Hi,

I am us VA to control Elite: Dangerous.

I have a text variable, SHIP, that contains the name of the ship I am currently flying.

I can set a dynamic boolean variable, CHON{TXT:SHIP}, to either True or False to indicate whether the Cargo Hatch module of a given ship is on or off.

This all works fine. "Set Boolean [CHON{TXT:SHIP}] to True"

However, if I try and use this dynamic variable in a Begin Boolean Compare function, I get an error. "Boolean variable names may not contain colons"

Any idea what I am doing wrong? Or is it just a limitation of VA?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Dynamic Boolean Variable
« Reply #1 on: August 07, 2019, 08:20:39 AM »
Only the "Text" tab of condition actions accepts tokens.

To use tokens in variable names, you'll have to do something like
Code: [Select]
Begin Text Compare : [{BOOL:CHON{TXT:SHIP}}] Equals 'True'


Note that at that point you're using a literal text value (as outputted by the token), not a reference to a variable.
Because of this, you can't use the "Has Been Set" or "Has Not Been Set" operators. Instead you'll have to compare to the literal text "Not set":
Code: [Select]
Begin Text Compare : [{BOOL:CHON{TXT:SHIP}}] Equals 'Not set'

Oss133

  • Newbie
  • *
  • Posts: 21
Re: Dynamic Boolean Variable
« Reply #2 on: August 07, 2019, 08:26:03 AM »
Thanks for the prompt response! I'll give that a try.

Brilliant. That works. Saves me having to copy the dynamic variable to a simple one before checking it.

It feels like a "work around" though. (Just an observation. Not a criticism).