Author Topic: delimited list variable and/or token type?  (Read 2251 times)

jcdick1

  • Jr. Member
  • **
  • Posts: 59
delimited list variable and/or token type?
« on: January 10, 2021, 02:38:14 PM »
I am in a particular situation of trying to accomplish a goal using VA that requires a dynamic list.  But I can imagine other scenarios where it might be useful.  So let's say a three number lottery:

Set {number draw} = {RANDOM:1:10}  <- comes up 9

Set {INTLST:results}= {number draw}    <- now contains "9"

Set {number draw} = {RANDOM:1:10}  <- comes up 3

Append {INTLST:results} = {number draw}  <- now contains "9;3" and using a semicolon as a delimiter.  I suppose it could be anything.

Set {number draw} = {RANDOM:1:10}  <- comes up 5

Append {INTLST:results} = {number draw}  <- now contains "9;3;5"

VA:  "Choose a number between one and ten

User: 2

Set {INTLST:user choice} = 2

VA:  "Choose another number between one and ten

User: 6

Append {INTLST:user choice} = 6  <- now contains "2;6"

And then after the third, do a compare:

If {INTLST:user choice} = {INTLST:results}
    Say "You win!"
Else
    Say "Sorry, you lose."

This could be useful for TXT values, as well.

Set {TXTLST:friends for lunch} = dave;martha;stewart

VA: "What's your name?"

Me: "Martha"

Set {TXT:user name} = Martha

If {TXTLST:friends for lunch} = {TXT:user name} then
   Say "Okay, we're having lunch!"
Else
    Say "I don't want to have lunch with you."

The above would result in having lunch with VA, because "Martha" matches one of the values in the {TXTLST:friends for lunch}.

Hopefully that makes sense.

It would also be good to be able to remove individual values from the LST variable.

I realize much of this can be done with a series of "advanced" tokens and such, but this would put a lot of the "heavy lifting" under the covers for users.
« Last Edit: January 11, 2021, 12:53:17 PM by jcdick1 »