|
dime Novice
Joined: 15 Dec 2002 Posts: 35
|
Posted: Wed Mar 12, 2003 7:54 pm
#if syntax question |
besides stacking if commands inside another, is there a way to give more than one condition to meet?
for example.. my door string for my map goes like this:
@door is controlled by a toggle button..
#IF (@door>0) {#IF (%2=call) {%2} {open %2 %1}}
i wanna make the 2nd #if command go something like #IF (%2={call|knock %w|say %w}).. trigger style... would that work? or do i have to do this
#IF (@door>0) {
#IF (%2=call) {%2}
#IF (%2=knock*) {%2}
#IF (%2=say*) {%2} {open %2 %1}
}
thanks for the help.. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Mar 12, 2003 8:04 pm |
You can test the contents of a variable agaisnt a pattern expression using the =~ operator. So, your #IF in this case would be:
#IF (@door > 0) {#IF (%2 =~ "{call|knock|say}*") {%2} {open %2 %1}}
Kjata |
|
|
|
dime Novice
Joined: 15 Dec 2002 Posts: 35
|
Posted: Wed Mar 12, 2003 8:17 pm |
could
#IF (%1>7) {#IF (%1<10) {lvl=%eval(100000+(20000*(%1-8)))}}
be rewritten as
#IF (%1>7 and %1<10) {lvl=%eval(100000+(20000*(%1-8)))}
heh.. the help/reference menu could use a few more examples.. ;) |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Wed Mar 12, 2003 8:26 pm |
Yes.
I also find it is always better if you help group things with brackets
#IF ((%1>7) and (%1<10)) {#NOOP stuff here}
Ton Diening |
|
|
|
|
|