Author Topic: Why can't I get these tokens to work?  (Read 4476 times)

Antrys

  • Newbie
  • *
  • Posts: 22
Why can't I get these tokens to work?
« on: June 28, 2017, 01:46:50 AM »
I feel like I'm missing a major concept here.  I've been at this for hours. :-[

Why doesn't this work?

Code: [Select]
**Note: That {TXT:System name} IS set all by itself, in memory, from another command. 
**Specifically set a unique variable to "not set" condition
Set Text [{TXT:System name} CAPTAINS LOG] to [Not Set] (save value to profile)

Begin Text Compare : [{TXT:System name} CAPTAINS LOG] Has Been Set
    Write '[Yellow] Program thinks {TXT:system name} CAPTAINS LOG Has been set.' to log

Else If Text Compare : [{TXT:System name} CAPTAINS LOG] Has Not Been Set
    Write '[Yellow] Program thinks "{TXT:system name} CAPTAINS LOG" Has NOT been set.' to log
End Condition

Log Output:
03:56:27 - Program thinks Col 285 Sector HN-Q b6-3 CAPTAINS LOG Has been set.

This resolves to the "SET" condition no matter what I try to do.
I'm totally at a loss.
« Last Edit: June 28, 2017, 02:01:50 AM by Antrys »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Why can't I get these tokens to work?
« Reply #1 on: June 28, 2017, 03:07:39 AM »
By all accounts that should return "Not set", as that variable doesn't exist("Not set" represents NULL, though internally it's most likely "list does not contain an item by this name").

You could post this in the "issues" section, as it does appear to be a bug.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: Why can't I get these tokens to work?
« Reply #2 on: June 28, 2017, 07:19:09 AM »
Do you have any plugins or async commands running?

You will need to export your command and upload it here (faster) or send to support@voiceattack.com, as it's hard to tell exactly what is going on by just looking at it.

And the usual:  Indicate the steps you are taking, the results you are expecting, and the results you are receiving.


Antrys

  • Newbie
  • *
  • Posts: 22
Re: Why can't I get these tokens to work?
« Reply #3 on: June 28, 2017, 03:56:08 PM »
I have the EDDI plugin.  That's where it pulling {TXT:System name} from.

As far as the command, I've stripped it down to what you see above, as a stand-alone command.

At this point I've given up on this method.  I've written most of a new routine, that I hope will work better.

Just to make sure though, One of the things I was trying to wrap my head around was the difference between these two:
Code: [Select]
Begin Text Compare : [{TXT:System name} CAPTAINS LOG] Has Been Setand
Code: [Select]
Begin Text Compare : [{TXT:{TXT:System name} CAPTAINS LOG}] Has Been Set

Antrys

  • Newbie
  • *
  • Posts: 22
Re: Why can't I get these tokens to work?
« Reply #4 on: June 28, 2017, 04:03:45 PM »
Addendum to my above post.

Attached is the command.
I've tried loading it into its own profile and disabling plugin support.
Same result.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Why can't I get these tokens to work?
« Reply #5 on: June 28, 2017, 04:16:48 PM »
One of the things I was trying to wrap my head around was the difference between these two:
Code: [Select]
Begin Text Compare : [{TXT:System name} CAPTAINS LOG] Has Been Setand
Code: [Select]
Begin Text Compare : [{TXT:{TXT:System name} CAPTAINS LOG}] Has Been Set
Provided the text variable "System name" is set to "Alpha", and the text variable "test CAPTAINS LOG" is set to "stardate"

The first example would result in the text variable named "Alpha CAPTAINS LOG" being evaluated.

The second example would result in the contents of the text variable "Alpha CAPTAINS LOG" being evaluated, I.E. you'd be checking whether a text variable named "stardate" is set.

Antrys

  • Newbie
  • *
  • Posts: 22
Re: Why can't I get these tokens to work?
« Reply #6 on: June 28, 2017, 04:42:59 PM »
Yes, what I was trying to do was kill two birds with one stone.

If I recorded a captains log for system "Alpha"  I wanted to set a text variable called "Alpha CAPTAINS LOG" with the date in it.

By checking If the variable "Alpha CAPTAINS LOG" existed in the saved profile, It would tell me:
1) Yes, I recorded a captains log for this system
Then I could pull the date it was recorded from the same variable.

I tried the {TXT:{TXT:System name} CAPTAINS LOG} approach also, and couldn't get that work when evaluating either.
When the {TXT:System name} changed, say to "beta" the {TXT:{TXT:System name} CAPTAINS LOG} still evaluated as "set" 
Actually, if {TXT:System name} is set to anything, {TXT:{TXT:System name} CAPTAINS LOG} always evaluates as [SET].
Which surprises me because just before evaluating I implicitly set {TXT:{TXT:System name} CAPTAINS LOG} to [Not Set]

(I've attached the command written this way, to this message)

I'm starting to suspect it's a bug in the way  Begin Text Compare handles tokens.  As evidenced by the output of:
19:28:10 - Program thinks Not set - **Has** been set. in the log of the attached command.
« Last Edit: June 28, 2017, 05:35:10 PM by Antrys »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: Why can't I get these tokens to work?
« Reply #7 on: June 28, 2017, 06:16:04 PM »
As it stands, the text compare cannot accept, 'variable' variable names.  The box accepts tokens so that you can compare a rendered token to something.

The, 'Set Text Value' can accept, 'variable' variable names, but the condition check is so overloaded that it can't (without adding more UI).  You'll need to use an intermediary variable before doing your condition check.