Elaborate Multi-Line Trigger

Posted by Brendolino on Thu 14 Nov 2013 06:18 PM — 4 posts, 17,984 views.

#0
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.
USA #1
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.
#2
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.
USA #3
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