Mushclient v 4.96 win7 Lua Scripting
So I have been hacking away at this in a rather primitive manner when it occurred to me I may be creating a bit of an xy problem. Hopefully someone can help me out.
On the mud I play (Discworld) I have a spell that when cast on an item takes you to a location "remembered" by that item. Currently I have 3 aliases for this as I have three different groups of items that need to be manipulated in different ways before the spell is cast (removed from containers etc).
What I want to do is have one master alias that depending on what the matched pattern is behaves in three different ways. I have three group of items. One is nicknamed internally within the mud as three letter codes (eg "rts" or "stl"), the second set is likewise nicknamed but with 3 digit numbers (eg "234" "456" "098"), and the third are just items that I type the full name of (eg "dagger scabbard" "hauberk" "cane").
Each set needs a different set of actions so I tried the following test alias.
'test abc' should print "paper"
'test 123' should print "rock"
'test anything else' should print "scissors"
I have tried changing my regex patterns, I have tried multiple brackets and quote locations still can't seem to get it to work. Ive only been trying out this more advanced stuff for a couple of days but I still am a bit down on myself for not being able to nut this out. Can someone put me out of my misery.
So I have been hacking away at this in a rather primitive manner when it occurred to me I may be creating a bit of an xy problem. Hopefully someone can help me out.
On the mud I play (Discworld) I have a spell that when cast on an item takes you to a location "remembered" by that item. Currently I have 3 aliases for this as I have three different groups of items that need to be manipulated in different ways before the spell is cast (removed from containers etc).
What I want to do is have one master alias that depending on what the matched pattern is behaves in three different ways. I have three group of items. One is nicknamed internally within the mud as three letter codes (eg "rts" or "stl"), the second set is likewise nicknamed but with 3 digit numbers (eg "234" "456" "098"), and the third are just items that I type the full name of (eg "dagger scabbard" "hauberk" "cane").
Each set needs a different set of actions so I tried the following test alias.
<aliases>
<alias
name="TestPort"
match="^test (.*)$"
enabled="y"
expand_variables="y"
group="Testing"
regexp="y"
send_to="12"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>if "%1" == "(^[a-z]{3}$)" then
print ("paper")
elseif "%1" == "(^[0-9]{3}$)"
print ("rock")
else
print ("scissors")
end -- if
-- test multi function alias</send>
</alias>
</aliases>
'test abc' should print "paper"
'test 123' should print "rock"
'test anything else' should print "scissors"
I have tried changing my regex patterns, I have tried multiple brackets and quote locations still can't seem to get it to work. Ive only been trying out this more advanced stuff for a couple of days but I still am a bit down on myself for not being able to nut this out. Can someone put me out of my misery.