Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Need Help with trigger

Need Help with trigger

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Thorvin   (2 posts)  Bio
Date Sun 30 May 2010 01:14 PM (UTC)
Message
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
Top

Posted by Shwick   (21 posts)  Bio
Date Reply #1 on Sun 30 May 2010 06:21 PM (UTC)

Amended on Sun 30 May 2010 06:25 PM (UTC) by Shwick

Message
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

Top

Posted by Thorvin   (2 posts)  Bio
Date Reply #2 on Sun 30 May 2010 07:10 PM (UTC)
Message
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
Top

Posted by Shwick   (21 posts)  Bio
Date Reply #3 on Sun 30 May 2010 08:36 PM (UTC)
Message
ah yes very good
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,105 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.