for those that dont want to move from the anchor spot

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

grayfox107
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu May 13, 2004 12:23 am

for those that dont want to move from the anchor spot

Post by grayfox107 » Fri May 28, 2004 5:17 pm

The only difference between this macro and the original is that this macro will run you in the same spot and will slow the target from running out of range. However because of running in the same spot if your don’t have a close target you will slow down to normal speed since you will keep trying to recast the dot song. Best used in areas with constant adds.

| usage: chant.mac <DOTs/LVL6 Selos> <49selo> <radius> [<heal song>] [<Slow Song>] [<pause on startup>]
|
|
| Usage Examples:
| -Scenario 1: If you are using...
| ...DOTs in Gems 4, 5, 6, and 7
| ...Level 49 Selo in Gem 2
| ...Radius of 55
| ...Hymn of Restoration in Gem 1
| ...Selo's Consonant Chain 3
| ...If you wanted the script to start paused
| syntax: /mac chant 4567 2 55 1 3 1
|
| -Scenario 2: If you are using...
| ...DOTs in Gems 6 and 7
| ...Level 6 Selo in gem 3
| ...Radius of 80
| ...Hymn of Restoration in gem 8
| ...Selo's Consonant Chain 4
| ...If you want the script to start un-paused
| syntax: /mac chant 673 0 80 8 4 0
|
|
| If <heal song> is defined then when health goes below ${Health}Min (default is 70%)
| it will replace the first song in <DOTs> with <heal song> until health is above
| ${Health}Max (default is 85%)
|
| The <Slow Song> is set to start at 30% health for your current target to start and will replace the second song when it is playing.
|
|
| If <pause on startup> is a 1 the script will pause upon startup so that you can add mobs to your avoid list.
| If <pause on startup> is a 0 the script will start immediately and go hunting.
| If you don't define <pause on startup> it assumes you want to immediately start hunting.
|
| If <selo> is 0 then the macro will not try to cast selos every 150 seconds
|
| -----------------------------------------------------------------------------------


#event NeedTarget "You must first select a target for this spell!"
#event Exp "You gain "
#event Died "You have entered"
#event Caster " begins to cast a spell."
#event Tell "tells you"

#turbo 10

Sub Main(string DOTs,string Selos,int CRadius,string Health,string Slow,int Paused)

/if (!${Defined[CRadius]}) {
/echo usage: chant.mac <DOTs, LVL6 Selos> <49selo> <radius> [<heal song>] [<Slow Song>]
/return
}

/declare PauseFlag int outer

/if (${Defined[Paused]}) {
/if (${Paused}) {
/varset PauseFlag 1
} else {
/varset PauseFlag 0
}
} else {
/varset PauseFlag 0
}

/declare avoidadd string outer
/declare avoidrem string outer

/alias /pause /varcalc PauseFlag !${PauseFlag}
/alias /avoidadd /varset avoidadd
/alias /avoidrem /varset avoidrem

/declare CirR outer

/declare Songs[10] int outer
/declare nSongs int outer
/declare CurSong int outer
/declare PrevSong int outer

/declare Exper int outer
/declare AAExp int outer

/declare SongTimer timer outer
/declare SeloSong int outer

/declare HealSong int outer
/declare SlowSong int outer
/declare OrigSong int outer
/declare OrigSong2 int outer

/declare HealthMin outer
/declare HealthMax outer

/declare TargetHealthMin outer

/declare DBLevel outer

/declare TargetUpNext int outer

/declare AnchorX int outer
/declare AnchorY int outer

/declare AvoidList[50] string outer UNDEFINED-ARRAY-ELEMENT

/declare MyXLOC float outer
/declare MyYLOC float outer

/declare ObstCount int outer
/declare EachSong int local

/call AvoidINILoad

/varset PrevSong 0
/varset MyXLOC 0.0
/varset MyYLOC 0.0

/varset nSongs ${DOTs.Length}
/echo nSongs ${nSongs}
/echo DOTs ${DOTs}
/for EachSong 1 to ${nSongs}
/varset Songs[${EachSong}] ${DOTs.Mid[${EachSong},1]}
/echo Song ${EachSong}: ${Me.Gem[${Songs[${EachSong}]}].Name}
/next EachSong

/if (${Selos}!=0) {
/varset SeloSong ${Selos}
/echo Selo's: ${Me.Gem[${SeloSong}].Name}
} else {
/varset SeloSong 0
/echo Not using level 49 Selos.
}

/if (!${Defined[Health]}) {
/echo No HealSong. Please watch your health.
/varset HealSong 0
} else /if (${Health}!=0) {
/varset HealSong ${Health}
/echo Healsong: ${Me.Gem[${HealSong}].Name}
} else {
/echo No HealSong. Please watch your health.
/varset HealSong 0
}

/if (!${Defined[Slow]}) {
/echo No SlowSong. Your Pray may run.
/varset HealSong 0
} else /if (${Slow}!=0) {
/varset SlowSong ${Slow}
/echo Slowsong: ${Me.Gem[${SlowSong}].Name}
} else {
/echo No SlowSong. Your Pray may run.
/varset HealSong 0
}

/varset CirR ${CRadius}
/echo Radius: ${CirR}

/varset OrigSong ${Songs[1]}
/varset OrigSong2 ${Songs[2]}
/varset CurSong 1
/varset Exper ${Me.Exp}
/varset AAExp ${Me.AAExp}
/varset SongTimer 1

|/varset DBLevel $int($calc($calc($char(level)*.75)+1))
/varset DBLevel 35

/varset HealthMin 70
/varset HealthMax 85

/varset TargetHealthMin 30

/varset TargetUpNext 0

