Author Topic: Expanded 'allow other commands to execute' functionality  (Read 2533 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Expanded 'allow other commands to execute' functionality
« on: May 07, 2018, 10:50:13 AM »
Currently there is only one option to allow/disallow other commands to run while a given command is executing. It would be neat to be able to specify that other commands can run but they can only be executed via certain means. For instance, it would be cool to have a command run and allow additional commands to run only if those additional commands are executed via key press (i.e., blocking commands executed by voice, mouse, or gamepad)

Thanks!

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: Expanded 'allow other commands to execute' functionality
« Reply #1 on: May 07, 2018, 11:51:36 AM »
Inside the command, you can check to see how the command was executed by looking at the {CMDACTION} token.

{CMDACTION} -  The method by which the current command was executed.  The possible results are, 'Spoken', 'Keyboard', 'Joystick', 'Mouse', 'Profile', 'External', 'Unrecognized' and 'Other'.  The value will be, 'Spoken' if the command was executed by a spoken phrase, 'Keyboard' if the command was executed using a keyboard shortcut, 'Joystick' if executed by a joystick button, 'Mouse' if executed by a mouse button click and 'Profile' if the command was executed on profile load (from the command indicated in the profile options screen).  The value will be 'External' if the command is executed from a command line.  'Unrecognized' will be the value if the command was executed using the unrecognized phrase catch-all command in the profile options screen.  'Other' is reserved.

I believe, 'External' is also the type if you right-click on the command and select, 'execute'.  Need to check/update the docs.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Expanded 'allow other commands to execute' functionality
« Reply #2 on: May 07, 2018, 12:32:36 PM »
Very true. However if I have a profile with a lot of commands that I want to "filter" while a particular command is running I would have to add these checks either to all the commands or via a helper function. There would also need to be a check to see if the command of interest is running so that filtering could be applied.

Putting all this control at the command of interest level would cut down on this complexity.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 280
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Expanded 'allow other commands to execute' functionality
« Reply #3 on: May 07, 2018, 02:11:42 PM »
I require this sort of thing all of the time with certain systems, and it is as simple as doing what a programmer or scripter would:  Add a variable and a conditional "if/then" comparison.

Some of my game profiles are so small (just a handful of commands) that rather than create a separate VA Profile for that game (which would keep those commands from "mis-firing" during normal use), I just make a boolean variable for those commands:

When I say:  Initialize ARK [Survival;] Commands
Code: [Select]
Set Boolean [ARKinitialized] to True
And the condition in every command for that game (ARK Survival) goes between a check:
Code: [Select]
Begin Boolean Compare : [ARKinitialized] Equals True
    //All command actions go here
End Condition

This is a very basic example, but I need to use it often for very complex systems, and so any command that needs to check if another is running, or if it was called by another command, or otherwise, has a comparison at some point inside the command that was determined by a simple boolean variable.

All the tools are already there, if you get creative... and this isn't that far of a stretch in terms of "creative workarounds", like I said before these are actually basic principals used in simple and advanced programming and scripting.
« Last Edit: May 07, 2018, 02:55:03 PM by SemlerPDX »