mudlet string.match question

by Simimi

Back to Mechanic's Corner.

Simimi2010-03-01 18:24:22
Pretty basic question here... I have an alias that matches ^ and the idea is that if h it will sip health, if m it will sip mana, and if b it will sip bromide. In Mush I would just use a string match but that isn't working in this case. Any ideas?

Unknown2010-03-01 18:29:13
Make it a string capture ^()$ and check for which letter was captured.
Simimi2010-03-01 18:40:58
Makes much more sense! Thanks! Any reason it would be double sending aliases? Like...

pattern: ^dothis$
script: send("do " .. this)

it will send it twice?
Unknown2010-03-01 18:53:00
I'm assuming Mudlet has some sort of passthrough or 'keep evaluating' flag on an alias. Check for that.
Unknown2010-03-01 19:07:50
QUOTE (Simimi @ Mar 1 2010, 01:40 PM) <{POST_SNAPBACK}>
Makes much more sense! Thanks! Any reason it would be double sending aliases? Like...

pattern: ^dothis$
script: send("do " .. this)

it will send it twice?



If the alias appears twice in the list, it'll match both of them I believe. so make sure you don't have it double-entered.

Vadi2010-03-01 23:33:05
If you don't want your send command to appear on the screen, you can do:

send("do " .. this, false)