/varset AnchorX ${Me.X}
/varset AnchorY ${Me.Y}

/echo Anchor dropped at ${AnchorX},${AnchorY}

/if (${PauseFlag}==1) {
/echo Script [PAUSED] issue an "/pause" to unpause it.
}

:Loop

/if (${avoidadd.Length}) {
/echo ${avoidadd.Length} for ${avoidadd}
/call AvoidINIAdd "${avoidadd}"
/varset avoidadd
}

/if (${avoidrem.Length}) {
/echo ${avoidrem.Length} for ${avoidrem}
/call AvoidINIRemove "${avoidrem}"
/varset avoidrem
}

/if (${PauseFlag}==1) {
/delay 1
/doevents AddAvoid
/doevents RemoveAvoid
/goto :Loop
}

/if (${TargetUpNext}<=0) /if (!${Target.ID}) {
/call GetTarget
|/delay 2
}

/if (${TargetUpNext}>0) /if (${Target.ID}) {
/echo User Selected Target or Aggroed while running
/varset TargetUpNext 0
}

/if (${Target.Distance}>1000) /if (${Target.PctHPs}<=50) {
/echo Target Warped... Getting a new target; id was ${Target.ID}
/cleanup
/call GetTarget
/delay 2
}


/if (${HealSong}) /if (${Me.PctHPs}<${HealthMin}) {

/if (${Songs[1]}!=${HealSong}) {
/echo Healing On - Health: ${Me.PctHPs}% to ${HealthMax}%
/varset Songs[1] ${HealSong}
}
}

/if (${HealSong}) /if (${Me.PctHPs}>=${HealthMax}) {
/if (${Songs[1]}!=${OrigSong}) {
/echo Healing Off
/varset Songs[1] ${OrigSong}
}
}


/if (${SlowSong}) /if (${Target.PctHPs}<${TargetHealthMin}) {
/if (${Songs[2]}!=${SlowSong}) {
/echo Slowing On On - Health: Target Health is less than ${TargetHealthMin}%
/varset Songs[2] ${SlowSong}
}
}

/if (${SlowSong}) /if (${Target.PctHPs}>${TargetHealthMin}) {
/if (${Songs[2]}!=${OrigSong2}) {
/echo Slowing Off
/varset Songs[2] ${OrigSong2}
}
}



|/delay 2
/if (${SeloSong}) /if (!${Me.Casting.ID}) /if (!${Me.Buff[$Me.Gem[${SeloSong}].Name].Duration}) /varset SongTimer 1
/if (${SongTimer}>0) /if (!${Me.Casting.ID}) /call SongFailed
/call Circ
/delay 1
/doevents
|/delay 1
/goto :Loop
/return

Sub Event_Timer(string TimerName)
/if (${String[${TimerName}].Equal[SongTimer]}) {
| ${Me.Buff[${Me.Gem[4]}].ID}
/if (${SeloSong}) /if (!${Me.Buff[${Me.Gem[${SeloSong}]}].ID}) {
/echo Selos not up!!!
/stopsong
/cast ${SeloSong}
/varset PrevSong 0
/varset SongTimer 30
/call Circ
/doevents
/return
}

| ${Me.Buff[${Me.Gem[4].Name}].Duration}<=6) {
/if (${SeloSong}) /if (${Me.Buff[${Me.Gem[${SeloSong}].Name}].Duration}<=6) {
/echo Selos about to die
/stopsong
/cast ${SeloSong}
/varset PrevSong 0
/varset SongTimer 30
/call Circ
/doevents
/return
}

/delay 2
/stopsong
/echo ${CurSong} casting ${Songs[${CurSong}]}
/cast ${Songs[${CurSong}]}
/varset PrevSong ${CurSong}
/varcalc CurSong ${CurSong}+1
/if (${CurSong}>${nSongs}) /varset CurSong 1
/varset SongTimer 30
/call Circ
/doevents
}
/return

Sub Circ
/declare CirX local
/declare CirY local

/call CheckObst

/if (${Target.ID}) {
/varset CirX ${AnchorY}
/varset CirY ${AnchorX}
} else {

/if (${TargetUpNext}!=0) {

/varset CirX ${AnchorY}
/varset CirY ${AnchorX}

/if (${Spawn[ID ${TargetUpNext}].Distance}<=${Math.Calc[${CirR}*2]}) {
/if (${Target.ID}) {
/if (${Target.ID}!=${TargetUpNext}) {
/target id ${TargetUpNext}
}
} else {
/target id ${TargetUpNext}
}
/varset TargetUpNext 0
}
}
}

/if (${Math.Distance[${CirX},${CirY}]}<${Math.Calc[${CirR}/2]}) {
/face heading ${Math.Calc[${Heading[${CirX},${CirY}].DegreesCCW}+180]}
} else {
/face heading ${Math.Calc[${Heading[${CirX},${CirY}].DegreesCCW}+${Math.Calc[90*${CirR}/${Math.Distance[${CirX},${CirY}]}]}]}
}
/return

Sub SongFailed
/if (!${PrevSong}) {
/varset SongTimer 1
/return
}
/varset CurSong ${PrevSong}
/varset SongTimer 1
/return

Sub Event_NeedTarget
/if (${TargetUpNext}<=0) /call GetTarget
/return

Sub Event_Died
/delay 10
/sit
/delay 10
/camp desktop
/return

Sub Event_Exp
/varset AAExp ${Math.Calc[${Me.AAExp}-${AAExp}]}
/varset Exper ${Math.Calc[${Me.Exp}-${Exper}]}

