Need Help with trigger

Posted by Thorvin on Sun 30 May 2010 01:14 PM — 4 posts, 15,889 views.

#0
Hi everybody...

I´m new to MUSHClient and I have a problem with a trigger I want to implement...

here is the output of the mud


Gesundheit ....... 120 (210)          Gift ............. gesund


It is on one line... I want to extract to a variable the 120 in this case... (health points)

I´m playing on the morgengrauen mud (mg.mud.de) it is an LDmud. I already made a trigger to change the colour... but I´m not able to extract the points from the line

How can I do it.... ?

Thanks for the help.

greetings
Thorvin
#1
Enable regex in your trigger first. This regex *should* match 3 words in a row, and store the last one.

Trigger: ^\w+ \w+ (\w+) .*$
Send: say health is %1

The more specific your regex the better though, otherwise it will start matching lines you dont want it to. Hopefully you could change it to something like this.

Trigger: ^Gesundheit ....... (\w+) .*$
Send: say health is %1

and you might not need the .* at the end not sure, this might work.

Trigger: ^Gesundheit ....... (\w+)
Send: say health is %1

btw \w matches [a-zA-Z0-9_], and + means 1 or more times, assuming this regex has the same behaviour as python's

Amended on Sun 30 May 2010 06:25 PM by Shwick
#2
Thanks for the help...

It works now, the problem was the () around \w+
I did it with a (\d+) because there are only digits...

greetings
Thorvin
#3
ah yes very good