Trigger from status line

Posted by Delandes on Sun 09 Jun 2013 07:53 PM — 5 posts, 19,471 views.

#0
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'
Australia Forum Administrator #1
Template:faq=32
Please read the MUSHclient FAQ - point 32.
Australia Forum Administrator #2
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".
#3
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?
Australia Forum Administrator #4

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


Regular expressions FTW!