Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Zoticus
Beginner


Joined: 16 Jan 2010
Posts: 24

PostPosted: Fri Oct 26, 2012 9:06 pm   

Trigger issue
 
Any idea why this trigger:

Trigger: ^You have recovered (*).$

Value:

#if (%1="balance on your right arm") {#VAR Rab {1};#CW DeepSkyBlue}
#if (%1="balance on your left arm") {#VAR Lab {1};#CW DeepSkyBlue}
#if (%1="equilibrium") {#VAR Eq {1};#CW orange}
#if (%1="balance on all limbs" or "balance on your legs") {#VAR Bal {1};#CW DeepSkyBlue}
#if (@bal=1 AND @rab=1 AND @lab=1 AND @eq=1) {#sub {ALL BALANCE RECOVERED. DO THINGS.}}

Would cause this to happen?

H:5552 M:5145 [db|e- --][14:36:10]
You have recovered balance on your left arm.
ALL BALANCE RECOVERED. DO THINGS.
H:5673 M:5145 [db|e- lr][14:36:13]
ALL BALANCE RECOVERED. DO THINGS.
H:5673 M:5145 [db|eb lr][14:36:13]

The intention obviously being to sub only the final recovery line - not two or even all three.

For reference, my prompt also monitors balance loss, on the right hand side. If a value is not in the prompt (- versus b for example), it's supposed to be 0.

Edit - typos.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Oct 26, 2012 10:18 pm   
 
Quote:

#if (%1="balance on all limbs" or "balance on your legs") {#VAR Bal {1};#CW DeepSkyBlue}


I highlighted the two parts of the OR operator. If you want to test %1 against multiple things, you have to include %1 in each comparison. Alternatively (like in this case), you can stop using OR and use %ismember().

The only other thing I see wrong is a lack of parentheses in the 5th #IF's condition. Nothing at all in this trigger that would cause multiple lines to be printed, and certainly nothing that would get sent to the game.
_________________
EDIT: I didn't like my old signature
Reply with quote
Zoticus
Beginner


Joined: 16 Jan 2010
Posts: 24

PostPosted: Sat Oct 27, 2012 5:36 am   
 
That seems to have worked, in what testing I've done since adding in the other %1.

Though, it sometimes worked at first, it was very quick to break, and it hasn't yet, so I'm thinking we're good to go.

Also, I sort of took both your suggestions to heart, and I'm trying this value now-

#if (%1="balance on your right arm") {Fdel LostBals rab;#CW DeepSkyBlue}
#if (%1="balance on your left arm") {Fdel LostBals lab;#CW DeepSkyBlue}
#if (%1="equilibrium") {Fdel LostBals eq;#CW orange}
#if (%1="balance on all limbs" or %1="balance on your legs") {Fdel LostBals bal;#CW DeepSkyBlue}
#if (!%ismember( bal, @LostBals) and !%ismember( eq, @LostBals) and !%ismember( rab, @LostBals) and !%ismember( lab, @LostBals)) {
#sub {%ansi( 2)ALL BALANCES RECOVERED. DO THINGS.}}

I've consolidated all of my lost balances into a single variable, adding them and removing them with an alias where I used to directly modify each single variable.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net