EXP and aggro targeting

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

MQuser1202
decaying skeleton
decaying skeleton
Posts: 9
Joined: Wed May 05, 2004 5:07 pm

EXP and aggro targeting

Post by MQuser1202 » 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.

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 

eqjoe
a grimling bloodguard
a grimling bloodguard
Posts: 984
Joined: Sat Sep 28, 2002 12:26 pm

Post by eqjoe » Sat May 22, 2004 2:20 pm

There is no return from your sub main.
:Loop and the 23 lines after it are outside a sub routine.

This needs a lot of work. While this will not fix your macro start by taking:

Code: Select all

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 
and move it to the bottem of your macro. Your sub main should look something like this :

Code: Select all

Sub Main

   /declare Exper int outer 
   /declare AAExp int outer 

   /declare TargetUpNext int outer 

   /varset TargetUpNext 0    


: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 
   } 
/goto :Loop
/return

Dont reply with something like, "I did what you said and it still does not work". I totaly dont expect this to fix your macro, only to get you started on fixing it yourself.


-j