|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: 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 |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: 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 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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 |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: 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 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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 |
|
|
|
|
|