Author Topic: Basic commands for activating ability one through three  (Read 3782 times)

gbry

  • Guest
Basic commands for activating ability one through three
« on: May 24, 2017, 06:33:02 AM »
When I say Activate ability [1..3]
Code: [Select]
Set small int (condition) [ability] value to the value of [[1..3]]
Begin Small Integer Compare : [Ability] Equals 1
    Press 1 key and hold for 0.1 seconds and release
Else If Small Integer Compare : [Ability] Equals 2
    Press 2 key and hold for 0.1 seconds and release
Else If Small Integer Compare : [Ability] Equals 3
    Press 3 key and hold for 0.1 seconds and release
End Condition
I don't know how to explain this, but I hope the code I posted explains it well, a basic ability activation script
How do I properly use the if commands and variables?

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Basic commands for activating ability one through three
« Reply #1 on: May 24, 2017, 11:46:14 AM »
Here are two approaches you can take. One uses variable keypresses and the other uses a conditional block. I've also included Help Document references for the sake of thoroughness.

When I say: Activate Ability [1..5]
Code: [Select]
//Store the numeric portion of the spoken command into text variable 'myAbility'. Double quotes must be included as shown.
//See page 112 and 117 of the Help Document for info about the CMD and TXTNUM tokens
Set Text [myAbility] to '{TXTNUM:"{CMD}"}'
//Use a variable keypress and dynamically create the keypress input based on value stored in myAbility
//See page 28 of the Help Document for info about Variable Keypress
Press variable key(s) [myAbility] and hold for 0.1 seconds and release

Code: [Select]
//Store the numeric portion of the spoken command into integer variable 'myAbility'. Double quotes must be included as shown.
//See page 112 and 117 of the Help Document for info about the CMD and TXTNUM tokens
Set integer [myAbility] value to the converted value of {TXTNUM:"{CMD}"}
//Use single conditions to determine next steps based on value of myAbility
//See page 50 of the Help Document for info about Conditional Blocks
Begin Integer Compare : [myAbility] Equals 1
    Press 1 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 2
    Press 2 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 3
    Press 3 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 4
    Press 4 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 5
    Press 5 key and hold for 0.1 seconds and release
End Condition

I hope this helps!  :)

gbry

  • Guest
Re: Basic commands for activating ability one through three
« Reply #2 on: May 24, 2017, 08:39:54 PM »
What is the difference between integer and small integer? Can I use smallint in this one?

gbry

  • Guest
Re: Basic commands for activating ability one through three
« Reply #3 on: May 24, 2017, 08:43:08 PM »
Here are two approaches you can take. One uses variable keypresses and the other uses a conditional block. I've also included Help Document references for the sake of thoroughness.

When I say: Activate Ability [1..5]
Code: [Select]
//Store the numeric portion of the spoken command into text variable 'myAbility'. Double quotes must be included as shown.
//See page 112 and 117 of the Help Document for info about the CMD and TXTNUM tokens
Set Text [myAbility] to '{TXTNUM:"{CMD}"}'
//Use a variable keypress and dynamically create the keypress input based on value stored in myAbility
//See page 28 of the Help Document for info about Variable Keypress
Press variable key(s) [myAbility] and hold for 0.1 seconds and release

Code: [Select]
//Store the numeric portion of the spoken command into integer variable 'myAbility'. Double quotes must be included as shown.
//See page 112 and 117 of the Help Document for info about the CMD and TXTNUM tokens
Set integer [myAbility] value to the converted value of {TXTNUM:"{CMD}"}
//Use single conditions to determine next steps based on value of myAbility
//See page 50 of the Help Document for info about Conditional Blocks
Begin Integer Compare : [myAbility] Equals 1
    Press 1 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 2
    Press 2 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 3
    Press 3 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 4
    Press 4 key and hold for 0.1 seconds and release
Else If Integer Compare : [myAbility] Equals 5
    Press 5 key and hold for 0.1 seconds and release
End Condition

I hope this helps!  :)

Of course I can *facepalm*

Thank you, that helps much!

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Basic commands for activating ability one through three
« Reply #4 on: May 25, 2017, 07:32:41 AM »
Awesome, glad I could help!

Regarding the int vs. small int - I inquired about this and Gary provided some feedback at the end of this post. It sounds like the small int is a carryover from legacy versions of VA. If you compare the options screens for setting an integer vs. a small integer you will see that they offer very similar functionality (though I believe there are size limitations for small integers).

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Basic commands for activating ability one through three
« Reply #5 on: May 25, 2017, 02:35:37 PM »
I believe there are size limitations for small integers
A small integer can contain a value from 32767 to –32768.