Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Trying to add a cooldown to a trigger.

Trying to add a cooldown to a trigger.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Engvar   (24 posts)  Bio
Date Sun 10 Mar 2019 08:23 PM (UTC)

Amended on Mon 11 Mar 2019 10:15 PM (UTC) by Nick Gammon

Message
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.
Top

Posted by Fiendish   USA  (2,558 posts)  Bio   Global Moderator
Date Reply #1 on Mon 11 Mar 2019 04:08 AM (UTC)
Message
if %1 = ("shields") then

needs to be
if "%1" == "shields" then

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Mon 11 Mar 2019 10:15 PM (UTC)
Message
Template:faq=32 Please read the MUSHclient FAQ - point 32.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Engvar   (24 posts)  Bio
Date Reply #3 on Tue 12 Mar 2019 01:01 AM (UTC)
Message
Thank you Fiendish, the missing "=" solved it. I completely glossed over that I'd missed it.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,958 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.