/echo EXP: ${Exper}:${Me.PctExp}% - AAXP: ${AAExp}:${Me.AAExp}% - ${Math.Calc[${Macro.RunTime}/60]} minutes

/varset Exper ${Me.Exp}
/varset AAExp ${Me.AAExp}

/if (${TargetUpNext}==0) /if (${Target.ID}==0) /call GetTarget
/return

Sub GetTarget
/declare LastMobID int local 0
/declare FirstMobID int local 0
/declare MobID int local 0
/declare SRadius int local


/varset MobID ${Spawn[npc radius ${Math.Calc[${CirR}*2]}].ID}
/varset FirstMobID ${MobID}
/echo MobID ${MobID}

:CheckAggrodMobs
/if (${MobID}!=0) {
/if (${Spawn[ID ${MobID}].Speed}>100) {
/call AvoidTargets ${MobID}
/if (${Macro.Return}==1) {
/target id ${MobID}
/echo Kiting aggro'd mob: ${Target.CleanName}
/return
}
}
/varset LastMobID ${MobID}
/varset MobID ${Spawn[npc id ${LastMobID} radius ${Math.Calc[${CirR}*2]} next].ID}
/if (${FirstMobID}==${MobID}) {
/goto :NoAggrodMobs
}
/goto :CheckAggrodMobs
:NoAggrodMobs
}
/echo no aggro'd mobs found

/varset MobID 0
/varset FirstMobID 0
/varset LastMobID 0
/alert clear 1
| a clear alert and noalert don't mix
/alert add 1 npc this_is_bogus
/for SRadius 100 to 10000 step 100
/if (${MobID}==0) {
/varset MobID ${Spawn[noalert 1 npc range ${DBLevel} ${Me.Level} loc ${RubberX} ${RubberY} radius ${SRadius}].ID}
/varset FirstMobID ${MobID}
} else {
/varset LastMobID ${MobID}
/varset MobID ${Spawn[noalert 1 npc range ${DBLevel} ${Me.Level} loc ${RubberX} ${RubberY} radius ${SRadius}].ID}
/if (${FirstMobID}==${MobID}) {
/next SRadius
}
}
/if (${MobID}!=0) {
/call AvoidTargets ${MobID}
/if (${Macro.Return}==1) {
/echo not avoiding ${Spawn[ID ${MobID}].CleanName}
/goto :Done
} else {
/alert add 1 npc ${Spawn[ID ${MobID}].CleanName}
}
}
/next SRadius

/varset MobID ${Spawn[npc]}
/echo No mobs found, action required!
/beep
/beep
/beep
/beep
:Done
/varset TargetUpNext ${MobID}
/echo Next: ${Spawn[ID ${MobID}].Level} ${Spawn[ID ${MobID}].CleanName} - Distance: ${Spawn[ID ${MobID}].Distance}
/return



|#############################################################################


Sub AvoidTargets(int TempMobID)
/declare Element int local 1

:AvoidCheckLoop

/if (${AvoidList[${Element}].Equal[UNDEFINED-ARRAY-ELEMENT]}) {
/return 1
}

/if (${AvoidList[${Element}].Equal[${Spawn[ID ${TempMobID}].CleanName}]}) {
/echo AVOIDING ${AvoidList[${Element}]}
/return 0
}
/varcalc Element ${Element}+1
/goto :AvoidCheckLoop
/return 1


|#############################################################################



Sub AvoidINIRemove(string RemoveName)
/declare TempElements local 0
/declare TempVar int local 0
/declare TempItem string local

:RemCheckLoop
/varset TempItem ${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND]}
/if (${TempItem.Equal[NULL]}) {
| no file
/goto :RemFoundInArray
}
/if (${TempItem.Equal[NOTFOUND]}) {
/echo ${RemoveName} not in AvoidList.ini
/goto :RemFoundInArray
}

/if (${RemoveName.Equal[${TempItem}]}) {
/varset AvoidList[${Math.Calc[${TempVar}+1]}] Empty
/echo ${RemoveName} removed from AvoidList.ini
/ini AvoidList.ini Avoid ${TempVar} Empty
:VerifyRemoval
/if (!${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND].Equal[Empty]}) {
/echo verify removal unsuccessful
/goto :VerifyRemoval
}
/goto :RemFoundInArray
}
/varcalc TempVar ${TempVar}+1
/goto :RemCheckLoop
:RemFoundInArray
/return


|#############################################################################


Sub AvoidINIAdd(string AddName)
/declare TempElements int local 0
/declare TempVar int local 1
/declare TempItem string local

/echo AvoidINIAdd ${AddName}

:AddCheckLoop
/varset TempItem ${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND]}

/if (${TempItem.Equal[NULL]}) {
| no file
/goto :FoundInArray
}

/if (${TempItem.Equal[NOTFOUND]}) {
/varset AvoidList[${Math.Calc[${TempVar}+1]}] ${AddName}
/goto :AddItem
}

/if (${TempItem.Equal[${AddName}]}) {
/echo ${AddName} already in AvoidList.ini
/goto :FoundInArray
}

/if (${TempItem.Equal[Empty]}) {
/varset AvoidList[${Math.Calc[${TempVar}+1]}] ${AddName}
/goto :AddItem
}

/varcalc TempVar ${TempVar}+1
/goto :AddCheckLoop

:AddItem

/ini AvoidList.ini Avoid ${TempVar} "${AddName}"

:VerifyAdd
/if (!${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND].Equal[${AddName}]}) {
/echo verify addition unsuccessful
/goto :VerifyAdd
}

/echo ${AddName} added to AvoidList.ini

:FoundInArray
/return


|#############################################################################


Sub AvoidINILoad
/declare TempItem string local
/declare AvoidItemNum int local 0

