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 ➜ VBscript ➜ Tricky Multi-Line Trigger

Tricky Multi-Line Trigger

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


Posted by Xavious   (41 posts)  Bio
Date Sun 26 Apr 2009 09:20 AM (UTC)

Amended on Sun 26 Apr 2009 09:29 PM (UTC) by Nick Gammon

Message
I'm trying to create a crafty automation that will follow targets who flee. I have one trigger that is activated when the client receives "* flees" It then sends the command scan to the mud, which returns the following examples:


______________________________________
[North]
   Nobody there.
[East]
   Riven (Player)
[South]
   biblioclaster
[West]
   Nobody there.
[Up]
   No exits.
[Down]
   No exits.
___________________________________________
[North]
   No exits.
[East]
   No exits.
[South]
   No exits.
[West]
   No exits.
[Up]
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   SpiderDrider (Player)
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
[Down]
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
   exp robot
________________________________________



I'm having trouble getting this to work even if there aren't multiple mobs in the room with the player, however I am dumbfounded as to how I could possibly pull this off WITH multiple mobs in the room.

I tried a multi-line trigger along the lines of:


"[*]\n\s+* (Player)"


However, it is not firing. Any idea or fingers pointed in the right direction greatly appreciated!
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 26 Apr 2009 09:47 PM (UTC)
Message
Multi-line triggers are really designed for situations where you know the number of lines you expect (eg. a fixed-size status report).

For this sort of situation you probably want the usual 3 triggers approach:


  • One to start matching (eg. on [North] etc.).,

    This turns on the second trigger.

  • One to match each line and considering what to do with it, eg.

    
    exp robot
    SpiderDrider (Player)
    exp robot
    


  • One to match the end of the list (eg. on a prompt). This turns off trigger 2.


So in this case if you were chasing SpiderDrider you use that technique, and when you hit the line "SpiderDrider (Player)" you know he us up from you, because you saved the most recent direction in a variable.

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


10,608 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.