EXP and aggro targeting
Posted: Sat May 22, 2004 2:07 pm
OK I posted in the macro request and tried the suggestion.
http://macroquest2.com/phpBB2/viewtopic.php?t=7395
So I am guessing now I post here. I have looked over the boards for weeks and have tried to learn java and other programming before and have never been able to get a handle on it so the truth is I am lost at the moment. I cut and pasted what looked like it would matter. But get an error "flow ran into another subroutine.
http://macroquest2.com/phpBB2/viewtopic.php?t=7395
So I am guessing now I post here. I have looked over the boards for weeks and have tried to learn java and other programming before and have never been able to get a handle on it so the truth is I am lost at the moment. I cut and pasted what looked like it would matter. But get an error "flow ran into another subroutine.
Code: Select all
#event NeedTarget "You must first select a target for this spell!"
#event Exp "You gain "
#turbo 10
Sub Main()
/declare Exper int outer
/declare AAExp int outer
/declare TargetUpNext int outer
/varset TargetUpNext 0
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
: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
}
Sub Event_NeedTarget
/if (${TargetUpNext}<=0) /call GetTarget
/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 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