:LoadAvoidLoop

/varset TempItem ${Ini[AvoidList.ini,Avoid,${AvoidItemNum},NOTFOUND]}
/if (${TempItem.Equal[NULL]}) {
/goto :DoneLoading
}
/if (${TempItem.Equal[NOTFOUND]}) {
/goto :DoneLoading
}
| note: indexing starts at 1 not 0
/echo adding ${TempItem} to avoid list at ${Math.Calc[${AvoidItemNum}+1].Int}
/varset AvoidList[${Math.Calc[${AvoidItemNum}+1]}] ${TempItem}
/varcalc AvoidItemNum ${AvoidItemNum}+1
/goto :LoadAvoidLoop
:DoneLoading
/return


|#############################################################################


Sub Event_AddAvoid(string EvtText)
/if (${EvtText.Mid[6,10].Equal[avoid add ]}) {
/call AvoidINIAdd "${EvtText.Mid[16,${Math.Calc[${EvtText.Length}-16]}]}"
}
/return

Sub Event_RemoveAvoid(EvtText)
/if (${EvtText.Mid[6,13].Equal[avoid remove ]}) {
/call AvoidINIRemove "${EvtText.Mid[19,${Math.Calc[${EvtText.Length}-19]}]}"
}
/return

Sub Event_Caster(string CastText)
/declare CasterID int local
/varset CasterID ${Spawn[${CastText.Left[${Math.Calc[${String[${CastText}].Length}-24]}]}].ID}
/if (!${Spawn[ID ${CasterID}].Type.Equal[NPC]}) /return
/if (${Target.ID}==${CasterID}) /return
/if (${Spawn[ID ${CasterID}].Distance}<=${Math.Calc[${CirR}*2]}) {
/target id ${CasterID}
/echo Targeting Caster: ${Target.CleanName}
}
/return

Sub Event_Tell
/beep
/mp3 play
/return

sub CheckObst
/if (${MyXLOC}==${Me.X}) /if (${MyYLOC}==${Me.Y}) {
/echo STUCK!!!
/call HitObst 1
}
/varset MyXLOC ${Me.X}
/varset MyYLOC ${Me.Y}
/return

sub HitObst
/keypress up
/keypress down hold
/if (${Math.Rand[99]}>50) {

/delay 2
/keypress down
/keypress Right hold
/delay 2
/delay ${Param0}
/keypress Right
} else {
/delay 2
/keypress down
/keypress Left hold
/delay 2
/delay ${Param0}
/keypress Left
}
/keypress down
/keypress Right
/keypress Left
/keypress up
/keypress num_lock
/return

Oid
a snow griffon
a snow griffon
Posts: 416
Joined: Thu Oct 17, 2002 3:26 am
Contact:

Post by Oid » Fri May 28, 2004 7:44 pm

please add code tags.
Smokey the Lax says only you can prevent reproduction.

Scarf
decaying skeleton
decaying skeleton
Posts: 5
Joined: Fri May 28, 2004 5:12 pm

Post by Scarf » Sun May 30, 2004 2:13 am

Code: Select all

| usage: chant.mac <DOTs/LVL6 Selos> <49selo> <radius> [<heal song>] [<Slow Song>] [<pause on startup>] 
| 
| 
| Usage Examples: 
| -Scenario 1: If you are using... 
| ...DOTs in Gems 4, 5, 6, and 7 
| ...Level 49 Selo in Gem 2 
| ...Radius of 55 
| ...Hymn of Restoration in Gem 1 
| ...Selo's Consonant Chain 3 
| ...If you wanted the script to start paused 
| syntax: /mac chant 4567 2 55 1 3 1 
| 
| -Scenario 2: If you are using... 
| ...DOTs in Gems 6 and 7 
| ...Level 6 Selo in gem 3 
| ...Radius of 80 
| ...Hymn of Restoration in gem 8 
| ...Selo's Consonant Chain 4 
| ...If you want the script to start un-paused 
| syntax: /mac chant 673 0 80 8 4 0 
| 
| 
| If <heal song> is defined then when health goes below ${Health}Min (default is 70%) 
| it will replace the first song in <DOTs> with <heal song> until health is above 
| ${Health}Max (default is 85%) 
| 
| The <Slow Song> is set to start at 30% health for your current target to start and will replace the second song when it is playing. 
| 
| 
| If <pause on startup> is a 1 the script will pause upon startup so that you can add mobs to your avoid list. 
| If <pause on startup> is a 0 the script will start immediately and go hunting. 
| If you don't define <pause on startup> it assumes you want to immediately start hunting. 
| 
| If <selo> is 0 then the macro will not try to cast selos every 150 seconds 
| 
| ----------------------------------------------------------------------------------- 


#event NeedTarget "You must first select a target for this spell!" 
#event Exp "You gain " 
#event Died "You have entered" 
#event Caster " begins to cast a spell." 
#event Tell "tells you" 

#turbo 10 

Sub Main(string DOTs,string Selos,int CRadius,string Health,string Slow,int Paused) 

/if (!${Defined[CRadius]}) { 
/echo usage: chant.mac <DOTs, LVL6 Selos> <49selo> <radius> [<heal song>] [<Slow Song>] 
/return 
} 

/declare PauseFlag int outer 

/if (${Defined[Paused]}) { 
/if (${Paused}) { 
/varset PauseFlag 1 
} else { 
/varset PauseFlag 0 
} 
} else { 
/varset PauseFlag 0 
} 

/declare avoidadd string outer 
/declare avoidrem string outer 

