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
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Aug 14, 2002 4:18 pm   

#CASE
 
Ok.. I have been away for awhile but I don't quite understand the #CASE statement.
I am trying to make a trigger that plays a different sound depending on the value I get from %1.
Example:
TRIGGER: ^You pull a (*) from the ground!$
VALUE:
#CASE ("rock" "flint stone") {
#PLAY Sounds/rock.wav
} {
#PLAY Sounds/flint.wav
}

Is this the correct way to use the #CASE statement?

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Aug 14, 2002 6:08 pm   
 
How about something like

#CASE %ismember("%1","rock|flint stone") {#PLAY Sounds/rock.wav} {#PLAY Sounds/flint.wav}

Untested

Ton Diening
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Aug 14, 2002 6:15 pm   
 
No.
It's clear from the examples given in the helpfile that the first item after #CASE should be a number.
#VAR soundlist {rock|flint stone}
#TR {^You pull a (*) from the ground!$} {#IF (%ismember({%1},@soundlist) {#CASE %ismember((%1},@soundlist} {#PLAY Sounds/rock.wav} {#PLAY Sounds/flint.wav}}}

LightBulb
Senior Member
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Aug 14, 2002 8:00 pm   
 
Well then, that doesn't make a very good case statement. I will use your example lightbuld.
Thanks

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Aug 15, 2002 12:55 am   
 
I wrote my answer at the same time TonDiening was writing his. There are only two differences between them:

1. I used a variable for the stringlist in %ismember, Ton used the stringlist directly.
2. I used #IF to make sure whatever got pulled from the ground was in the list.

In use, the only difference between them would be if something not on the list got pulled from the ground--my script would play nothing, Ton's would play flint.wav. Some people may prefer it that way, so it gets their attention.

LightBulb
Senior Member
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