Author Topic: Cycle Commands  (Read 6333 times)

Astral_Nomad

  • Newbie
  • *
  • Posts: 14
Cycle Commands
« on: May 19, 2016, 07:17:21 PM »
Hello All.

I thought I would show an example of a "cycle" function you can create in VA. This cycle function will allow you to verbally choose which mode you would like particular setting to be set to. You dont have to scroll through the settings one by one - VA will do that for you. you simply just need to call out the name of the setting, and poof! done.
   
For this example, I used the "Lights" command and modes from Eurotruck Simulator 2. I chose this game for the example, as I dont have Elite Dangerous set up, and Im still a pretty big newbie with Star Citizen.

The Lights command is activated by pressing the L key once for each mode.
   There are 3 modes -
   -All lights off - where all lights are turned off (mode 0)
   -Dashboard + auxillary truck lights (mode 1)
   -All lights are on, including the headlights (mode 2)

In the commands I have given each of these mode a value ranging from 0 to 2. This "index range" is the range we will use for traversing modes.
   
The first thing you will want to do is set up 2 small int's that will be set at profile startup. We will call them "mode-lights" and "mode-target". Each will be reset to 0. "mode-lights" will represent the current mode that the lights are set to. "mode-target" will represent the mode we wish to switch to.

The "Lights Loop" has an instruction to reset mode-lights to 0. This might be unfamiliar to those who do not code or not code in any significant capacity. What it does essentially is keep the index number from running off the cliff like a stampeding lemming.. ;) When it gets out of the range of possible mode (ie. achieving a value of "3"), the condition detects it, and pulls it all the way back to zero to start over. Kind of like a roundabout.. ;)

I have grouped the commands as per their function. The inits, and keybind are obvious - then we have The standard commands to switch to a mode.

Manual setting functions are there because sometimes (especially after you reload a savegame) the index can be out of alignment due to the mode that was saved in the savegame possibly being different from what they are currently. Using these commands will allow you to realign the index with what is actually set in the game. If you find when you issue a command, and VA doesnt comply (properly), thats usually the cause.

I have also set up a Status function so that if you are ever in doubt about what mode the VA is currently in, just ask with "Lights Status".

The difference between the standard commands and the manual commands, is that the standard commands will actually try switching modes before setting the new mode-lights value. The manual commands only set the mode-lights to the correct value.

I have added additional Say commands to the profile to give feedback as to whats going on when its used. You dont need to have ETS2 to use it to see how it functions - just open Notepad or something so that VA has somewhere to direct the keypresses to.

I should just note that I know that these commands could be optimized. I wasnt trying to write massively complex commands. Its just an illustration of how one "might" do it with a bit of knowledge.

If anyone has any questions about profile, just ask - ill try to answer the best I can.