Page 1 of 1

Repeat until match (scripting)?

Posted: Wed Sep 08, 2021 12:07 pm
by arcy
Hello! I promise I tried my best to solve it on my own. I really just don't know enough to make it happen, though.
I would like to send the last command sent every second until the string denoting success is received. How should I go about it?

Edit: Or just sending every time the 'fail' string is sent would work too.

Re: Repeat until match (scripting)?

Posted: Wed Sep 08, 2021 1:26 pm
by demonnic
In an alias, I would have the following code
Code: [show] | [select all] lua
send("Thing to send")
thingSendTimer = tempTimer(1, function() send("Thing to send") end, true)
And then in a trigger for the success line, the following
Code: [show] | [select all] lua
if thingSendTimer then
  killTimer(thingSendTimer)
end
And then the alias should send the thing, and keep sending the thing every second until the trigger matches saying it succeeded

Re: Repeat until match (scripting)?

Posted: Wed Sep 08, 2021 1:47 pm
by arcy
demonnic wrote:
Wed Sep 08, 2021 1:26 pm
Works like a charm - thank you! Hopefully I learned something from this :D