Author Topic: How do I make an "On my mark" command  (Read 7994 times)

Kantolo

  • Guest
How do I make an "On my mark" command
« on: April 13, 2017, 10:50:16 AM »
I have one of the HCS voice packs and I was fascinated by the "on my mark" extensions to the command, if anyone knows how to make a command similar to this I would be eternally grateful  ;D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I make an "On my mark" command
« Reply #1 on: April 13, 2017, 11:37:19 AM »
Can you elaborate on what you're looking for?

If you want to be able to say, for example "on my mark fire missiles", you would change the command phrase to [On my mark;]fire missiles and add something like the following to the top of the action list:
Code: [Select]
Begin Text Compare : [{CMD}] Starts With 'On my mark'
    Set Boolean [mark] to False
    Say, 'Waiting for your mark'
    Start Loop While : [mark] Does Not Equal True
    End Loop
    Say, 'Firing missiles'
    Set Boolean [mark] to False
End Condition

You also need a simple command to actually trigger the waiting command(s):
mark
Code: [Select]
Set Boolean [mark] to True

Kantolo

  • Guest
Re: How do I make an "On my mark" command
« Reply #2 on: April 13, 2017, 12:59:59 PM »
Can you elaborate on what you're looking for?

If you want to be able to say, for example "on my mark fire missiles", you would change the command phrase to [On my mark;]fire missiles and add something like the following to the top of the action list:
Code: [Select]
Begin Text Compare : [{CMD}] Starts With 'On my mark'
    Set Boolean [mark] to False
    Say, 'Waiting for your mark'
    Start Loop While : [mark] Does Not Equal True
    End Loop
    Say, 'Firing missiles'
    Set Boolean [mark] to False
End Condition

You also need a simple command to actually trigger the waiting command(s):
mark
Code: [Select]
Set Boolean [mark] to True

Thank you so much man, really helpful stuff. Have a nice day Pfeil

mikeycantoon

  • Guest
Re: How do I make an "On my mark" command
« Reply #3 on: September 19, 2017, 03:42:25 AM »
Hi there.  I'm having similar issue.  In my case.  I just want it to press a key after I say "mark".

So In this Case, I want it to press the V key.  I would like to be able to also use other key presses when needed from a different command.  Using your example, the text-to speech or using sounds don't play.  So I'm not sure if it's going through the command order correctly.  Here's what I have.  In it's current state, the commands run.  But the V key isn't pressed, the play sound or say commands also don't work.  Tested with my Astra profile and the acknowledgements work.  So I'm unsure what I'm doing wrong.  Any suggestions?  Oh, one thing I haven't addressed.  Is I also want to be able to make the command run immediately if I don't say "on my mark".
« Last Edit: September 19, 2017, 03:47:20 AM by mikeycantoon »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I make an "On my mark" command
« Reply #4 on: September 19, 2017, 04:21:19 AM »
Code: [Select]
Begin Text Compare : [CMD] Contains 'On my mark'Using "Contains" is fine, but you need the curly braces to indicate "{CMD}" is a token:
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'On my mark'Without them, VoiceAttack is checking a text variable named "CMD", which will likely be empty and return "Not Set".


add something like the following to the top of the action list
I said add, because what I posted is not intended to be the entire command; If you add the snippet to the top of your action list, it will pause the command provided "On my mark" is spoken, and process to execute whatever comes after it once "mark" is set to "True".

So your command would be:
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'On my mark'
    Set Boolean [mark] to False
    Play sound, '{VA_SOUNDS}\hcspack\Acknowledgements\Accepted.wav'
    Start Loop While : [mark] Does Not Equal True
    End Loop
    Set Boolean [mark] to False
End Condition
Press V key and hold for 0.1 seconds and release
Say, 'Titan Dropping'


I would like to be able to also use other key presses when needed from a different command
Can you elaborate on this?

mikeycantoon

  • Guest
Re: How do I make an "On my mark" command
« Reply #5 on: September 21, 2017, 03:21:45 PM »
Awe man first off.  Sorry for responding so late.  I could have sworn that I had turn on me email notifications if I got any replies to this post.  I didn't.  I just checked and saw you posted two days ago.

Okay.  I put that squiggly braces in, I don't know how I missed it.  Re-ordered as per your code.  And that was it.  It works.  Oh and For the last part that you wanted me to elaborate on, I didn't explain that really well.  But it was as you meant in the first place anyway, using [mark] as simply the trigger to initiate the command. 

It works exactly how I wanted.  If I just say the command with [mark] being triggered, the command for Pressing the V key executes.  if I say "on my mark" it waits for the trigger word [mark] and then executes.  Thanks a lot Pfeil!!!  I love messing with this stuff but after quite a few times of starting over and not getting why.  It really was the braces I was missing and the order was off.

Working Screenshots:

Hamalot

  • Guest
