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 ➜ Lua ➜ Adding multiple lines to enable a trigger

Adding multiple lines to enable a trigger

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


Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Fri 12 Jun 2009 03:08 PM (UTC)
Message

Trigger 1
(.+) (damages|hurts|Blasts) John
Dam = (dam or 0) + 1

Trigger 2
^$

I want if Dam = more then 4 to send but can not find the command.

falcon damages john.
falcon damages john.
falcon damages john.

= nothen
but if

falcon damages john.
falcon blasts john hard.
falcon hurts john.
falcon damages john.

= c 'fast healing' john

can someone tell me the catch phrase that works for matching counters?

Click bang... GAME OVER!
Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #1 on Fri 12 Jun 2009 09:47 PM (UTC)
Message
First, make the capitalization the same for variable names.
dam = (dam or 0) + 1

Second, add this line after that one:

if dam == 4 then
  Send ("c 'fast healing' john")
  dam = 0
end
Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #2 on Fri 12 Jun 2009 11:34 PM (UTC)
Message
To explain, to do something based on something else, the statement you want is an if statement. It looks like this:


if [statement] then
  [script]
end


And it will execute [script] if [statement] is true. Every value is true except false and nil.

To test equality, you use two equal signs. If they are the same, it is true. If they are not, it is false.
Top

Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Reply #3 on Sat 13 Jun 2009 06:01 PM (UTC)
Message
Thanks this helps alot!

Click bang... GAME OVER!
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.


14,642 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.