|
dazed-n-confused999 Wanderer
Joined: 03 Aug 2004 Posts: 79
|
Posted: Thu Oct 20, 2005 3:53 pm
multi-variable nested #if HELP!!! |
What im looking for here is a script that will take into account more than one variable, and decide what to do based on a priority system. Im trying the nested if statement below but its giving me nothing but grief.
What its suppose to do is check for defences, which happens all at once fyi. then based on if they have def1,def2,def3, or def4, it chooses the proper attack. So if they have def1 it should stop there and issue attack1. if no def1, but def2 then it should stop there and issue attack2, ect.
Im not sure if its because im not using a common variable and zmud is having problems with that, or that i forgot a bracket or something mundane like that. Im using version 7.13. If I could solve the problem above, it would help me on so many levels in my gaming experience, I havent come to you guys after a 30 minuet attempt and giving up. Ive been kicking this around cussing ect. for over a year now. If there is anyway someone help close this problem once and for all. pretty please. with sugar on top.
#IF (@def1 = 1) {attack1}{#if (@def2 = 1) {attack2}{#if (@def3 = 1) {attack3}{#if (@def4 = 1) {attack4}}}}
is this even close to what i need to be doing?!!? |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Thu Oct 20, 2005 5:22 pm |
First thing I would do is upgrade to the lastest verision of zmud. I think there was some issues with nested if's if prior versions of zmud.
|
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Oct 20, 2005 6:53 pm |
The issue your having is with spacing. A quirk of the editor I think.
You have
Code: |
#IF (@def1 = 1) {attack1}{#if (@def2 = 1) {attack2}{#if (@def3 = 1) {attack3}{#if (@def4 = 1) {attack4}}}} |
when you need
Code: |
#IF (@def1 == 1) {attack1} {#if (@def2 == 1) {attack2} {#if (@def3 == 1) {attack3} {#if (@def4 == 1) {attack4}}}} |
for it to work.
If you can map def1-4 to integer numbers then you can use the #CASE command as well.. It may make your code more elegant. |
|
_________________ Asati di tempari! |
|
|
|
dazed-n-confused999 Wanderer
Joined: 03 Aug 2004 Posts: 79
|
Posted: Fri Oct 21, 2005 2:27 am |
OMG, that works like a charm. Guess I never asked the right question. Well thanks a ton man.
|
|
|
|
|
|