|
Eyeless Wanderer
Joined: 02 Dec 2001 Posts: 80 Location: Canada
|
Posted: Sat Aug 25, 2007 4:48 am
Dragonrealms/#COND help zmud 7.21 |
I'm trying to figure out a way to capture text to a variable from multiple lines. I'm guessing this is done with conditions and multistates but I am not quite sure how to go about this when certain conditions are NOT me is what really gives me trouble.
Here is what mud sends:
Wounds to the RIGHT ARM:
Scars External: minor scarring along the right arm -- minor
Scars Internal: an occasional twitching in the right arm -- more than minor
Wounds to the LEFT ARM:
Fresh External: cuts and bruises about the left arm -- more than minor
Fresh Internal: minor swelling and bruising around the left arm -- more than minor
Scars Internal: an occasional twitching in the left arm -- minor
I'd like my variable to be something like:
rightarmexternalscar = minor
rightarminternalscar = more than minor
leftarmexternal = more than minor
leftarminternal = more than minor
leftarminternalscar = minor
I've tried a few different ways, what I need to know is, is there a way to reset a state to 0 even if a condition is not met. e.g. in the example above maybe there were no external scars.
My limited understanding of multistates/conditions is that they have to be sequential and one fires after the next.. i.e state 0 fires, moves to 1. 1 must fire before 2 will ever fire and so on until the last state fires and resets to 0. Any pointers would be much appreciated |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Aug 25, 2007 4:55 am |
Multistate triggers aren't really ideal for this sort of problem - they rely on the same or similar text being sent in the same sequence. Since some lines in this are optional, it's not really going to work.
What I'd recommend instead is having a class filled with triggers that fire on those lines; #trig {^Scars Internal: * -- (*)} {#var InternalScar %1}. Have the class disabled and disable-on-startup, and have an alias that looks like this:
#alias wounds {~wounds;#t+ woundtriggerclass;#alarm +1 {#t- woundtriggerclass}}
where wounds is the command that displays that info, and woundtriggerclass is the name of the class you put all those triggers in. This'll only enable the triggers when you know a response is coming, and then automatically disable them afterwards.
The interesting part of this script comes because it'll need to keep track of which limb is current:
#trig {Wounds to the RIGHT ARM:} {#var CurrentLimb RightArm}
and then you can reference this variable when your other triggers set the wounds:
#trig {Scars Internal: * -- (*)} {#var %concat(@CurrentLimb,"ScarsInternal") %1} |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|