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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
vileplume
Novice


Joined: 26 Dec 2001
Posts: 43
Location: USA

PostPosted: Tue Apr 23, 2002 3:16 am   

Help with #IF in a trigger please?
 
Hello. I've created a trigger that assigns a variable using %pos. It is a trigger off my status prompt. I can define the variable @unbal with the position of letter y, using:

#var unbal %pos ("y", %3)

if y is present, I am off balance. What I would like to do is have another variable that is the opposite of this one to keep track of when I am balanced. I tried adding the following to the same trigger:

#if @unbal {bal=0} {bal=1}

I thought this would assign the value 0 to bal when @unbal had a non-zero result from %pos, but would have a 1 value if the @unbal variable was not found, giving it a value of zero.

So, if @unbal=0 I want @bal=1
and if @unbal=anything other than 0, @bal=0

It doesn't seem to be changing the value of @bal at all using this method. What can I do to fix this?

Thanks!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Apr 23, 2002 3:54 am   
 
I can't see any problem with your reasoning. Best I can recommend is to use the value of %3 instead.

#IF (%pos("y",%3)) {#VAR unbal %pos("y",%3);#VAR bal 0} {#VAR unbal 0;#VAR bal 1}

LightBulb
Vague questions get vague answers
Reply with quote
vileplume
Novice


Joined: 26 Dec 2001
Posts: 43
Location: USA

PostPosted: Tue Apr 23, 2002 4:59 am   
 
In snooping around in the old messages I found one that said you can't use a conditional to define a variable. So I tried something else and it worked perfectly.

NOW my problem is that when I turned the trigger class off using an alias I made like this...

#alias tstatoff {#t- status}

...I can't get it back on with my alias to turn it back on:

#alias tstaton {#t+ status}

As usual, one step forward...two steps back!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Apr 23, 2002 10:24 pm   
 
You probably have your aliases within a class called Status. Since they are within the class when you turn it off, you are not able to turn on the class with tstaton because it's currently disabled. Move this alias outside of the class and it should work.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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