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.
 Entire forum ➜ MUSHclient ➜ General ➜ multiline match

multiline match

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


Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Sun 18 Jan 2009 09:19 PM (UTC)

Amended on Sun 18 Jan 2009 09:20 PM (UTC) by TruckDriver22

Message
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..

Click bang... GAME OVER!
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 19 Jan 2009 05:12 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Reply #2 on Mon 19 Jan 2009 08:40 AM (UTC)

Amended on Mon 19 Jan 2009 10:32 AM (UTC) by TruckDriver22

Message
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")

Click bang... GAME OVER!
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 19 Jan 2009 07:38 PM (UTC)
Message
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



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Reply #4 on Mon 19 Jan 2009 08:24 PM (UTC)

Amended on Mon 19 Jan 2009 08:27 PM (UTC) by TruckDriver22

Message
-----------------------------------------------------------------------------
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.

Click bang... GAME OVER!
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 20 Jan 2009 01:06 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Reply #6 on Tue 20 Jan 2009 03:02 AM (UTC)
Message
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!!

Click bang... GAME OVER!
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.


15,967 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.