Conditions

by Soll

Back to Mechanic's Corner.

Soll2005-04-10 22:50:39
I've been trying to get conditions going for ages, but they never work. >_<

What's wrong with


#trigger {strikes deep into your} {#cw 12,12}
#cond {You involuntarily} {#cw 12,12}
#cond {freeing your impaled} {#cw 12,12;#echo SUCCESS;#var active 0}

for:


With a focused look, Tiberius strikes at you with a fullered broadsword of blue
steel. Tiberius strikes deep into your left foot, pinning it down with a
fullered broadsword of blue steel. You involuntarily crumple to a crouch and
can think of nothing but freeing your impaled foot.


Thanks
Vesar2005-04-10 23:02:19
Try putting the parameters in there. Within Lines and 1 for both conditions.
Soll2005-04-10 23:07:36
so... #cond {You involuntarily} {#cw 12,12} {within|param=1} ?
Unknown2005-04-10 23:46:55
Yes, so the trigger resets itself if the conditional's pattern doesn't appear in the next line.
Soll2005-04-11 07:07:09
Ah, excellent. Thanks
Terenas2005-04-11 15:20:22
The only problems I see with making something like that is some weapons have extremely long names. My rapier for example is -an exquistively crafted rapier bearing the images of Serenwilde- that takes up close to a line all to itself when attacking. If the weapon's name is too long it might exceed the 3 lines you have designed to capture the affliction. There are also problems with spacings and line breakings since sometimes the previous and later lines aren't separated by a space at all. It's all really annoying, but good luck. smile.gif
Soll2005-04-11 15:22:35
I know. It's very annoying. >_< Just wanted to see if it was possible to do it that way. I may or may not stick to using conditions
Unknown2005-04-11 18:42:02
I made these triggers work in MUSHclient with some complex regular expressions. In my tests, it works no matter how long or short the name of the weapon is, and I like it. Here's an example:

CODE
 
  afflicted collapsedlungs
 



It'll match on as many as three lines (two carriage returns), but it also works for fewer lines.
Unknown2005-04-11 23:22:25
Can you do something like that in zmud?
Zmud has regular expressions, but I see it's multiline trigger you have, so would it be possible to make it with conditionals? Or maybe it can be made just with one trigger with pattern like that?
*goes to read about regex
Unknown2005-04-12 01:28:31
I honestly don't know, and I'm little afraid to try it. Regular expressions were shoehorned into zMUD when it was already around version 6.x, so it's not like it was designed to handle them. MUSHclient was built with them in mind, so it does a much better job of integrating them.
Unknown2005-04-13 17:20:24
It should work in zmud too. Let's see if I can convert that.
Unknown2005-04-25 10:35:55
Ok... I'm thinking of using #COND now, too, to cut down spam and make combat vs warriors simpler.

What I'd like to do is have a trigger fire on a swing, gag it, then use conditions to match on the next lines to gag them too, and just #SHOW blah slashes your left leg.
I haven't moved on to the warrior wound/afflictions yet, but I intend to.

Basic example, and hardly worth it, but just what I happened to grab at the time:

Swinging an ornate platinum longsword in an underhand arc, Syrienne strikes at
you. The slash to your left leg leaves only a nick on your thigh.

Swinging an ornate platinum longsword in an underhand arc, Syrienne strikes at
you. You are slashed in the chest for a small surface wound.

Now.. I can have:

#TRIGGER {Swinging (*) in an underhand arc, (%w)} {#gag}
#COND {The slash to your (%w) leg leaves only a nick on your thigh.} {#gag;#show %t2 slashes your %1 with %t1.} {within|param=1}

That's the basic part, and it works.
Two questions... One - if I'm fighting in a group battle, will that kind of gagging overload and mess it all up? Or should zMUD be able to keep up?

And two...
Can I make it so that I can add extra conditions, so that the trigger fires on a SLASH, then matches any one of the conditions for? Or would I have to make a trigger to fire on a slash, with a condition each for different body parts? Without thinking, I tried the script above, with this added.

#COND {You are slashed in the chest for a small surface wound.} {#gag;#show %t2 slashes your chest with %t1.}

But that's not really how they work, is it? So it fired on the slash, moved on to check for the next condition - which was the leg #COND - and of course, wouldn't set off the chest #COND.

I hope I explained this half-way coherently. I'm not real good with this stuff biggrin.gif
Drago2005-04-25 11:14:37
That depends on your computer.. a lot of gagging and substitutions in zmud can -really- bog it down though.
Gregori2005-04-25 12:51:03
You can only have one condition, but you can do it this way

#COND {The slash to your (*) leaves only a nick on your thigh.} {#gag;#show %t2 slashes your %1 with %t1.} {within|param=1}
Unknown2005-04-25 13:00:51
blink.gif Isn't that what I'm already doing?
Gregori2005-04-25 13:30:58
this is what you are doing

CODE
#COND {The slash to your (%w) leg leaves only a nick on your thigh.} {#gag;#show %t2 slashes your %1 with %t1.} {within|param=1}


this is what I said to do

CODE
#COND {The slash to your (*) leaves only a nick on your thigh.} {#gag;#show %t2 slashes your %1 with %t1.} {within|param=1}


slight but very important difference in the two.

As a matter of fact your condition would produce the result from this attack:

Attack pre-gag:
1234h, 1234m, 1234e, 10p -abcdfg
Swinging a rusty beercap in a drunken arc, Joebob strikes at
you. The slash to your left leg leaves only a nick on your thigh.
1234h, 1234m, 1234e, 10p -abcdfg

Attact gagged and #show used:
1234h, 1234m, 1234e, 10p -abcdfg
Joebob slashes your left with a rusty beercap.
1234h, 1234m, 1234e, 10p -abcdfg
Unknown2005-04-25 13:58:14
Ah!
Yeah, that was just a typo by me.

I MEANT to have:
#COND {The slash to your (%w) leg leaves only a nick on your thigh.} {#gag;#show %t2 slashes your %1 leg with %t1.} {within|param=1}

which would give the message I wanted.
Unknown2005-04-25 14:05:25
He was referring to the difference between (*) and (%w), JeebusGreen.
Unknown2005-04-25 14:07:45
You can have as many conditions as you want. You're not limited to one condition. You can even have conditions that work almost like if-checks. I've used this method successfully for checking a variety of results from actions.

CODE
#TRIGGER {You apply a salve to yourself.} {}
#COND {The salve has no discernable effect.} {blah blah} {looplines|param=1}
#COND {You are no longer blind.} {blah blah} {reparse}
#COND {You are no longer deaf.} {blah blah} {reparse}
etc...


This is actually faster than having just a bunch of flags, #IF commands, and a trigger for every message. It keeps the number of active triggers down, since only one state is evaluated at a time.
Unknown2005-04-26 05:00:49
Zarquan, that's exactly what I wanted.
Thanks!!!

Tuek, I know the difference tongue.gif
I was just pointing out that I meant to use %w, and I had intended to put 'leg' after it so it did make sense.