/alias /pause /varcalc PauseFlag !${PauseFlag} 
/alias /avoidadd /varset avoidadd 
/alias /avoidrem /varset avoidrem 

/declare CirR outer 

/declare Songs[10] int outer 
/declare nSongs int outer 
/declare CurSong int outer 
/declare PrevSong int outer 

/declare Exper int outer 
/declare AAExp int outer 

/declare SongTimer timer outer 
/declare SeloSong int outer 

/declare HealSong int outer 
/declare SlowSong int outer 
/declare OrigSong int outer 
/declare OrigSong2 int outer 

/declare HealthMin outer 
/declare HealthMax outer 

/declare TargetHealthMin outer 

/declare DBLevel outer 

/declare TargetUpNext int outer 

/declare AnchorX int outer 
/declare AnchorY int outer 

/declare AvoidList[50] string outer UNDEFINED-ARRAY-ELEMENT 

/declare MyXLOC float outer 
/declare MyYLOC float outer 

/declare ObstCount int outer 
/declare EachSong int local 

/call AvoidINILoad 

/varset PrevSong 0 
/varset MyXLOC 0.0 
/varset MyYLOC 0.0 

/varset nSongs ${DOTs.Length} 
/echo nSongs ${nSongs} 
/echo DOTs ${DOTs} 
/for EachSong 1 to ${nSongs} 
/varset Songs[${EachSong}] ${DOTs.Mid[${EachSong},1]} 
/echo Song ${EachSong}: ${Me.Gem[${Songs[${EachSong}]}].Name} 
/next EachSong 

/if (${Selos}!=0) { 
/varset SeloSong ${Selos} 
/echo Selo's: ${Me.Gem[${SeloSong}].Name} 
} else { 
/varset SeloSong 0 
/echo Not using level 49 Selos. 
} 

/if (!${Defined[Health]}) { 
/echo No HealSong. Please watch your health. 
/varset HealSong 0 
} else /if (${Health}!=0) { 
/varset HealSong ${Health} 
/echo Healsong: ${Me.Gem[${HealSong}].Name} 
} else { 
/echo No HealSong. Please watch your health. 
/varset HealSong 0 
} 

/if (!${Defined[Slow]}) { 
/echo No SlowSong. Your Pray may run. 
/varset HealSong 0 
} else /if (${Slow}!=0) { 
/varset SlowSong ${Slow} 
/echo Slowsong: ${Me.Gem[${SlowSong}].Name} 
} else { 
/echo No SlowSong. Your Pray may run. 
/varset HealSong 0 
} 

/varset CirR ${CRadius} 
/echo Radius: ${CirR} 

/varset OrigSong ${Songs[1]} 
/varset OrigSong2 ${Songs[2]} 
/varset CurSong 1 
/varset Exper ${Me.Exp} 
/varset AAExp ${Me.AAExp} 
/varset SongTimer 1 

|/varset DBLevel $int($calc($calc($char(level)*.75)+1)) 
/varset DBLevel 35 

/varset HealthMin 70 
/varset HealthMax 85 

/varset TargetHealthMin 30 

/varset TargetUpNext 0 

/varset AnchorX ${Me.X} 
/varset AnchorY ${Me.Y} 

/echo Anchor dropped at ${AnchorX},${AnchorY} 

/if (${PauseFlag}==1) { 
/echo Script [PAUSED] issue an "/pause" to unpause it. 
} 

:Loop 

/if (${avoidadd.Length}) { 
/echo ${avoidadd.Length} for ${avoidadd} 
/call AvoidINIAdd "${avoidadd}" 
/varset avoidadd 
} 

/if (${avoidrem.Length}) { 
/echo ${avoidrem.Length} for ${avoidrem} 
/call AvoidINIRemove "${avoidrem}" 
/varset avoidrem 
} 

/if (${PauseFlag}==1) { 
/delay 1 
/doevents AddAvoid 
/doevents RemoveAvoid 
/goto :Loop 
} 

/if (${TargetUpNext}<=0) /if (!${Target.ID}) { 
/call GetTarget 
|/delay 2 
} 

/if (${TargetUpNext}>0) /if (${Target.ID}) { 
/echo User Selected Target or Aggroed while running 
/varset TargetUpNext 0 
} 

/if (${Target.Distance}>1000) /if (${Target.PctHPs}<=50) { 
/echo Target Warped... Getting a new target; id was ${Target.ID} 
/cleanup 
/call GetTarget 
/delay 2 
} 


/if (${HealSong}) /if (${Me.PctHPs}<${HealthMin}) { 

/if (${Songs[1]}!=${HealSong}) { 
/echo Healing On - Health: ${Me.PctHPs}% to ${HealthMax}% 
/varset Songs[1] ${HealSong} 
} 
} 

/if (${HealSong}) /if (${Me.PctHPs}>=${HealthMax}) { 
/if (${Songs[1]}!=${OrigSong}) { 
/echo Healing Off 
/varset Songs[1] ${OrigSong} 
} 
} 


/if (${SlowSong}) /if (${Target.PctHPs}<${TargetHealthMin}) { 
/if (${Songs[2]}!=${SlowSong}) { 
/echo Slowing On On - Health: Target Health is less than ${TargetHealthMin}% 
/varset Songs[2] ${SlowSong} 
} 
} 

/if (${SlowSong}) /if (${Target.PctHPs}>${TargetHealthMin}) { 
/if (${Songs[2]}!=${OrigSong2}) { 
/echo Slowing Off 
/varset Songs[2] ${OrigSong2} 
} 
} 



