Multi-line trigger

Posted by Bleys on Sat 05 May 2001 09:50 PM — 2 posts, 12,252 views.

#0
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.
Australia Forum Administrator #1
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).