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 ➜ Multi-line trigger

Multi-line trigger

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


Posted by Bleys   (1 post)  Bio
Date Sat 05 May 2001 09:50 PM (UTC)
Message
Hopefully this is a fairly common situation. I have an Access database for holding mob/area/object information from a mud. My plan is to write triggers off of extended consider, which produces output like the following to populate the mob table.

Str: 31(25) Int: 24(24) Wis: 25(25) Dex: 25(25) Con: 28(25)
Hp: 8598/8598 Mana: 111/111 Level: 91 Align 0
Immune: summon charm magic weapon poison negative holy disease
Resist: light

Note that (25) is on the first line, and "disease" is on the second line in the mud output.

Anyway the triggers would pass the information to a perlscript which will process the info and shove it into Access.

My only problem is getting the data to the perlscript. Is there any way to process more than one line of mud output in a trigger? Or do I have to write several triggers that call the same script (sloppy)?

Thanks for any help.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 06 May 2001 06:07 AM (UTC)
Message
For various rather sound reasons you cannot write a multi-line trigger as such, however your situation can be easily handled with a single trigger and a bit of scripting.

You could use a regular expression to match on something like this:

^(Str:|Hp:|Immune:|Resist:)(.*)$

You can then test wildcard 1 to see which line you got (eg. "Str:" or "Hp:" etc.) and then wildcard 2 will be the rest of the trigger line. Based on the line type you would then extract out the relevant information (and write to the database once the "Resist:" line arrived).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


11,743 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.