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
tony feneron
Newbie


Joined: 27 Feb 2002
Posts: 8

PostPosted: Wed Feb 27, 2002 1:07 am   

Daisy chain
 
On my keypad 6 i use If statements ie IF (var1=1) {run e} {walk e}. So i have the option of running or walking dependant on var1
Now if i type in a command say, FAST and hit the 6 key instead of receiving either "run e" or "walk e" i receive the whole IF statement- How can I tell zmud to process the IF statement first then send result to command line ?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Feb 27, 2002 1:16 am   
 
Try:

#IF (@var1=1) {run e} {walk e}

That is if you have something like

#ALIAS fast {#VAR var1 1}
#ALIAS slow {#VAR var1 0}

TonDiening
Beta Upgrading to 6.26
Reply with quote
tony feneron
Newbie


Joined: 27 Feb 2002
Posts: 8

PostPosted: Thu Feb 28, 2002 1:16 am   
 
ok here is the keypad commands in full

#IF (@swimcheck = 1) {swim nw} {nw}

Now as soon as i enter water etc then swimcheck goes to 1 via a trigger.

but now if i type "sprint "(while on land!) then hit the keypad hoping for a direction ie "sprint e" but all i get would be sprint #if (@swimcheck=1) - etc
Again can zmud evaluate the if statement first before appending the code to the command line ?
Reply with quote
Stryfe
Wanderer


Joined: 16 Oct 2000
Posts: 50
Location: USA

PostPosted: Thu Feb 28, 2002 9:02 pm   
 
I don't know how to make your example work, but I've implemented a similar system using classes and turning classes on and off from triggers

What I did was:

Have a class called Swimming. Inside this class define movement macros to just send 'swim <direction>', so have 6 be "swim e" and 4 "swim w", etc. Then I have a trigger to see when I enter water, and as soon as I enter water, the class Swimming is turned on, and the classes Keypad and KeypadDiag is turned off, so that the swimming movement macros is on, and the normal movement macros (inside Keypad and KeypadDiag) is off.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Feb 28, 2002 9:22 pm   
 
Try using:
%if(@swimcheck = 1, swim nw, nw)

instead of the command in the macro. The whole function would still be appended to whatever is already in the command line, but when you press enter, the %if is evaluated and the correct string will be put in place of the %if.

Kjata
Reply with quote
tony feneron
Newbie


Joined: 27 Feb 2002
Posts: 8

PostPosted: Mon Mar 04, 2002 8:48 pm   
 
Thanks %IF works fine..
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