Author Topic: Repeat x number of times, where x is a "suffix"?  (Read 1222 times)

PotatoJedi

  • Newbie
  • *
  • Posts: 15
Repeat x number of times, where x is a "suffix"?
« on: October 07, 2020, 06:38:19 AM »
Apologies in advance if this is covered somewhere already. I tried searching for it but couldn't find what I was looking for, and I'm not that good at coding to understand the documentation.

The closest I could find to what I was looking for is this thread https://forum.voiceattack.com/smf/index.php?topic=1463.0

I wasn't really able to understand how to make that work. This is what I'm after:


Prefixes:
Move left: press the left arrow
Move right: press the right arrow
Move up: press the up arrow
Move down: press the down arrow

Suffixes:
2, 3, 4, etc: repeat the prefix that many times.


So for example if I say "move right 6" it will press the right arrow 6 times. If I say "move down 4" it will press the down arrow four times. How do I do that without having to create a unique command for every single one?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Repeat x number of times, where x is a "suffix"?
« Reply #1 on: October 07, 2020, 08:17:59 AM »
Unless you have a specific reason to use prefix/suffix, this can be done more easily with a single command per direction, E.G.
Move left [2..10]
Code: [Select]
Start Loop : Repeat [{CMDSEGMENT:1}] Times
    Press Left key and hold for 0,03 seconds and release
End Loop

PotatoJedi

  • Newbie
  • *
  • Posts: 15
Re: Repeat x number of times, where x is a "suffix"?
« Reply #2 on: October 08, 2020, 06:53:04 AM »
Ah, thank you very much! I had no idea about the {CMDSEGMENT:1} thing. I'll see if I can find what that means in the manual as I'm curious now. I also had no idea you could put [2..10] or whatever inside of the command name. Sorcery I tell you!