Author Topic: Can you write what is in the CMD token?  (Read 488 times)

Uzaree

  • Newbie
  • *
  • Posts: 18
Can you write what is in the CMD token?
« on: June 15, 2024, 05:24:01 PM »
I have a command, Looking for [1..50] items.

When i call it all i get on the screen is "Looking for  items."

I feel like I am over thinking this.  From what I understand is that is in the token {CMD}

So how do turn that into a variable so I can write that in my string?

Sorry in advance for the noobie question.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: Can you write what is in the CMD token?
« Reply #1 on: June 15, 2024, 09:39:50 PM »
Code: [Select]
Set text [count] to '{CMD}'
Set integer [count] value to the converted value of {TXTNUM:count}
Quick Input, '{TXTNUM:count}'

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Can you write what is in the CMD token?
« Reply #2 on: June 16, 2024, 12:20:51 AM »
When i call it all i get on the screen is "Looking for  items."
What are you referring to by "call it"? If the "When I say" field of your command is set to "Looking for [1..50] items", the recognized phrase would have to contain a number.

So how do turn that into a variable so I can write that in my string?
What do you mean by "write that in my string"?
In most cases, tokens can be used directly, unless you very specifically need a variable.


Given that you're using dynamic command sections, you can get just the number using the "{CMDSEGMENT:}" token, E.G.
Code: [Select]
Quick Input, '{CMDSEGMENT:1}'

If you were to use the "{TXTNUM:}" token instead, to remove everything from the recognized phrase except the number, that could look like this:
Code: [Select]
Quick Input, '{TXTNUM:"{CMD}"}'

Uzaree

  • Newbie
  • *
  • Posts: 18
Re: Can you write what is in the CMD token?
« Reply #3 on: June 16, 2024, 07:36:53 AM »
Thank you, that worked perfectly!

Uzaree

  • Newbie
  • *
  • Posts: 18
Re: Can you write what is in the CMD token?
« Reply #4 on: June 16, 2024, 07:42:11 AM »
When i call it all i get on the screen is "Looking for  items."
What are you referring to by "call it"? If the "When I say" field of your command is set to "Looking for [1..50] items", the recognized phrase would have to contain a number.

So how do turn that into a variable so I can write that in my string?
What do you mean by "write that in my string"?
In most cases, tokens can be used directly, unless you very specifically need a variable.


Given that you're using dynamic command sections, you can get just the number using the "{CMDSEGMENT:}" token, E.G.
Code: [Select]
Quick Input, '{CMDSEGMENT:1}'

If you were to use the "{TXTNUM:}" token instead, to remove everything from the recognized phrase except the number, that could look like this:
Code: [Select]
Quick Input, '{TXTNUM:"{CMD}"}'

Ok, one more question,  If I were to use a string in the dynamic command like [ White; Blue; Green]  how would that be broken out?

Uzaree

  • Newbie
  • *
  • Posts: 18
Re: Can you write what is in the CMD token?
« Reply #5 on: June 16, 2024, 07:49:10 AM »
When i call it all i get on the screen is "Looking for  items."
What are you referring to by "call it"? If the "When I say" field of your command is set to "Looking for [1..50] items", the recognized phrase would have to contain a number.

So how do turn that into a variable so I can write that in my string?
What do you mean by "write that in my string"?
In most cases, tokens can be used directly, unless you very specifically need a variable.


Given that you're using dynamic command sections, you can get just the number using the "{CMDSEGMENT:}" token, E.G.
Code: [Select]
Quick Input, '{CMDSEGMENT:1}'

If you were to use the "{TXTNUM:}" token instead, to remove everything from the recognized phrase except the number, that could look like this:
Code: [Select]
Quick Input, '{TXTNUM:"{CMD}"}'

Ok, one more question,  If I were to use a string in the dynamic command like [ White; Blue; Green]  how would that be broken out?

I am trying to use {CMDSEGMENT:2} right after the {TXTNUM:{CMD}} but I get Not Set for the number. It does give me white,blue or green however

Uzaree

  • Newbie
  • *
  • Posts: 18
Re: Can you write what is in the CMD token?
« Reply #6 on: June 16, 2024, 07:51:05 AM »
I figured it out, I just used

{CMDSEGMENT:1}  {CMDSEGMENT:2}

works perfectly!

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 280
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Can you write what is in the CMD token?
« Reply #7 on: June 16, 2024, 02:30:58 PM »
Yep - as you may have already noticed, command segments are zero indexed meaning the first element starts at 0 and not 1.

Best wishes and have fun!!