Repeat until match (scripting)?

Post Reply
arcy
Posts: 2
Joined: Wed Sep 08, 2021 12:01 pm

Repeat until match (scripting)?

Post 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.
Last edited by arcy on Wed Sep 08, 2021 1:38 pm, edited 1 time in total.

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Repeat until match (scripting)?

Post 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

arcy
Posts: 2
Joined: Wed Sep 08, 2021 12:01 pm

Re: Repeat until match (scripting)?

Post by arcy »

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

Post Reply