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
Virus
Wanderer


Joined: 29 Jun 2002
Posts: 69
Location: USA

PostPosted: Sun Jul 28, 2002 1:59 am   

Switching?
 
Im trying to figure out if there is a function or a way to do switching. Heres and example.... switch(%1,h,Hover,b,Biped,T,Tracked)

If %1 = T then I get Tracked, if it = b I get Biped, so on and so forth.

Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Jul 28, 2002 3:53 am   
 
Try a %case %ismember combo. For your example...

#VAR Stuff {h|b|T}
#FU switch {%case(%eval(%ismember("%1",@Stuff)+1),default,Hover,Biped,Tracked)}
Reply with quote
Virus
Wanderer


Joined: 29 Jun 2002
Posts: 69
Location: USA

PostPosted: Sun Jul 28, 2002 5:42 am   
 
I tried that, but case only takes like 7 args, I have to put about 20 through it. I guess I can do embedded statements. Thanks for the tip...Ill try and figure it out.


Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Jul 28, 2002 9:01 am   
 
In that case use 2 lists.

%item(@outputs,%ismember("%1",@inputs))
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sun Jul 28, 2002 4:05 pm   
 
Make a record variable with all of your pairs:
#ADDKEY symbols {h=Hover|b=Biped|T=Tracked|e=Etcetera}

Then use the %db function to perform your switch: %db(@symbols,%1)

Troubadour
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