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 ➜ Trigger from status line

Trigger from status line

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


Posted by Delandes   (2 posts)  Bio
Date Sun 09 Jun 2013 07:53 PM (UTC)
Message
I would like to record my balance/equilibrium from my status line.

Status Line : 4109h, 2388m, 3346e, 10p, 15480en, 10260w ex-

The last line records balance/equilibrium/prone. x is balance, e is equilibrium and p will appear if prone.

<triggers>
<trigger
match="*h, *m, *e, *p, *en, *w *-"
send_to="12"
sequence="100"
>
<send>print "balance/equilbrium was %7"


If %7 == e then
print "I have equilibrium"
else
print "I don't have equilibrium"
end
</send>
</trigger>
</triggers>

Compile error
World: Lusternia
Immediate execution
[string "Trigger: "]:3: '=' expected near 'ex'
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 10 Jun 2013 12:20 AM (UTC)
Message
Template:faq=32 Please read the MUSHclient FAQ - point 32.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Mon 10 Jun 2013 12:21 AM (UTC)
Message
In your case you need to quote two things, eg.


 if "%7" == "e" then


Unquoted things are treated as variables (or numbers if they happen to be numeric).

Also Lua is case-sensitive, so it is "if" not "If".

- Nick Gammon

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

Posted by Delandes   (2 posts)  Bio
Date Reply #3 on Mon 10 Jun 2013 05:48 PM (UTC)
Message
Ah Okay that makes sense! Now the trigger works perfectly and all, but what if I just wanted to recognized if "%7" has the letter "e" in it, and not exactly match it. Most of the time the status line would look like this:

4550h, 2952m, 3600e, 10p, 15396en, 4452w ex-

And if I say "%7" == "e", then it will always tell me that I don't have equilibrium. Is there another operational sign that just means "%7" has "e" in it?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 11 Jun 2013 04:28 AM (UTC)
Message

if string.match ("%7", "e") then
  -- blah blah
end -- if


Regular expressions FTW!

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


18,495 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.