Quote:
1) When you have a trigger like this:
^(Hi how are you|hello how are you|yo whats up)\.$
Does Mushclient basically do 3 seperate evaluations for this? So would it be faster to do like.. ^(\w+ how are you)\.$ and then a second trigger or is the above the fastest option?
It passes the trigger to the PCRE regexp engine. It does that once. I think it would be faster to leave that as it is, as that is one regexp call rather than three.
Quote:
2) Similar to one when a trigger uses options like (him|her) for instance...
Happily, (he|she) gives you a warm smile.
Is it faster to use that or \w+ instead?
I would leave that alone (subject to testing), but you really need to think about how quickly the regexp can *fail* rather than how quickly it passes. For example, a line that doesn't start with "Ha" will fail immediately, so the test for he/she doesn't need to be done. If you make that two triggers it has to test that twice.
Quote:
3) If a trigger looks something like this.....
^You try to cleanse your aura (.*)\.$
Does that only evaluate once?
Yes, of course. All triggers are evaluated once. For something like 1000 auras it is probably best to use what you had there and then do a Lua table look-up of the exact aura (table lookups are fast).
Quote:
In an effort to get rid of comparisons (in some instances there can be 4 or more if's involved) would it be more efficient to change it to something like...
Execute(GetVariable("healer"))
What would be more efficient is to get that MUSHclient variable into a Lua variable. eg.
healer = GetVariable "healer"
if healer == "y" then
Send("cast healing")
else
Send("sip healing")
end
But of course this is only efficient if you need to do the test more than once. In fact if you need to know true/false "is he a healer?" then you might do:
ishealer = GetVariable "healer" == "y" -- make a boolean
if ishealer then
Send("cast healing")
else
Send("sip healing")
end
|