multiline match

Posted by TruckDriver22 on Sun 18 Jan 2009 09:19 PM — 7 posts, 23,371 views.

Denmark #0
bob perfect rested standing N N N Y 0 0
ted perfect rested standing N N N Y 0 0
mark perfect rested standing N N N Y 0 0



this is my trigger below


^\s+(?P<player>Bob|mike|john|ted|reed|ralf|nick|yoshy|nine|ten)\s+(?P<status>dying|bleeding|stunned|awful|(v.bad)|bad|fair|good|(v.good)|perfect)\s+([[:alpha:]]+)\s+([[:alpha:]]+)\s+[[:alpha:]]\s+[[:alpha:]]\s+[[:alpha:]]\s+(?P<here>Y|N)\s+[[:xdigit:]]\s+[[:xdigit:]]$

this works to pick up the line but there are anywhere from 1-10 of these lines and i need the trigger to pick up all of the lines and read them at once!

i want it to reed all as one so my trigger will only do one action not c 'heal' on several people at the same time..
Amended on Sun 18 Jan 2009 09:20 PM by TruckDriver22
Australia Forum Administrator #1
Here's your problem ...

If there can be between 1 and 10 lines, then the trigger must match on one line, right? It doesn't know if more will follow. Therefore it will heal as soon as it gets one.

I think you are better off with single line triggers which merely record each player's status. Then you need to know when the list ends (for example, a prompt line arrives).

Then at this "end of list" marker, you work out which player you want to heal.
Denmark #2
Ok, so basicly i collect all that data like you showed me how to before.. could i do this..

Trigger 1.. collects data..
enable heal
Trigger 2 (heal)
disable heal

that works good!
but I cant get anything to match for the newprompt line..
i figured that ^/s$ WOULD WORk but it didnt...
SOoooo....
I figured out an alternitive way of making it go off..
i set a timer to go off at 0.001 sec after i type group.
And...
Would This erase the table incase someone left the group when they needed to get healed?..so it will stop trying to heal them!

statuses = ("nil")
Amended on Mon 19 Jan 2009 10:32 AM by TruckDriver22
Australia Forum Administrator #3
Quote:

but I cant get anything to match for the newprompt line..


Can you show an example prompt line?

I don't like timers that much, because if they are too quick you don't get all the data, and if they are too slow, it takes too long to heal.

Quote:

Would This erase the table incase someone left the group when they needed to get healed?..so it will stop trying to heal them!

statuses = ("nil")


It would be:


statuses = {}  -- make an empty table


Denmark #4
-----------------------------------------------------------------------------
Mark perfect rested fighting Y N N Y 0 0
Ted perfect rested standing N N N Y 0 0
<-----this is where i want the heal trigger to go off at.
603H 112V 68530X 845C [Me:Perfect] [a kender:good] Exits:NW>

You obliterate a kender with your slash.
You annihilates a kender with your slash.

603H 112V 68530X 845C Exits:NW>


I cant seem to trigger it on a blank line. I think you thought i was talking about my status bar. i just relized that i type prompt in mud to change it. but i wanted to trigger something on a blank space right after all the names in the list.
Thanks alot nick.
Amended on Mon 19 Jan 2009 08:27 PM by TruckDriver22
Australia Forum Administrator #5
Quote:

i figured that ^/s$ WOULD WORk but it didnt...


The code for whitespace is \s not /s. To match an empty line, this should do:


^$


However if it might have spaces, then use:


^\s*$


That allows for zero or more spaces.

Make sure that in File -> Global Preferences -> General that "Regular expressions can match on an empty string" is checked.
Denmark #6
Ok thanks alot.. everything is working just like i want it to now i am really getting hooked on this table stuff i am sure i will have more questions soon. thanks!!