|/delay 2 
/if (${SeloSong}) /if (!${Me.Casting.ID}) /if (!${Me.Buff[$Me.Gem[${SeloSong}].Name].Duration}) /varset SongTimer 1 
/if (${SongTimer}>0) /if (!${Me.Casting.ID}) /call SongFailed 
/call Circ 
/delay 1 
/doevents 
|/delay 1 
/goto :Loop 
/return 

Sub Event_Timer(string TimerName) 
/if (${String[${TimerName}].Equal[SongTimer]}) { 
| ${Me.Buff[${Me.Gem[4]}].ID} 
/if (${SeloSong}) /if (!${Me.Buff[${Me.Gem[${SeloSong}]}].ID}) { 
/echo Selos not up!!! 
/stopsong 
/cast ${SeloSong} 
/varset PrevSong 0 
/varset SongTimer 30 
/call Circ 
/doevents 
/return 
} 

| ${Me.Buff[${Me.Gem[4].Name}].Duration}<=6) { 
/if (${SeloSong}) /if (${Me.Buff[${Me.Gem[${SeloSong}].Name}].Duration}<=6) { 
/echo Selos about to die 
/stopsong 
/cast ${SeloSong} 
/varset PrevSong 0 
/varset SongTimer 30 
/call Circ 
/doevents 
/return 
} 

/delay 2 
/stopsong 
/echo ${CurSong} casting ${Songs[${CurSong}]} 
/cast ${Songs[${CurSong}]} 
/varset PrevSong ${CurSong} 
/varcalc CurSong ${CurSong}+1 
/if (${CurSong}>${nSongs}) /varset CurSong 1 
/varset SongTimer 30 
/call Circ 
/doevents 
} 
/return 

Sub Circ 
/declare CirX local 
/declare CirY local 

/call CheckObst 

/if (${Target.ID}) { 
/varset CirX ${AnchorY} 
/varset CirY ${AnchorX} 
} else { 

/if (${TargetUpNext}!=0) { 

/varset CirX ${AnchorY} 
/varset CirY ${AnchorX} 

/if (${Spawn[ID ${TargetUpNext}].Distance}<=${Math.Calc[${CirR}*2]}) { 
/if (${Target.ID}) { 
/if (${Target.ID}!=${TargetUpNext}) { 
/target id ${TargetUpNext} 
} 
} else { 
/target id ${TargetUpNext} 
} 
/varset TargetUpNext 0 
} 
} 
} 

/if (${Math.Distance[${CirX},${CirY}]}<${Math.Calc[${CirR}/2]}) { 
/face heading ${Math.Calc[${Heading[${CirX},${CirY}].DegreesCCW}+180]} 
} else { 
/face heading ${Math.Calc[${Heading[${CirX},${CirY}].DegreesCCW}+${Math.Calc[90*${CirR}/${Math.Distance[${CirX},${CirY}]}]}]} 
} 
/return 

Sub SongFailed 
/if (!${PrevSong}) { 
/varset SongTimer 1 
/return 
} 
/varset CurSong ${PrevSong} 
/varset SongTimer 1 
/return 

Sub Event_NeedTarget 
/if (${TargetUpNext}<=0) /call GetTarget 
/return 

Sub Event_Died 
/delay 10 
/sit 
/delay 10 
/camp desktop 
/return 

Sub Event_Exp 
/varset AAExp ${Math.Calc[${Me.AAExp}-${AAExp}]} 
/varset Exper ${Math.Calc[${Me.Exp}-${Exper}]} 

/echo EXP: ${Exper}:${Me.PctExp}% - AAXP: ${AAExp}:${Me.AAExp}% - ${Math.Calc[${Macro.RunTime}/60]} minutes 

/varset Exper ${Me.Exp} 
/varset AAExp ${Me.AAExp} 

/if (${TargetUpNext}==0) /if (${Target.ID}==0) /call GetTarget 
/return 

Sub GetTarget 
/declare LastMobID int local 0 
/declare FirstMobID int local 0 
/declare MobID int local 0 
/declare SRadius int local 


/varset MobID ${Spawn[npc radius ${Math.Calc[${CirR}*2]}].ID} 
/varset FirstMobID ${MobID} 
/echo MobID ${MobID} 

:CheckAggrodMobs 
/if (${MobID}!=0) { 
/if (${Spawn[ID ${MobID}].Speed}>100) { 
/call AvoidTargets ${MobID} 
/if (${Macro.Return}==1) { 
/target id ${MobID} 
/echo Kiting aggro'd mob: ${Target.CleanName} 
/return 
} 
} 
/varset LastMobID ${MobID} 
/varset MobID ${Spawn[npc id ${LastMobID} radius ${Math.Calc[${CirR}*2]} next].ID} 
/if (${FirstMobID}==${MobID}) { 
/goto :NoAggrodMobs 
} 
/goto :CheckAggrodMobs 
:NoAggrodMobs 
} 
/echo no aggro'd mobs found 

/varset MobID 0 
/varset FirstMobID 0 
/varset LastMobID 0 
/alert clear 1 
| a clear alert and noalert don't mix 
/alert add 1 npc this_is_bogus 
/for SRadius 100 to 10000 step 100 
/if (${MobID}==0) { 
/varset MobID ${Spawn[noalert 1 npc range ${DBLevel} ${Me.Level} loc ${RubberX} ${RubberY} radius ${SRadius}].ID} 
/varset FirstMobID ${MobID} 
} else { 
/varset LastMobID ${MobID} 
/varset MobID ${Spawn[noalert 1 npc range ${DBLevel} ${Me.Level} loc ${RubberX} ${RubberY} radius ${SRadius}].ID} 
/if (${FirstMobID}==${MobID}) { 
/next SRadius 
} 
} 
/if (${MobID}!=0) { 
/call AvoidTargets ${MobID} 
/if (${Macro.Return}==1) { 
/echo not avoiding ${Spawn[ID ${MobID}].CleanName} 
/goto :Done 
} else { 
/alert add 1 npc ${Spawn[ID ${MobID}].CleanName} 
} 
} 
/next SRadius 

