Ok try this. Fixed a few things that Oid must've overlooked. Cleaned some other stuff up. Untested so I might have missed something too.
Changes I made (from Oid's):
changed the declaration of CloakToggle. Set type to int and scope to outer instead of global (outer is global to the macro, global is accessible outside the macro too).
ArchLoop stuff. Removed the first /goto :ArchLoop since the label is the next line making the /goto do nothing. Removed the unused else and fixed two open braces. Added the check if you are casting a spell to the cloak/haste /if (since you have a delay of 5 before it, you could very well start casting in that time).
General. Changed pretty much every condition in /if statements to not use ==XX. That was not needed, if the variable is null or zero it will evaluate to false.
Sub Cloak. Rearranged a few lines. Changed the /call Cloak to /goto. Calling the sub from itself lots of times is bound to lead to stack overflow problems. In the version you posted it would call itself infinitely until you crash.
Code: Select all
Sub Main
/echo Simple Auto-Archery macro with DCOS Support, 1 for On, 0 for Off.
/declare CloakToggle int outer
/varset CloakToggle ${Param0}
/if (${CloakToggle}) {
/echo **Auto-Haste with DCOS is ON**
} else {
/echo **Auto-Haste with DCOS is OFF**
}
:ArchLoop
/if ((!${Me.Casting.ID}) && (${String[${Target.Type}].Equal[NPC]}) && (!${Me.Combat})) {
/keypress ranged
/delay 5
/if ((!${Me.Casting.ID}) && (${CloakToggle}}) && (!${Me.Buff[Haste]})) /call Cloak
}
/goto :ArchLoop
End Sub
Sub Cloak
:WaitLoop
/if (${Me.Casting.ID}) {
/delay 5
/goto :WaitLoop
} else {
/cast Item "Dark Cloak of the Sky"
}
/return