|
myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Tue Feb 23, 2010 9:06 pm
matching/triggering over unknown number of lines problem. |
Here we go again :)
OK the sample output
Code: |
In the forest they noticed:
Mung the Orc
Selas the Drow
In the tree they noticed:
A bad smell!
In the buffer zone they noticed:
Nobody! |
After each "In the buffer/forest/tree" line is an unknown number of raiders and I want to echo each them on my race channel until I get to a blank line. Preferably though I would like to put each of the names in to a variable and echo them all at once. Getting some thing on to race channel uses "race {what ever you want to say}".
That "bad smell" is what is shown when someone is invisible as strange as it sounds.
My end result would be something like.
Code: |
[ELF] Forest: Mung, Selas
[ELF] Tree: Invis
[ELF] Buffer: Nobody |
Hope you can suggest some ideas! |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Feb 24, 2010 2:21 am |
Code: |
#trigger "tTheyNoticed" {^In the (*) they noticed:} {#var %word(%1,1) ""}
#condition {(*)} {
#if ("%1" = "") {
#state tTheyNoticed 0
race %concat("[ELF] ",%word(%t1,1),": ",%expandlist(%word(%t1,1),", "))
} {
#if ("%1" = "Nobody!") {
#additem %word(%t1,1) "Nobody"
} {
#if ("%1" = "A bad smell!") {
#additem %word(%t1,1) "Invis"
} {
}
}
}
} {manual}
|
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Fri Feb 26, 2010 9:00 am |
Hi Matt,
Thanks for that. I think I understand what it's supposed to be doing, but I think I must be missing something.
I gave it a test last night and it constantly failed to trigger on the middle section (the Tree zone) shown in my sample. It's as if it wasn't reseting quickly enough on the #state tTheyNoticed 0.
I'm going to have to get some outputs with the triggers showing and try and work out what's going on.
Or work out another method by having 3 unique triggers for each set. |
|
|
|
myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Mon Mar 01, 2010 12:13 pm |
Sorted.
Instead of using the #IF statement to test for a blank line I've used a #Temp {^$} to reset the state. Apart from that and few minor tweeks and it all works nice like :) |
|
|
|
Color Newbie
Joined: 05 Feb 2010 Posts: 5
|
Posted: Tue Mar 16, 2010 6:28 pm |
I'm having a problem trying to do something very similar to this. I'm trying to capture who is online (to eventually be displayed in a separate window).
Here is my current trigger:
Code: |
#TRIGGER WhoTrig {--- Players of EverWar ---$} {#VAR WhoList "";#TEMP {^$} {#STATE WhoTrig 0}}
#COND {} {#ADDITEM WhoList %line} {LoopLines|Param=99} |
Here is a sample wholist:
Quote: |
--- Players of EverWar ---
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[+]
[ 1-56-4 THI][HLF] Novocane
[ 2-80-4 WAR][GNT] Mochi AIM MochiKunn if you want me for PK
[ 3-80-3 SOR][DRY] Eritai
[ 1-28-4 SOR][MOO] <AFK> Cebheoin i ch3w thr3w engein Bl0CKZ wiTH MAH Gn0M3 T33TH
[ 1-37-1 WLK][WLD] Silk asdf
[ 1-21-1 TEM][CEN] Denigsto spying is just a hobby
[ 1-79-3 ASN][HLF] Phade BURN DOWN NAZGOTH
[ 1-51-5 WAR][ENT] Rodamala Gay Bee
[ 1-45-5 MON][ENT] Tulkas - Teach me useful loads to check!
[ 1-47-3 WAR][ENT] Chronostar tiberian is a ritard.
F [ 1-53-5 TEM][SOL] Licyeus .
F [ 1-45-6 SWA][ENT] Sintor is scripting word for the next 8 hours
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[+]
There are 12 soldiers visible to you at the moment.
|
However, the trigger keeps adding stuff to WhoList even after receiving a blank line, and I can't figure out why. |
|
|
|
myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Wed Mar 17, 2010 12:39 pm |
<Edited a bit>
I think I ran in to a similar problem so I stopped using the loopline parameter and only triggers of lines that contained something.
You could try to amend your pattern in the Cond to only parse lines when there are actually characters there so, #cond {([A-Za-z~[~]-])} or something to that effect?
I can't remember exactly what I did and I'm at work so I'll look later. |
|
|
|
Color Newbie
Joined: 05 Feb 2010 Posts: 5
|
Posted: Thu Mar 18, 2010 4:43 am |
I actually had tried that as well. I put the condition to trigger on the "There are X soldiers visible to you at the moment." line, but had the same results.
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Mar 19, 2010 11:25 am |
Try creating a permanent trigger using "There are X soldiers visible to you at the moment." rather than a temp and see if that helps.
|
|
_________________ Taz :) |
|
|
|
Color Newbie
Joined: 05 Feb 2010 Posts: 5
|
Posted: Sat Mar 20, 2010 8:31 am |
Using a permanent trigger worked, but for some reason didn't put the second -=-=-= line into the variable. Anyway while reading help files about how to put the variable into a window, I found a much easier way to do what I'm wanting, and am now using these two triggers, which seem to be working:
Code: |
#TRIGGER {--- Players of EverWar ---$} {#CLR "Who List";#C+ "Who List"}
#TRIGGER {^There are %d soldiers visible to you at the moment.$} {#C-} |
|
|
|
|
|
|