Author Topic: Can I create a command that randomly chooses from 4 optional hotkeys?  (Read 2890 times)

DanSinnerG

  • Newbie
  • *
  • Posts: 2
Just like the function to 'play a random sound' -  I would appreciate some guidance in creating a command that will "play" or select 1 of 4 optional hotkey commands.

Thanks in advance for your help

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Can I create a command that randomly chooses from 4 optional hotkeys?
« Reply #1 on: November 11, 2019, 02:38:36 PM »
You can generate a random number, then use conditions to press a specific key based on that number.

E.G.
Code: [Select]
Set integer [~random] value as random from 1 to 4
Begin Integer Compare : [~random] Equals 1
    Press 1 key and hold for 0,01 seconds and release
Else If Integer Compare : [~random] Equals 2
    Press 2 key and hold for 0,01 seconds and release
Else If Integer Compare : [~random] Equals 3
    Press 3 key and hold for 0,01 seconds and release
Else
    Press 4 key and hold for 0,01 seconds and release
End Condition


If you want to use existing commands, you can replace the keypress actions with "Execute Another Command" actions.

DanSinnerG

  • Newbie
  • *
  • Posts: 2
Re: Can I create a command that randomly chooses from 4 optional hotkeys?
« Reply #2 on: November 12, 2019, 06:57:30 PM »
Thanks, that looks like it might do the trick