Author Topic: Multiple Variable Command  (Read 1129 times)

tazius

  • Guest
Multiple Variable Command
« on: May 11, 2019, 12:02:39 AM »
Novice with VA here. When I set up voice commands the actions are usually a list of key presses or setting text to the windows clipboard to a value & ctrl pasting it. It's tedious because I have to create a unique command to match up with unique action list. I'm looking for a better way to greatly reduce the number of commands & actions I have to set up.

I'm trying to voice automate the admin console commands for my MORDHAU server.

Here is a list of the possible map rotation console command combinations:

Front Line:
ChangeLevel FL_Taiga
ChangeLevel FL_MountainPeak
ChangeLevel FL_Camp
ChangeLevel FL_Grad

Skirmage:
ChangeLevel SKM_Contraband
ChangeLevel SKM_Camp
ChangeLevel SKM_Grad
ChangeLevel SKM_ThePit
ChangeLevel SKM_MountainPeak
ChangeLevel SKM_Tourney
ChangeLevel SKM_Taiga

Team Death Match:
ChangeLevel TDM_Contraband
ChangeLevel TDM_Camp
ChangeLevel TDM_Camp_64
ChangeLevel TDM_Grad
ChangeLevel TDM_ThePit
ChangeLevel TDM_MountainPeak
ChangeLevel TDM_Taiga
ChangeLevel TDM_Taiga_64
ChangeLevel TDM_Tourney

Deathmatch/Free For All:
ChangeLevel FFA_Contraband
ChangeLevel FFA_Camp
ChangeLevel FFA_Grad
ChangeLevel FFA_ThePit
ChangeLevel FFA_MountainPeak
ChangeLevel FFA_Taiga
ChangeLevel FFA_Tourney

Horde:
ChangeLevel HRD_Camp
ChangeLevel HRD_Grad
ChangeLevel HRD_Taiga
ChangeLevel HRD_MountainPeak

Battle Royal:
ChangeLevel BR_Grad
ChangeLevel BR_Taiga


Rather than create custom commands for each of these combinations it would be nice to have variables for the mode & the map in a single command so all I have to say is the below and it will automatically pull the combination.

Change Level Frontline Taiga
Change Level Skirmage Camp
Change Level Horde Grad

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Multiple Variable Command
« Reply #1 on: May 11, 2019, 01:42:57 AM »
Natively you'd have to do something like this:
Code: [Select]
Begin Text Compare : [{CMDSEGMENT:1}] Equals 'Front Line'
    Set Text [consoleCommand] to 'FL'
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'Skirmage'
    Set Text [consoleCommand] to 'SKM'
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'Team Death Match'
    Set Text [consoleCommand] to 'TDM'
Else If : [{CMDSEGMENT:1}] Equals 'Deathmatch' OR [{CMDSEGMENT:1}] Equals 'Free For All'
    Set Text [consoleCommand] to 'FFA'
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'Horde'
    Set Text [consoleCommand] to 'HRD'
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'Battle Royal'
    Set Text [consoleCommand] to 'BR'
End Condition
Set Text [consoleCommand] to 'ChangeLevel {TXT:consoleCommand}_{TXTREPLACEVAR:"{CMDSEGMENT:2}":" ":"_"}'
Press ~ key and hold for 0,01 seconds and release
Quick Input, '{TXT:consoleCommand}'
(I don't know how the actual game takes commands, just pressing tilde as an example)

If the console commands are case sensitive, you'll have to use a condition tree for the map names as well as the modes.


Otherwise you'd have to use an inline function that does the lookup instead; I've used dictionaries or multi-dimensional arrays for this before.
If you don't want to deal with the downsides of variables in command names, it's also handy to have the inline function output the full command string to the clipboard, so you can just paste it into the "When I say" field.