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 ➜ General ➜ Elaborate Multi-Line Trigger

Elaborate Multi-Line Trigger

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


Posted by Brendolino   (19 posts)  Bio
Date Thu 14 Nov 2013 06:18 PM (UTC)
Message
A certain spell in the game outputs the following for whatever character it is cast on. Each of the field names are ALWAYS the same, and ALWAYS on the same line, with each of the values being potentially different per character. It is relatively consistent until the "Affected by:" field, which can be between 1 full linebreak'd line, or 4 full linebreak'd lines.

Here is an example.

Name: Joshua  Race: mammoth  Sex: male  Level: 91  Clan: Algolians
Str: 25  Int: 23  Wis: 21  Dex: 25  Con: 26  Cha: 22
HP: 100  Mana: 76  Tired: 95%
Willpower: 100%  Morale: 100%
Saves: 223  Savemod: 38
AC: 79
Affected by: breathe water dark vision detect evil detect good detect hidden detect illusion detect invis detect magic faerie fire flying haste infrared pass door regeneration
aura mask blink disguised displaced scry shield Shapechanged Speed
cloak of cover cloak of fear detect neutral fire fists Heroism
mind over body Spatial Awareness Blur Guiding Focus Precognition
Immune to: none
Resistant to: blunt piercing slashing cold lightning negative holy mental
Vulnerable to: none
Alignment: diabolic
Deity: Arawn.
Location: The Heart of New Lensmoor (New Lensmoor)
No Summon
No Gate


And another with less information in the Affected by:


Name: Phurey  Race: demon  Sex: male  Level: 7  Clan: Algolians
Str: 24  Int: 21  Wis: 20  Dex: 19  Con: 26  Cha: 13
HP: 100  Mana: 100  Tired: 46%
Willpower: 100%  Morale: 100%
Saves: 78  Savemod: 0
AC: 14
Affected by: berserk detect evil flying haste infrared prot good
scry shield Speed
fire fists Heroism
none
Immune to: none
Resistant to: fire disease
Vulnerable to: cold
Alignment: diabolic
Child of Nerisha and Cynosure.
Deity: Arawn.
Location: No Man's Land (Grey Plains)
No Summon


The problem is that the "linebreak'd lines" can be up to 3-4 lines each, I'm assuming a specific max character per line restriction causes this, but I'm not entirely sure.

What I've done, is highlight the whole text (the top example) and select multi-line trigger, then replace each field value with a wildcard. My trigger grabs each wildcard to SetVariable.


  <trigger
   enabled="y"
   group="Multi Line"
   lines_to_match="17"
   keep_evaluating="y"
   match="Name\: *  Race\: *  Sex\: *  Level\: *  Clan\: *\nStr\: *  Int\: *  Wis\: *  Dex\: *  Con\: *  Cha\: *\nHP\: *  Mana\: *  Tired\: *\%\nWillpower\: *\%  Morale\: *\%\nSaves\: *  Savemod\: *\nAC\: *\nAffected by\: *\n*\n*\nImmune to\: *\nResistant to\: *\nVulnerable to\: *\nAlignment\: *\nDeity\: *\.\nLocation\: *\n*\n*\Z"
   multi_line="y"
   name="NEW"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("vName", "%1")
SetVariable("vRace", "%2")
SetVariable("vClan", "%5")
SetVariable("vStr", "%6")
SetVariable("vInt", "%7")
SetVariable("vWis", "%8")
SetVariable("vDex", "%9")
SetVariable("vCon", "%10")
SetVariable("vCha", "%11")
SetVariable("vHP", "%12"
SetVariable("vMana", "%13")
SetVariable("vVit", "%14")
SetVariable("vWill", "%15")
SetVariable("vSaves", "%17")
SetVariable("vSavemod", "%18")
SetVariable("vAC", "%19")
SetVariable("vAff1", "%20")
SetVariable("vAff2", "%21")
SetVariable("vAff3", "%22")
SetVariable("vImmune", "%23")
SetVariable("vResist", "%24")
SetVariable("vVuln", "%25")
SetVariable("vAlign", "%26")
SetVariable("vDeity", "%27")
SetVariable("vLocation", "%28)</send>
  </trigger>


The basic problem is that no matter how I try, I can't get a single variable to save. My trigger just doesn't seem to be firing. I'm thinking lines_to_match: 17 may be the problem, but I'm just not sure how to change it, or if this is even possible.
Top

Posted by Chyort   USA  (58 posts)  Bio
Date Reply #1 on Thu 14 Nov 2013 07:15 PM (UTC)
Message
I guess my first question is, why do you need to grab All these variables with one trigger? why cant you grab it with 4-5 much simpler triggers. Far easier to debug, and maintain if something changes slightly down the road.

Second, Multi-line match needs to know exactly how many lines you are after, so you cant do 3-4 lines in a single trigger. With regular expressions and whatnot i suspect you could make multiple triggers to accomplish the same thing(one trigger matches to 3 lines, another to 4, and so on) but that starts getting messy.

A better way would be to grab everything in between A to B using a script (from 'affected by:' to 'Immune to:' it looks like)

As far as a script to grab it goes... Sorry :P i know what to do, but not how to do it. There should be a bunch of posts on it here though. Fairly common request i seem to recall. Or you can wait for Nick or someone else familiar with scripting to show up and help.
Top

Posted by Brendolino   (19 posts)  Bio
Date Reply #2 on Thu 14 Nov 2013 07:52 PM (UTC)
Message
Chyort said:

I guess my first question is, why do you need to grab All these variables with one trigger? why cant you grab it with 4-5 much simpler triggers. Far easier to debug, and maintain if something changes slightly down the road.

Second, Multi-line match needs to know exactly how many lines you are after, so you cant do 3-4 lines in a single trigger. With regular expressions and whatnot i suspect you could make multiple triggers to accomplish the same thing(one trigger matches to 3 lines, another to 4, and so on) but that starts getting messy.

A better way would be to grab everything in between A to B using a script (from 'affected by:' to 'Immune to:' it looks like)

As far as a script to grab it goes... Sorry :P i know what to do, but not how to do it. There should be a bunch of posts on it here though. Fairly common request i seem to recall. Or you can wait for Nick or someone else familiar with scripting to show up and help.


I accomplished this previously with a 20+ trigger/alias system, which is probably easier to go back to. I recently began using the Multi-line trigger system, but this is the first one with so much involved. I'll just simplify things, I think, and avoid having to deal with this. UNless, of course, someone has a lightbulb suggestion that could make it click.
Top

Posted by Chyort   USA  (58 posts)  Bio
Date Reply #3 on Thu 14 Nov 2013 11:01 PM (UTC)
Message
Hmm, sounds like you were doing a trigger for every variable. Even when you had multiple variables on the same line. Eww :P

Sounds almost like something i would do, heh.

Yeah looking at your samples though... I would have a fairly simple trigger, for each of the single lines, and then try something a little more complicated for the multi-line "Affected by:" portion
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.


13,854 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.