[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Multi-line trigger

Multi-line trigger

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


Posted by Bleys   (1 post)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] 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.


8,990 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]