Re: How do I make an "On my mark" command
« Reply #6 on: January 31, 2018, 11:06:00 PM »
Since this is one of the top hits when you google 'on my mark' & voice attack, I thought I'd put my formula for making a generalized, universal 'On my mark' command here, with a 15 second timeout.

What it does: Say any existing command followed by 'On my mark,' and the command will wait until you've said 'Mark/Execute/Now/Engage/Punch it' 15 seconds before firing that specific command (if it exists).

CAVEATS: This doesn't work as well with single-worded commands (eg: 'map on my mark'). More often, it will fire both commands. This also only sets up for {CMD} On My Mark, and not On My Mark {CMD}. You definitely want to make sure your speech recognition is on point.

I was inspired by the HCS VoicePacks, and decided to figure out how to implement this without rewriting dozens of commands in my homegrown pack.

This breaks down in to 3 different commands created in VoiceAttack:
* The 'On my mark' with a wildcard trap
* The 'Mark' command that will trip when you say 'Mark'
* A timer command, to prevent the first from being stuck in a loop for too long.

Below is the code for each, along with a run down of the steps on how to do the fancy stuff.

Code: [Select]
When I Say: *On my mark
Set Boolean [mark] to False
Set Boolean [timeout] to False
Execute Command 'MarkTimer'
Execute Command 'Acknowledge'
Start Loop While: [mark] Does Not Equal True AND [timeout] Does Not Equal True
End Loop
Begin Condition: [mark] Equals True AND [timeout] Does Not Equal False
    Execute Command, '{CMD_BEFORE}' (by name)
End Condition
For the While Loop and If Statement, you'll want to select them by looking for their Compound Condition Builder, respectively.

For the Execute Command, this will give you a warning (which you should read) when inputing {CMD_BEFORE} into the text field & saving.

Pay attention to the 'When I Say' field. If you want 'On My Mark' to come BEFORE the command, then use On my mark* with {CMD_AFTER}

Code: [Select]
When I Say: [Mark;Execute;Now;Engage;Punch it]
Set Boolean [mark] to True

Easy peasy.

Code: [Select]
MarkTimer (voice disabled)
Set small int (condition) [markTimer] value to 15
Start Loop While: [markTimer] Is Greater Than Or Equal To 0 AND [mark] Equals False
    Pause 1 Second
    Set Small Int (condition) [markTimer] value as decremented by 1
End Loop
Begin Condition: [markTimer] Is Less Than Or Equal To 0 AND [mark] Equals False
    Set Boolean [timeout] to True
    Execute Command, 'Error'
End Condition

Again; use the Compound Condition Builder for the While and Conditional pieces.

Hopefully this helps any others that come across this post, and if anyone has any pointers or obvious pitfalls with this method, let me know!
« Last Edit: April 11, 2018, 12:14:56 PM by Hamalot »

Kroiden

  • Guest
Re: How do I make an "On my mark" command
« Reply #7 on: February 01, 2018, 02:04:35 AM »
Question, is this doable without HCS voice packs? because it's not working for me.
Yes, a newbie here trying to understand all this mess (for me xD)
« Last Edit: February 01, 2018, 02:43:48 AM by Kroiden »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I make an "On my mark" command
« Reply #8 on: February 01, 2018, 08:10:40 AM »
This is all VoiceAttack logic, HCS Voice Packs aren't referenced or required.

That said, looking at the problem now, this is probably a better way to do it, at least in the sense that it avoids using a loop:
[On my mark;]fire missiles
Code: [Select]
Begin Text Compare : [{CMD}] Starts With 'On my mark'
    Say, 'Waiting for your mark'
    Set Text [markedCommand] to 'fire missiles'
End Condition - Exit when condition met
Begin Text Compare : [markedCommand] Equals 'fire missiles'
    Set Text [markedCommand] to [Not Set]
    Say, 'Firing missiles'
End Condition
Press Space key and hold for 0,06 seconds and release

my mark
Code: [Select]
Begin Text Compare : [markedCommand] Has Been Set
    Execute command, '{TXT:markedCommand}' (by name)
Else
    Say, 'No marked command'
End Condition


I've attached both of my examples, so you can import them if you'd like to have a look at how they're set up.

Kroiden

  • Guest
Re: How do I make an "On my mark" command
« Reply #9 on: February 01, 2018, 02:45:09 PM »
Ok, it finally worked.
It seems the problem was how I typed the command, [x action on my mark] was recognized, but wasn't triggering the effect, guess because of the text compare contains, that needs the phrase separately.
So [x action] [on my mark;] solved it.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I make an "On my mark" command
« Reply #10 on: February 01, 2018, 02:59:29 PM »
Page 17 to 19 of VoiceAttackHelp.pdf tell you more about Dynamic Command Sections; You don't need square brackets around non-dynamic sections.