Trying to add a cooldown to a trigger.

Posted by Engvar on Sun 10 Mar 2019 08:23 PM — 4 posts, 16,850 views.

#0
I have an trigger that fires off when a prompt lets me know that my shields are down. I also have an alias that will put all of my shields back up with one command. The problem is that I have to wait 30 seconds to enter the shield up commands due to their cooldown, but sometimes they are knocked down immediately.

I'm trying to build that cooldown into the trigger so that it checks to see if it fired within the last 30 seconds, and doesn't fire if it has. Here's what I've got.


<triggers>
  <trigger
   enabled="y"
   match="Your * have been disabled."
   send_to="12"
   sequence="100"
  >
  <send>
if %1 = ("shields") then

  if lastTriggerTime == nil or os.time () - lastTriggerTime &gt;= 30 then
    Send ("shieldbuff")
    lastTriggerTime = os.time ()
  end -- if 30 seconds are up
end --- if

</send>
  </trigger>
</triggers>


I'm getting this whenever it should trigger though.


Compile error
World: Name of Game
Immediate execution
[string "Trigger: "]:2: 'then' expected near '='


I definitely have a 'then' statement in there on line 2 though, so I'm not sure what the problem is.
Amended on Mon 11 Mar 2019 10:15 PM by Nick Gammon
USA Global Moderator #1
if %1 = ("shields") then

needs to be
if "%1" == "shields" then
Australia Forum Administrator #2
Template:faq=32
Please read the MUSHclient FAQ - point 32.
#3
Thank you Fiendish, the missing "=" solved it. I completely glossed over that I'd missed it.