Author Topic: Need help with adding a wait for mouse click...  (Read 100 times)

ibastavd

  • Newbie
  • *
  • Posts: 3
Need help with adding a wait for mouse click...
« on: April 11, 2018, 10:56:50 am »
Hi,

I'm trying to add a wait until the left mouse button is pressed into a VA command. I'm not thick but I'm stumped!

My command has 10 of:

"Press R key and hold for 1.9 seconds before release commands"

I'd like it to wait until I've clicked the left mouse button before it proceeds with the next one

Any help would be great

Thanks

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1297
  • RTFM
Re: Need help with adding a wait for mouse click...
« Reply #1 on: April 11, 2018, 11:25:51 am »
Add this where you want the command to wait:
Code: [Select]
Start Loop While :  Left Mouse Button Is Not Pressed
End Loop

The loop will keep running until you press the left mouse button, at which point it will end and whatever actions are below it will be executed.

ibastavd

  • Newbie
  • *
  • Posts: 3
Re: Need help with adding a wait for mouse click...
« Reply #2 on: April 11, 2018, 01:01:54 pm »
Thanks Pfeil,

I hate to have to ask but how do I add that command?

Embarrassed or what!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1297
  • RTFM
Re: Need help with adding a wait for mouse click...
« Reply #3 on: April 11, 2018, 04:28:03 pm »
In the "Edit a Command" window, click "Other >", go to "Advanced >", "Add a Loop Start", click "Single Condition(While Loop)".

Click the "Device State" tab, in the first dropdown select "Mouse button" in the second dropdown select "Left", in the third dropdown select "Is Not Pressed", click "OK" and the actions will be added to your command.

ralf44

  • Newbie
  • *
  • Posts: 40
Re: Need help with adding a wait for mouse click...
« Reply #4 on: April 13, 2018, 02:20:28 pm »
I'd make a command and call it what you want to say to start the 10 presses, like "Execute Combo."

You could also have it trigger when you press some key, to save your voice. VA allows multiple inputs to trigger one command.

Anyway the awesome Execute Combo command would have about two or three lines. Just to wait for mouse click and then press R.

Instead of copy pasting that to repeat it, there's a box near the bottom right of the VA Edit Command interface which lets you tell a command to repeat (X) times so you'd just type 10 in that box and you're done.

Myself I would add a cancel command, activated by voice and optionally a keypress, called Cancel Combo. That would only have one line, to stop the other command.

So the code for both could look like:

"Execute Combo" (or whatever you want to say):
Say something with text-to-speech: "Engaged"
Start Loop While :  Left Mouse Button Is Not Pressed
Pause for 0.05 seconds (just be sure the loop doesn't waste processor time)
End Loop
Press R key and hold for 1.9 seconds
(in bottom options, type 10 into the Repeat this command X times box)

(in top options, can add a keypress which will work as well as the voice control)

2nd VA Command, for safety -
"Cancel combo" (or whatever you want to say, and an optional keyboard equivalent):
Kill Command "Execute combo" (or whatever)
Say something with text-to-speech: "Cancelled"
(Do not type a number into the repeat box for this one!)

If you already have a big command full of steps which does other stuff with this 10-R pattern in the middle, you just put:
Start another Voice Attack command: "Execute combo" (and wait for it to complete)
in there.
« Last Edit: April 13, 2018, 02:37:12 pm by ralf44 »

ibastavd

  • Newbie
  • *
  • Posts: 3
Re: Need help with adding a wait for mouse click...
« Reply #5 on: April 16, 2018, 10:08:36 am »
Thanks Guys! My heroes!

Mac