Help with Macro

mb4xy3

Member
Joined
Dec 31, 2007
Messages
107
Reaction score
6
Points
18
I was just about to test this but the servers are coming down, and I need help with a line of code. Here is my macro right now:

Code:
Sub Main
    /echo Auto Slow and Heal- type /end to quit
    /assist tank
    /attack on
    /pet attack

    /if (${SpawnCount[npc radius 50 zradius 10]}>1 && ${SpawnCount[npc radius 50 zradius 10]}<4)
    {
	/if (${Me.AltAbilityReady[952]})
	{
		/alt activate 952
		/delay 30
	}
	/alt activate 856
	/delay 10
    }
    
    /if (${SpawnCount[npc radius 50 zradius 10]}>3)
    {
	/if (${Me.AltAbilityReady[952]})
	{
		/alt activate 952
		/delay 30
	}
	/cast 8
	/delay 10
    }

    /if (${SpawnCount[npc radius 50 zradius 10]}=1)
    {
	/alt activate 148
	/delay 30
	/cast 7
	/delay 10
    }

    /if (${Target.Named})
    {
	/alt activate 1270
	/delay 10
    }

  /target tank
	
    :loop
        if (target's target is a npc and target is in combat)
        {
            /keypress 1
            /delay 2
            /doevents
            /goto :loop
        }
/return

So, the part I am having trouble with is identifying the logic of when to start and stop the loop. I'm thinking if the target's target (the target ill always be the Main tank) is an npc and the target (again, main tank) is in combat, then do my heal macro (it just spams all my multi bind heal keys).

I don't know how to check the target's target.
 
Code:
    /if (${SpawnCount[npc radius 50 zradius 10]}>1 && ${SpawnCount[npc radius 50 zradius 10]}<4){
	/if (${Me.AltAbilityReady[952]})
	{
		/alt activate 952
		/delay 30
	}
	/alt activate 856
	/delay 10
    }

this produces an error on the first if command, what am I doing wrong?
 
Code:
    /if (${SpawnCount[npc radius 50 zradius 10]}>1 && ${SpawnCount[npc radius 50 zradius 10]}<4){
	/if (${Me.AltAbilityReady[952]})
	{
		/alt activate 952
		/delay 30
	}
	/alt activate 856
	/delay 10
    }

post the error.

based on what I see you aren't putting a space between the ending ) and { which would cause MQ2 to throw an error that it's unable to find the command. That's based on not having the actual error to look at.

this produces an error on the first if command, what am I doing wrong?
 
Last edited:
Code:
    /if (${SpawnCount[npc radius 50 zradius 10]}>1 && ${SpawnCount[npc radius 50 zradius 10]}<4){
	/if (${Me.AltAbilityReady[952]})
	{
		/alt activate 952
		/delay 30
	}
	/alt activate 856
	/delay 10
    }

post the error.

based on what I see you aren't putting a space between the ending ) and { which would cause MQ2 to throw an error that it's unable to find the command. That's based on not having the actual error to look at.

this produces an error on the first if command, what am I doing wrong?


ok, the space fixed my first error, thanks.
next is on this line:

/if (${Me.AltAbilityReady[952]}) {

Errorr reads:

usage: /if(<conditions>)<command>
Failed to parse /if command. Cound not find command ot execute
ShamanAutohealSlow.mac@11(Main): /if (${Me.AltAbilityReady[952]})

This line I want to check to see if the alt ability 952 is ready, and if it is, then cast it.

Code:
    /if (${SpawnCount[npc radius 100 zradius 100]}>3) {
	/if (${Me.AltAbilityReady[952]}) {
		/alt activate 952
		/delay 30
	}
	/cast 8
	/delay 10
    }
 
Code:
    /if (${SpawnCount[npc radius 50 zradius 10]}>1 && ${SpawnCount[npc radius 50 zradius 10]}<4){
	/if (${Me.AltAbilityReady[952]})
	{
		/alt activate 952
		/delay 30
	}
	/alt activate 856
	/delay 10
    }


post the error.

based on what I see you aren't putting a space between the ending ) and { which would cause MQ2 to throw an error that it's unable to find the command. That's based on not having the actual error to look at.

this produces an error on the first if command, what am I doing wrong?


ok, the space fixed my first error, thanks.
next is on this line:

/if (${Me.AltAbilityReady[952]}) {

Errorr reads:

usage: /if(<conditions>)<command>
Failed to parse /if command. Cound not find command ot execute
ShamanAutohealSlow.mac@11(Main): /if (${Me.AltAbilityReady[952]})

This line I want to check to see if the alt ability 952 is ready, and if it is, then cast it.

Code:
    /if (${SpawnCount[npc radius 100 zradius 100]}>3) {
	/if (${Me.AltAbilityReady[952]}) {
		/alt activate 952
		/delay 30
	}
	/cast 8
	/delay 10
    }

Again it's saying it can't find the command to execute, which implies an issue with spacing as previously mentioned.

Based on the quoted text it shows the { on a different line than the /if (), like

Code:
/if (${someVar})
{
    /dosomething
}

but should be
Code:
/if (${someVar}) {
    /dosomething
}

While I understand that based on some programming standards they should be the same thing they are not in the world of macro scripting because when you run a /if (${Var}) it looks for the command following the closing ). If the next character is a { after a space then it checks for a block of information, if there is no space followed by { it executes the following line, which in this case is { and since that isn't a command it cannot find the command to execute.

My apologies for overlooking that in the original post.
 
Last edited:
Believe that should correct all the spacing/line issues mentioned in my previous post.

Code:
Sub Main
    /echo Auto Slow and Heal- type /end to quit
    /assist tank
    /attack on
    /pet attack

    /if (${SpawnCount[npc radius 50 zradius 10]}>1 && ${SpawnCount[npc radius 50 zradius 10]}<4) {
		/if (${Me.AltAbilityReady[952]}) {
			/alt activate 952
			/delay 30
		}
	/alt activate 856
	/delay 10
    }
    
    /if (${SpawnCount[npc radius 50 zradius 10]}>3) {
		/if (${Me.AltAbilityReady[952]}) {
			/alt activate 952
			/delay 30
		}
	/cast 8
	/delay 10
    }

    /if (${SpawnCount[npc radius 50 zradius 10]}=1) {
		/alt activate 148
		/delay 30
		/cast 7
		/delay 10
    }

    /if (${Target.Named}) {
		/alt activate 1270
		/delay 10
    }

	/target tank
	
    :loop
	/if (target's target is a npc and target is in combat) {
		/keypress 1
		/delay 2
		/doevents
		/goto :loop
	}
/return
 
Thanks for all the info- I’ll checl it out soon once this flu passes.