/varset MobID ${Spawn[npc]} 
/echo No mobs found, action required! 
/beep 
/beep 
/beep 
/beep 
:Done 
/varset TargetUpNext ${MobID} 
/echo Next: ${Spawn[ID ${MobID}].Level} ${Spawn[ID ${MobID}].CleanName} - Distance: ${Spawn[ID ${MobID}].Distance} 
/return 



|############################################################################# 


Sub AvoidTargets(int TempMobID) 
/declare Element int local 1 

:AvoidCheckLoop 

/if (${AvoidList[${Element}].Equal[UNDEFINED-ARRAY-ELEMENT]}) { 
/return 1 
} 

/if (${AvoidList[${Element}].Equal[${Spawn[ID ${TempMobID}].CleanName}]}) { 
/echo AVOIDING ${AvoidList[${Element}]} 
/return 0 
} 
/varcalc Element ${Element}+1 
/goto :AvoidCheckLoop 
/return 1 


|############################################################################# 



Sub AvoidINIRemove(string RemoveName) 
/declare TempElements local 0 
/declare TempVar int local 0 
/declare TempItem string local 

:RemCheckLoop 
/varset TempItem ${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND]} 
/if (${TempItem.Equal[NULL]}) { 
| no file 
/goto :RemFoundInArray 
} 
/if (${TempItem.Equal[NOTFOUND]}) { 
/echo ${RemoveName} not in AvoidList.ini 
/goto :RemFoundInArray 
} 

/if (${RemoveName.Equal[${TempItem}]}) { 
/varset AvoidList[${Math.Calc[${TempVar}+1]}] Empty 
/echo ${RemoveName} removed from AvoidList.ini 
/ini AvoidList.ini Avoid ${TempVar} Empty 
:VerifyRemoval 
/if (!${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND].Equal[Empty]}) { 
/echo verify removal unsuccessful 
/goto :VerifyRemoval 
} 
/goto :RemFoundInArray 
} 
/varcalc TempVar ${TempVar}+1 
/goto :RemCheckLoop 
:RemFoundInArray 
/return 


|############################################################################# 


Sub AvoidINIAdd(string AddName) 
/declare TempElements int local 0 
/declare TempVar int local 1 
/declare TempItem string local 

/echo AvoidINIAdd ${AddName} 

:AddCheckLoop 
/varset TempItem ${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND]} 

/if (${TempItem.Equal[NULL]}) { 
| no file 
/goto :FoundInArray 
} 

/if (${TempItem.Equal[NOTFOUND]}) { 
/varset AvoidList[${Math.Calc[${TempVar}+1]}] ${AddName} 
/goto :AddItem 
} 

/if (${TempItem.Equal[${AddName}]}) { 
/echo ${AddName} already in AvoidList.ini 
/goto :FoundInArray 
} 

/if (${TempItem.Equal[Empty]}) { 
/varset AvoidList[${Math.Calc[${TempVar}+1]}] ${AddName} 
/goto :AddItem 
} 

/varcalc TempVar ${TempVar}+1 
/goto :AddCheckLoop 

:AddItem 

/ini AvoidList.ini Avoid ${TempVar} "${AddName}" 

:VerifyAdd 
/if (!${Ini[AvoidList.ini,Avoid,${TempVar},NOTFOUND].Equal[${AddName}]}) { 
/echo verify addition unsuccessful 
/goto :VerifyAdd 
} 

/echo ${AddName} added to AvoidList.ini 

:FoundInArray 
/return 


|############################################################################# 


Sub AvoidINILoad 
/declare TempItem string local 
/declare AvoidItemNum int local 0 

:LoadAvoidLoop 

/varset TempItem ${Ini[AvoidList.ini,Avoid,${AvoidItemNum},NOTFOUND]} 
/if (${TempItem.Equal[NULL]}) { 
/goto :DoneLoading 
} 
/if (${TempItem.Equal[NOTFOUND]}) { 
/goto :DoneLoading 
} 
| note: indexing starts at 1 not 0 
/echo adding ${TempItem} to avoid list at ${Math.Calc[${AvoidItemNum}+1].Int} 
/varset AvoidList[${Math.Calc[${AvoidItemNum}+1]}] ${TempItem} 
/varcalc AvoidItemNum ${AvoidItemNum}+1 
/goto :LoadAvoidLoop 
:DoneLoading 
/return 


|############################################################################# 


Sub Event_AddAvoid(string EvtText) 
/if (${EvtText.Mid[6,10].Equal[avoid add ]}) { 
/call AvoidINIAdd "${EvtText.Mid[16,${Math.Calc[${EvtText.Length}-16]}]}" 
} 
/return 

Sub Event_RemoveAvoid(EvtText) 
/if (${EvtText.Mid[6,13].Equal[avoid remove ]}) { 
/call AvoidINIRemove "${EvtText.Mid[19,${Math.Calc[${EvtText.Length}-19]}]}" 
} 
/return 

Sub Event_Caster(string CastText) 
/declare CasterID int local 
/varset CasterID ${Spawn[${CastText.Left[${Math.Calc[${String[${CastText}].Length}-24]}]}].ID} 
/if (!${Spawn[ID ${CasterID}].Type.Equal[NPC]}) /return 
/if (${Target.ID}==${CasterID}) /return 
/if (${Spawn[ID ${CasterID}].Distance}<=${Math.Calc[${CirR}*2]}) { 
/target id ${CasterID} 
/echo Targeting Caster: ${Target.CleanName} 
} 
/return 

