 |
Virus Wanderer
Joined: 29 Jun 2002 Posts: 69 Location: USA
|
Posted: 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 |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: 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)} |
|
|
 |
Virus Wanderer
Joined: 29 Jun 2002 Posts: 69 Location: USA
|
Posted: 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 |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Jul 28, 2002 9:01 am |
In that case use 2 lists.
%item(@outputs,%ismember("%1",@inputs)) |
|
|
 |
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: 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  |
|
|
 |
|
|