Check if a trigger fires?

Posted by Renny on Sat 25 Oct 2014 01:54 AM — 5 posts, 18,098 views.

Canada #0
I took a look around but couldn't find any threads on this.

I want to create a timer that checks/listens to see if a trigger fires in X amount of time. If the trigger does not fire then do something else.

Is this possible?
Australia Forum Administrator #1
  • Clear a variable.
  • Enable the trigger.
  • Have the trigger set a variable if it fires.
  • Start the timer.
  • When the timer expires see if the variable has been set or not.
  • Done.
Canada #2
Thanks!

One other question, I'm trying to get the quotes right for DoAfterSpecial but can't seem to.

local line = string.format("c %s %s", var, var2)
DoAfterSpecial(1, "Execute(line)", 12)

It's telling me

[string "Timer: "]:1: ')' expected near 'spellLine'

How can I fix these quotes? I've tried double, single and a bunch of other combinations.
Australia Forum Administrator #3
Will "line" even exist at that point? Why not send to 'execute' rather than script?

Example:


DoAfterSpecial (2 , "dance" , sendto.execute )


Now instead of "dance" just put the thing you want to do after 2 seconds.
Amended on Sat 25 Oct 2014 06:02 AM by Nick Gammon
Australia Forum Administrator #4
Renny said:

One other question, I'm trying to get the quotes right for DoAfterSpecial but can't seem to.

local line = string.format("c %s %s", var, var2)



Is this inside a trigger or alias ("Send" part)?

If so, the % symbols already have significance, so to use them for Lua purposes you have to double them, eg.


local line = string.format("c %%s %%s", var, var2)


That's because things like %1 mean "the first wildcard".