im trying to do this trigger to match 2 lines but im not being able to :(
ive tried \n and \r to match the new line but didnt work
tried with and without $ before and ^after the \n and \r but didnt work either way
i start wonder if thats possible.
can someone help me with that?
thx.
Mushclient triggers don't match multilines. The only way to really do it is if the second line is indented or you can be sure that the last line will be followed by something unique, then you can use a 'capture' trigger and script to handle it.
In either case you set up a trigger that is 'trigger: *, sequence: 1, keep evaluating' and enable it when you get the first line, then disable it as soon as the wildcard return the unique line you are looking for, or is no longer indented. I had to do this for coloring channel traffic, where I wanted the result to be different than the standard ansi.
ok thx for the sugestion...
i didnt know i couldnt match a multiline...
what i wanted to do is this:
'you eat a piece of meat.' --> eat again
'you eat a piece of meat.
you are full.' --> stop eat
what ive been doing is:
'you eat a piece of meat.' -> set var 'eat' 'yes'
'you are full.' -> set var 'eat' 'no'
'< *Hp *Mn *Mv>' -> if 'eat' = 'yes' eat again
this might be a twisted way of doing it :/ ill try your way.
Actually for that situation your method is what I would have done anyway. I use the multiline work around only in cases like reading all the herbs out of my inventory to use in my potion plugin, coloring channel traffic (which my mud insists on auto-wrapping and can be 3+ lines long) or other similar situations. In your case you have 3 unique instances and thus you can trap them individually without a problem. Multiline and the work around for not having it is only realy useful when you "don't" know what text is actually being captured, except for the line/command that starts it and some line that you know will end it.
I'm having difficulty writing a script to handle triggering on multple lines, that I need is a script to capture one string then insert it when called by another trigger, I've had one before that was written for me but I lost it when I had to format after a serious crash, here is an example of what I want.
Triggered on :
A kobold is dead.
You recieve 200 experience points.
Ok I know how to make the trigger to report the experience gained. What I would like to know since I don't know the scripting language is how to make the output of the trigger on multiple lines read:
I gained 200 experience from the death of a Kobold.
to be completely honest I have no clue on how to write the script and any help would be appreciated.
hmm.. you could have one line to set a variable so that the message of
"A kobold is dead."
would match on a trigger of
"A * is dead."
and that trigger would then call a subroutine (called 'dead' for example) which would set the variable..
sub dead (thename, theoutput, thewildcards)
World.SetVariable "dead", thewildcards (1)
end sub
the next message of
"You recieve 200 experience points."
would match a trigger of
"You receive * experience points."
which could send, for example
grouptell I gained %1 experience from the death of a @dead.
or if you wanted it as a note for yourself only, this second trigger could call another subroutine (called 'report' for example) to world.note it..
sub report (thename, theoutput, thewildcards)
dim mob
dim exp
mob = World.GetVariable("dead")
exp = thewildcards (1)
World.Note "I gained "& exp &" experience from the death of a "& mob &"."
end sub
does that help?
Actually after looking around for a while and looking at my bio my original request was there. with the solution and I have it working perfectly once again. Here is the string:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=73
heh kewl :) looks like I suggested the same thing as Nick did, with the addition of the world.note script.. I can stop holding my breath now.
Actually, you can do it without scripting. One trigger sends the monster name to a variable, the other one uses that variable. Like this:
<triggers>
<trigger
enabled="y"
match="A * is dead."
name="monster"
send_to="9"
sequence="100"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
expand_variables="y"
match="You recieve * experience points."
send_to="2"
sequence="100"
>
<send>I gained %1 experience from the death of a @monster.
</send>
</trigger>
</triggers>
hah! sweeeeet. I've been using scripts for setting all my variables, which are many. you've just saved me a lot of unneccessary work. :) thanks Nick
hmm.. any chance you can add the ability to do this with aliases as well? (set variables with an alias without having to call a script do it)