Sub Event_Tell 
/beep 
/mp3 play 
/return 

sub CheckObst 
/if (${MyXLOC}==${Me.X}) /if (${MyYLOC}==${Me.Y}) { 
/echo STUCK!!! 
/call HitObst 1 
} 
/varset MyXLOC ${Me.X} 
/varset MyYLOC ${Me.Y} 
/return 

sub HitObst 
/keypress up 
/keypress down hold 
/if (${Math.Rand[99]}>50) { 

/delay 2 
/keypress down 
/keypress Right hold 
/delay 2 
/delay ${Param0} 
/keypress Right 
} else { 
/delay 2 
/keypress down 
/keypress Left hold 
/delay 2 
/delay ${Param0} 
/keypress Left 
} 
/keypress down 
/keypress Right 
/keypress Left 
/keypress up 
/keypress num_lock 
/return

User avatar
Fuergrissa
a grimling bloodguard
a grimling bloodguard
Posts: 607
Joined: Mon Dec 08, 2003 3:46 pm
Location: UK

Post by Fuergrissa » Sun May 30, 2004 2:35 am

Oid wrote:please add code tags.
Must be Oid's RL Friends, never seen him so nice about one of his pet hates :)
[quote]"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."[/quote]

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Mon May 31, 2004 8:31 am

Almost sorry to see this macro posted again. Things were so peaceful for the week that Dkaa had locked his post of this. :wink:

user001
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sat Jun 12, 2004 4:57 am
Contact:

Event_Died

Post by user001 » Sat Jun 12, 2004 5:01 am

For some reason I cannot get the macro to camp out if my toon enters another zone (died). It seems right to me but perhaps it's not getting called? It would be much appreciated if someone could point me in the right direction or tell me why it's not working.

Thanks,
User001

I got this fixed by using #event Died
and changed it to "LOADING, PLEASE WAIT...."

But when I add an #event for when a mob goes out of range it just goes in an infinate loop.
I am using this code

Sub Event_Range
/keypress esc
/echo The target is out of range getting next target
/target id ${TargetUpNext}
/return

Any suggestions?

Thanks
Last edited by user001 on Sun Jun 13, 2004 5:19 am, edited 1 time in total.

user001
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sat Jun 12, 2004 4:57 am
Contact:

Got it

Post by user001 » Sun Jun 13, 2004 5:16 am

I found out to get it to camp out. I just changed the #event Died to

#event Died "LOADING, PLEASE WAIT..."

Though, now I can't get my #event out of range working heh,

Using #event Range "#*#target is out of range#*#"

Sub Event_Range
/keypress esc
/echo The target is out of range changing target
/target id ${TargetUpNext}
/return

The macro just cycles through this line and does nothing else. Anyone know why it would just cycle through this one infinately?

Thanks

select
decaying skeleton
decaying skeleton
Posts: 7
Joined: Mon Jun 14, 2004 5:41 pm

buggy transition

Post by select » Mon Jun 14, 2004 5:45 pm

i notice that this program has trouble finding another target sometimes and decides to run a funny path, this usually runs me right into the mobs im kiting and kills me, but i found a small alteration that helps reduce that. i basically changed the slow string from 30% to 4% hp then scribe DA in that slot. 90% of the time this will have DA up by the time your mob dies (depending on mobs of course)

juicydragon
decaying skeleton
decaying skeleton
Posts: 1
Joined: Thu Jun 24, 2004 4:04 pm

Post by juicydragon » Thu Jun 24, 2004 4:42 pm

Macro works great but cant seem to run a radius below 10. Is this a limitationion the coding for facing how would I fix this. Mobs seem to wind up directly across the circle from me and just out of ddd and cod aoe range.

As a radi 10 would be a dia 20 and ddd has a range of 35 centered on me or a radius of 17.5 there is a 2.5 safe zone that the mobs wind up clustered in. If one could run an 8 they would be dead.

desnts
RTFM, then ask again
Posts: 58
Joined: Wed Apr 30, 2003 4:40 pm

Post by desnts » Sun Jun 27, 2004 7:29 pm

juicy where u useing selos?

the ae songs work fine for me on 20 but thats w/o selo. your char just cant turn fast enough with selos on to ae like that. if not i dunno hehe.

on another note

i cant get the macro to heal me at all. have tested this on only a couple of occasions getting to 60 and to 20% health, yet mana is not every coming on. my syntax is


/macro chant.mac 234 0 20 5 0 0

234 = dots
1 = selo
5 = marr

thus turning off the use of selo but marr is never replaced as the first one do i need to move the song?

Timbuktu
orc pawn
orc pawn
Posts: 24
Joined: Thu May 27, 2004 2:20 pm

Cut and Paste, bad.

Post by Timbuktu » Wed Jul 07, 2004 2:41 pm

Ok.. over poring over this code that I didn't understand.. and beginning to understand it a little.. and reading the manual... I think the problem with dying not working is that MQ2 requires chat events to use the entire line now... Something like You have entered #1# ... But LOADING, PLEASE WAIT works too...

Oh.. and as to the healing problem... it's cause you didn't elect to use the slowsong. The author obviously used cut and paste... uh.. you guys forgot to fix something after you pasted it. in the little /if nesting thing about the slowsong defined or not... you have /varset HealSong 0 instead of /varset SlowSong 0 ... Twice you did that in fact. hehe.. ok... sorry.. I'm happy cuz I don't know C++ at all, and I found this stuff!! Yay me!!

Timbuktu