PDA

View Full Version : if then else



beyond-tec
11-12-2007, 03:49 AM
Hi :)

still wondering how the if-clause in the macros work.
Anyone ever tested this out or got an example?

I'd like to use a follow and an assist macro which checks
if the char is alive and exists before following him.

like:

if(charA exists, nodead) { /assist charA }
elseif(charB exists, nodead) { /assist charB }
elseif(charC exists, nodead) { /assist charC }
elseif(charD exists, nodead) { /assist charD }
elseif(charE exists, nodead) { /assist charE }
else { }

Gallo
11-12-2007, 05:32 AM
conditional macros got the boot in 2.0.

blurred
11-12-2007, 10:59 AM
you can do something like this:

/assist [target=charA, exists, nodead] charA
/stopmacro [target=charA, exists, nodead]
/assist [target=charB, exists, nodead] charB
/stopmacro [target=charB, exists, nodead]
...

Djarid
11-12-2007, 11:39 AM
or just write a simple addon to process the conditions for you

blurred
11-12-2007, 07:34 PM
or just write a simple addon to process the conditions for you

Yea you could, but conditional statements IIRC are disabled in combat

Djarid
11-13-2007, 08:11 AM
ouch hadn't realised that

beyond-tec
11-27-2007, 11:22 AM
thanks for your help.

but the problems seems to be that you can't use this:

/assist [target=charA, exists, nodead] charA
/stopmacro [target=charA, exists, nodead]

on a follow command instead of the assist because he doesn't check the target (exists, nodead).

so

/follow [target=charA, exists, nodead] charA
/stopmacro [target=charA, exists, nodead]

won't work because of the unknown Unit error.

so you need to target the char first

/target [target=charA, exists, nodead] charA
/follow
/stopmacro [target=charA, exists, nodead]
/target [target=charB, exists, nodead] charB
/follow
/stopmacro [target=charB, exists, nodead]

problem: he doesn't target charA if he's dead but in the next line the follow command generates an error because of the missing target.


I'd like to generate a macro which doesn't use the follow command unless the target is alive and exists. that's why I asked for the if-clause.

if((CharA exists) AND (CharA nodead)) { /follow CharA }
elseif((CharB exists) AND (CharB nodead)) { /follow CharB }
elseif((CharC exists) AND (CharC nodead)) { /follow CharC }
elseif((CharD exists) AND (CharD nodead)) { /follow CharD }
elseif((CharE exists) AND (CharE nodead)) { /follow CharE }
end;

that's how it should look like.

I usually do such things with the focus, just assist and follow the focus but I need the focus for polymorph and re-polymorph the focus-target without switching the target.

Zaelar
11-28-2007, 08:09 AM
Would /follow [target=exists] work? Or something like that.

hxc
11-28-2007, 02:02 PM
I use something like the following, i 3-box so i don't have as many lines in each macro, but is it something along the lines of what you're looking for? :

5th characters macro:
[code:1]
/target [target=fourthChar,nodead]
/target [target=thirdChar,nodead]
/target [target=secondChar,nodead]
/target [target=mainChar,nodead]
/follow target[/code:1]

4th characters macro:
[code:1]/target [target=thirdChar,nodead]
/target [target=secondChar,nodead]
/target [target=mainChar,nodead]
/follow target[/code:1]

and so on, removing the /target lines leading up to and including the character whom the macro belongs to.

it runs through each character in turn (very fast :P ), targeting each living one,stopping on the foremost living character then following it.

I do the same for my offensive casts by just changing /follow to /assist then add a /cast or /castsequence below. This then leaves focus's so each character can keep a seperate target feared/sheeped/healed/etc.

i'm sure these are by no means perfect, so if anyone wants to let me know how i can improve it, i'm all ears :lol: