Author Topic: I must be tired :)  (Read 3407 times)

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
I must be tired :)
« on: January 30, 2018, 02:25:40 PM »
either I'm tired or plugin coding has muddled my brain but I've spent over an hour trying to get this to work, beta and not beta:

[divert;] Power to [engines;shields;systems;weapons]; [Engines;shields;systems;weapons] Full power

Begin Text Compare : [{CMDSEGMENT:2}] Has Been Set
    Set Text [~spoken] to '{CMDSEGMENT:2}' (Replace 'shields' with 'systems')
Else
    Set Text [~spoken] to '{CMDSEGMENT:0}' (Replace 'shields' with 'systems')
End Condition

no matter what I do I can't get the else to trigger. I've tried vars instead of the tokens, ="", taken off the replace. Help :)

the other issue turned out to be the not set local var bug crashing things which you have fixed in beta ;)

Lee
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

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

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: I must be tired :)
« Reply #1 on: January 30, 2018, 05:14:01 PM »
Can you export and post so I can run it exactly like you've got it?

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: I must be tired :)
« Reply #2 on: January 30, 2018, 06:16:27 PM »
here you go. I'm sure the codes right (famous last words)


if you say "power to engines" you can see the cmd it tries to run contains the word engines

if you say engines full power you'll get a not set in that cmd as it's skipped the else where it sets what ~spoken is
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

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

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: I must be tired :)
« Reply #3 on: January 30, 2018, 06:35:37 PM »
I dig what you're doing here.  However, the check for set/not set is ONLY for variables. 
Quote
Begin Text Compare : [{CMDSEGMENT:2}] Has Been Set

...is (I *think*) first looking to see if a variable by the name of whatever is in CMDSEGMENT:2 (so, if it's 'engines' it's looking first to see if there's a variable named, 'engines'). It doesn't find it, so, it's using the rendered value of the token, which is 'Not Set' if there is no value.  'Not Set' is rendered because it is an indication of, NULL.  Since most VA users are not programmers, 'NULL' would be confusing, so, 'Not Set' is at least *some* indication (that is not blank and not, 'NULL').

So, long story longer, you're either going to have to stuff the value into a variable and compare, OR, change your condition to this:
Begin Text Compare : [{CMDSEGMENT:2}] Does Not Equal ''Not Set''


It's trying to be simple for those that need it and overloaded to the point of insanity for those that have nothing better to do with their time o_O   <--- think i'll put that on the site

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: I must be tired :)
« Reply #4 on: January 31, 2018, 03:25:20 AM »
I tried all that as well and still couldn't get it to work

tmp = cmdsegment:0

if tmp is not set

if tmp =""

if tmp <> "" and changing the order around etc etc

pretty much every combination I could think of
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

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

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: I must be tired :)
« Reply #5 on: January 31, 2018, 07:26:54 AM »
I don't see any indication of trying to check for the literal value of, 'Not Set' (since you are checking against the *rendered* value of a token):

Begin Text Compare : [{CMDSEGMENT:2}] Does Not Equal 'Not Set'
    Write '[ Blue] if' to log
Else
    Write '[ Blue] else' to log
End Condition

This works for me (attached)

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: I must be tired :)
« Reply #6 on: January 31, 2018, 07:56:51 AM »
ahhhh I see what you've done :)

Thank you for the help with that
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

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