Page 1 of 1

addchecking crashes eq

Posted: Wed Jun 02, 2004 10:35 pm
by the_horror
I am making an auto puller for monks. I have most of it working but this part if the code is throwing me for a loop. This is my first attempt at doing a Macro. Be gentle it is my first time. Any help would be great or a point in the right direction.

Code: Select all

|-------------------------------------------------------------------------------- 
|SUB: ChkAdds
|-------------------------------------------------------------------------------- 

Sub ChkAdds

/declare MyMob int Global
/varset MyMob ${Target.ID}



:MoveToNext

   /declare AD_CurrentRadius   int local 
   /declare AD_MaxRadius   int local  
   /declare AD_MyTargetID   int local
   /varset  AD_MaxRadius 400
   
   /for AD_CurrentRadius 100 to ${AD_MaxRadius} step 100 
         /target radius ${AD_CurrentRadius} nopcnear notid ${Target.ID} npc 
         /varset AD_MyTargetID ${Target.ID} 
         /goto :ChkMob


:ChKMob
/if (${MyMob.Equal[${AD_MyTarget}]}) {
    /goto :MoveToNext
    } else {
    /goto :ChkTargetsTarget
    }
:ChkTargetsTarget
    /assist
    /if (${Target.Name.Equal[${My.Name}]}) {
    /delay 15
    /call FDAdds
    } else {
    /goto :CheckRadius
    }

:CheckRadius

    /if (${AD_CurrentRadius[${AD_MaxRadius}]}) {
   /varset AD_CurrentRadius 0
   /varset AD_MyTargetID    0
   /target &{MyMob}
   } else {
   /goto :MovetoNext
   }

/return


Posted: Wed Jun 02, 2004 10:45 pm
by Jerle69
Without actually trying to determine what you're doing...

Code: Select all

:ChKMob 
/if (${MyMob.Equal[${AD_MyTarget}]}) { 
    /goto :MoveToNext 
will/can cause it to go back to the :MoveToNext subsection which starts off by declaring variables. You can't declare a variable twice, so that right there is a show stopper (you declare it once, and can /varset it many times as needed, but get your declares outside the loop label). Also, your for statement doesn't have a /next associated with it at all, so I don't even know when it should iterate AD_CurrentRadius by another 100 (and neither does MQ2).

These are just two major issues I noticed at first glance. Perhaps if you described what the code was trying to accomplish (in english) it'd be easier to help you fix it.

ok tested that and still crashed

Posted: Wed Jun 02, 2004 11:26 pm
by the_horror
What I am attempting to do is make and add warning for the monk. let say the monk runs out tags the target but next to the target was another mob. so instead of pulling the one mob the monk has aggroed 2 mobs . This code I am writting is my attempt at doing a radius search for mobs around the monk and when it finds one that is not his orginal target the script check the traget's target. If the target's is the monk then i want a delay of ooo lets say 10 then the monk would fiegn death.. now lets say the radius search finds a target but this target's taget does not equal the monk then he continues to run back to the anchor point/The group. If you would like I can post the whole code because I am also have trouble with the mob array and reading from an InI file (like the hunter.mac)

Also made the suggested change and the code still crashes EQ

Code: Select all

|-------------------------------------------------------------------------------- 
|SUB: ChkAdds
|-------------------------------------------------------------------------------- 

Sub ChkAdds

   /declare MyMob int Global
   /varset MyMob ${Target.ID}
   /declare AD_CurrentRadius   int local 
   /declare AD_MaxRadius   int local  
   /declare AD_MyTargetID   int local
   /varset  AD_MaxRadius 400

:MoveToNext 
  
   /for AD_CurrentRadius 100 to ${AD_MaxRadius} step 100 
         /target radius ${AD_CurrentRadius} nopcnear notid ${Target.ID} npc "${RV_MobArray[${RV_TargetSub}]}" 
         /varset AD_MyTargetID ${Target.ID} 
         /goto :ChkMob


:ChKMob
/if (${MyMob.Equal[${AD_MyTarget}]}) {
    /goto :MoveToNext
    } else {
    /goto :ChkTargetsTarget
    }
:ChkTargetsTarget
    /assist
    /if (${Target.Name.Equal[${My.Name}]}) {
    /delay 15
    /call FDAdds
    } else {
    /goto :CheckRadius
    }

:CheckRadius

    /if (${AD_CurrentRadius[${AD_MaxRadius}]}) {
   /varset AD_CurrentRadius 0
   /varset AD_MyTargetID    0
   /target &{MyMob}
   } else {
   /goto :MovetoNext
   }

/return

Posted: Thu Jun 03, 2004 1:09 am
by wassup
Quick look... Note the blue colored text:

Is this the macro or an include?

1. If it's the macro, you must have a Sub Main
2. I am not 100% positive, but I think Global is case sensitive
3. Where are RV_MobArray and RV_TargetSub declared and set
4. Why the /goto :ChkMob. AD_CurrentRadius never gets past 100 in your /for loop
5. You were missing /next AD_CurrentRadius
6. It's Me.Name not My.Name
7. You declared AD_CurrentRadius as a local int, so why are you trying to use it as an array?
8. Be careful with spaces. I removed some extras

Code: Select all

|-------------------------------------------------------------------------------- 
|SUB: ChkAdds 
|-------------------------------------------------------------------------------- 

[color=cyan]Sub ChkAdds[/color]
   /declare MyMob int [color=cyan]global[/color]
   /varset MyMob ${Target.ID} 
   /declare AD_CurrentRadius int local 
   /declare AD_MaxRadius int local  
   /declare AD_MyTargetID int local 
   /varset  AD_MaxRadius 400 

   :MoveToNext 
   /for AD_CurrentRadius 100 to ${AD_MaxRadius} step 100 
         /target radius ${AD_CurrentRadius} nopcnear notid ${Target.ID} npc "${[color=cyan]RV_MobArray[${RV_TargetSub}][/color]}"
         /varset AD_MyTargetID ${Target.ID} 
         [color=cyan]/goto :ChkMob[/color]
   [color=cyan]/next AD_CurrentRadius[/color]

   :ChKMob 
   /if (${MyMob.Equal[${AD_MyTarget}]}) { 
      /goto :MoveToNext 
    } else { 
      /goto :ChkTargetsTarget 
    } 
   :ChkTargetsTarget 
    /assist 
    /if (${Target.Name.Equal[${[color=cyan]Me.Name[/color]}]}) { 
      /delay 15 
      /call FDAdds 
    } else { 
      /goto :CheckRadius 
    } 

   :CheckRadius 
   /if (${[color=cyan]AD_CurrentRadius[${AD_MaxRadius}][/color]}) { 
      /varset AD_CurrentRadius 0 
      /varset AD_MyTargetID 0 
      /target &{MyMob} 
   } else { 
      /goto :MovetoNext 
   } 
/return

Posted: Thu Jun 03, 2004 2:46 am
by s16z

Code: Select all

    /if (${Target.Name.Equal[${Me.Name}]}) {
      /delay 15
      /call FDAdds
    [color=cyan]} else {
      /goto :CheckRadius
    }[/color]

   :CheckRadius 
The blue code does nothing that isn't going to happen anyway.

Posted: Thu Jun 03, 2004 2:48 am
by s16z

Code: Select all

    /if (${Target.Name.Equal[${Me.Name}]}) {
      /delay 15
      /call FDAdds
    [color=cyan]} else {
      /goto :CheckRadius
    }[/color]

   :CheckRadius 
The blue code does nothing that isn't going to happen anyway.

the whole script

Posted: Thu Jun 03, 2004 3:41 am
by the_horror
sorry maybe I shouild have dont this first so it would have taken some of the questions out. Never the less thanks so far. Really want to see if I can get this working

Code: Select all

#turbo

Sub Main

|------------------------------------------------------------ 
   |How many times should aquire target fail before delaying? 
   |------------------------------------------------------------ 
   /declare RV_FailMax          int outer  3 
   |------------------------------------------------------------ 
   |How far would you like to target a mob? 
   |------------------------------------------------------------ 
   /declare RV_MaxRadius        int outer  3000 
   |------------------------------------------------------------ 
   |How far is the combat range? 
   |------------------------------------------------------------ 
   /declare RV_Range            int outer 10 
   |------------------------------------------------------------ 
   |What is the minimum Z Value of mobs I should target? 
   |------------------------------------------------------------ 
   /declare RV_MinZRange        int outer  -1000 
   |------------------------------------------------------------ 
   |What is the maximum Z Value of mobs I should target? 
   |------------------------------------------------------------ 
   /declare RV_MaxZRange        int outer  1000 
   |------------------------------------------------------------ 
   |Should I loot all items? 
   |------------------------------------------------------------ 
   /declare RV_LootAllItems     int outer  0 
   |------------------------------------------------------------ 
   |Should I display stats? 
   |------------------------------------------------------------ 
   /declare RV_DisplayStats     int outer  1 
   |------------------------------------------------------------
   |anchor vars
   |------------------------------------------------------------ 
    /declare AnchorX float outer 
    /declare AnchorY float outer 
    /declare fXLoc float outer 
    /declare fYLoc float outer 
    /declare iSetAnchor int outer

   |------------------------------------------------------------
   |tank vars
   |------------------------------------------------------------ 
    /declare TankName          string local 

   |------------------------------------------------------------ 
   |Loot Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterMob.ini "${Zone.Name}" 
   /if (!${Defined[RV_MobArray]}) { 
      /echo Mob Array Creation Error, ending macro... 
      /endmacro 
   } 

   |------------------------------------------------------------ 
   |Mob Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterLoot.ini "${Zone.Name}" 
   /if (!${Defined[RV_LootArray]}) { 
      /echo No Loot Array Created... 
   } 
   |------------------------------------------------------------ 
   |Variables that you don't need to worry about. 
   |------------------------------------------------------------ 
   /declare RV_FailCounter      int outer  0 
   /declare RV_MyTargetID       int outer  0 
   /declare RV_MyTargetName     string outer 
   /declare RV_MyTargetDead     int outer  0 
   /declare RV_InvalidTargetID  int outer  0 
   /declare RV_HasTarget        int outer  0 
   /declare RV_RandomWait       int outer  0 
   /declare RV_LootSlot         int outer  0 
   /declare RV_CheckLook        int outer  0 
   /declare RV_Fighting         int outer  0 
   /declare RV_TargetDead       int outer  0 
   /declare RV_MyXLOC           int outer  0 
   /declare RV_MyYLOC           int outer  0 
    
   /declare RV_FastRange        int outer 
   /declare RV_RangeMax         int outer 
   /declare RV_RangeMin         int outer 
   /varcalc RV_FastRange ${RV_Range}+3 
   /varcalc RV_RangeMax ${RV_Range}+1 
   /varcalc RV_RangeMin ${RV_Range}-1 


   |------------------------------------------------------------
   |setting Tank
   |------------------------------------------------------------
    /if (${Defined[Param0]}) { 
       /varset TankName ${Param0}              
    } else { 
        /echo Error:  The name of your Tankmust be used. 
        /echo Usage:  /macro monk.mac tankname
        /return 
    } 


   |------------------------------------------------------------
   |setting anchor
   |------------------------------------------------------------
   /varset AnchorX ${Me.X} 
   /varset AnchorY ${Me.Y} 
   /echo Created anchor at Loc: ${AnchorY}, ${AnchorX}.

   :Start 
   /doevents 
   /call GMCheck 
   /call GetTarget 

   :KillAdds 
   /if (${RV_HasTarget}) /call MoveToMob 
   /if (${RV_HasTarget}) /call TagMob
   /if (${RV_HasTarget}) /call RunBack  
   /if (${RV_HasTarget}) /call TankTag
   /if (${RV_HasTarget}) /call Stand
   /if (${RV_HasTarget}) /call CombatSub
   /if (${RV_HasTarget}) /call ReturnToAnchor 
   /if (${RV_HasTarget}) /call BuffCheck
   /call ResetSub 

   /varset RV_RandomWait ${Math.Rand[5]} 
   /varcalc RV_RandomWait ${RV_RandomWait}+1 
   /echo Paranoia - Waiting ${RV_RandomWait} seconds before resuming 
   /delay ${RV_RandomWait}s 
    
   /if (${Target.ID}) { 
      /echo Looks like something is attacking us, killing it... 
      /delay 1s 
      /varset RV_HasTarget 1 
      /varset RV_Fighting 1 
      /goto :KillAdds 
   } 
    
   /goto :Start 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Aquire Target 
|-------------------------------------------------------------------------------- 
Sub GetTarget 

   /declare RV_CurrentRadius   int local 
   /declare RV_TargetSub   int local 
   :Acquire 
   /for RV_CurrentRadius 100 to ${RV_MaxRadius} step 100 
      /for RV_TargetSub 1 to ${RV_MobArray.Size} 
         /target radius ${RV_CurrentRadius} nopcnear notid ${RV_InvalidTargetID} npc "${RV_MobArray[${RV_TargetSub}]}" 
         /varset RV_MyTargetID ${Target.ID} 
         /varset RV_MyTargetDead 0 
         /if (${Target.ID}) { 
            /if (${Int[${Target.PctHPs}]}<100) { 
               /echo Mob NOT a Full Health, picking another... 
               /varset RV_InvalidTargetID ${Target.ID} 
               /call ResetSub 
               /goto :Acquire 
            } 
            /if (${Int[${Target.Z}]}<${RV_MinZRange}) { 
               /echo Mob is BELOW Min Z Range, picking another... 
               /varset RV_InvalidTargetID ${Target.ID} 
               /call ResetSub 
               /goto :Acquire 
            } 
            /if (${Int[${Target.Z}]}>${RV_MaxZRange}) { 
               /echo Mob is ABOVE Max Z Range, picking another... 
               /varset RV_InvalidTargetID ${Target.ID} 
               /call ResetSub 
               /goto :Acquire 
            } 
            /varset RV_HasTarget 1 
            /varset RV_MyTargetName ${Target.Name} 
            /echo Acquired ${Target.Name} at range ${Int[${Target.Distance}]} 
            /return 
         } 
      /next RV_TargetSub 
      /delay 2 
   /next RV_CurrentRadius 

   /if (!${Target.ID}) { 
      /delay 2s 
      /varcalc RV_FailCounter ${RV_FailCounter}+1 
      /echo Failed to Acquire Target in Range ${RV_MaxRadius} ${RV_FailCounter} Time(s) 
      /if (${RV_FailCounter}>=${RV_FailMax}) { 
         /echo Waiting for Respawns, Resetting Failure Counter... 
         /delay 60s 
         /varset RV_FailCounter 0 
      } 
      /goto :Acquire 
   } 
/return 
  


|-------------------------------------------------------------------------------- 
|SUB: Moving 
|-------------------------------------------------------------------------------- 
Sub MoveToMob 

   /varset RV_MyXLOC ${Int[${Me.X}]} 
   /varset RV_MyYLOC ${Int[${Me.Y}]} 
   /declare RV_DistanceTimer timer 15 
    
   /doevents 
    
   :MovementLoop 

   /if ((!${RV_Fighting})&&(!${RV_TargetDead})&&(${Target.PctHPs}<100)) { 
      /echo Mob not at full health, picking another... 
      /varset RV_InvalidTargetID ${Target.ID} 
      /varset RV_HasTarget 0 
      /call ResetSub 
      /return 
   } 

   /if (${Target.ID}) { 
      /face fast 
   } 
   /if (${Int[${Target.Distance}]}>${RV_FastRange}) { 
      /keypress forward hold 
   } 
   /if (${Int[${Target.Distance}]}<${RV_FastRange}&&${Int[${Target.Distance}]}>${RV_RangeMax}) { 
      /keypress forward 
   } 
   /if (${Int[${Target.Distance}]}<${RV_RangeMin}) { 
      /keypress back 
   } 
   /if (!${RV_DistanceTimer}) { 
      /if ((${RV_MyXLOC}==${Int[${Me.X}]})&&(${RV_MyYLOC}==${Int[${Me.Y}]})) /call HitObstacle 
      /varset RV_MyXLOC ${Int[${Me.X}]} 
      /varset RV_MyYLOC ${Int[${Me.Y}]} 
      /varset RV_DistanceTimer 15 
      /goto :Movementloop 
   } 
   /if (${Int[${Target.Distance}]}>${RV_FastRange}) /goto :MovementLoop 

/return 
 

|-------------------------------------------------------------------------------- 
|SUB: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 

   /keypress esc 
   /keypress esc 
   /keypress esc 
   /keypress esc 
    
   /varset RV_HasTarget 0 
   /varset RV_TargetDead 0 
   /varset RV_Fighting 0 
    
/return

|-------------------------------------------------------------------------------- 
|SUB: Obstacle Avoidance 
|-------------------------------------------------------------------------------- 
Sub HitObstacle 

   /echo Obstacle hit, moving around it... 
   /keypress forward 
   /keypress back hold 
   /delay 3 
   /keypress back 
   /if (${Math.Rand[100]}+1>50) { 
     /keypress strafe_right hold 
   } else { 
     /keypress strafe_left hold 
   } 
   /delay 5 
   /keypress strafe_right 
   /keypress strafe_left 
   /keypress forward hold 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: GM Check 
|-------------------------------------------------------------------------------- 
Sub GMCheck 

   /if (${Spawn[gm].ID}) { 
      /beep 
      /beep 
      /beep 
      
      /echo GM has entered the zone! 
      /echo FUCK HIM but ending the macro... 

      /keypress forward 
      /keypress back 

      /quit 
      /endmacro 
   } 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Reading from an INI File 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName) 

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
   /delay 1s 
    
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues     int local  1 
   /declare nArray      int local  0 
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]} 

   :CounterLoop 
   /if (!${KeySet.Arg[${nValues},|].Length}) { 
      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop  

   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) { 
      /echo Declaring Mob Array... 
      /declare RV_MobArray[${nValues}]   string outer 
      /declare RV_MobStats[${nValues}]   string outer 
   } 
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare RV_LootArray[${nValues}]  string outer 
      /declare RV_LootStats[${nValues}]  string outer 
   } 
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["HunterMob.ini"]}) { 
         /varset RV_MobArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /varset RV_MobStats[${nArray}] 0 
      } 
      /if (${FileName.Equal["HunterLoot.ini"]}) { 
         /varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /varset RV_LootStats[${nArray}] 0 
      } 
   /next nArray 
    
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s 
    
/return 

|----------------------------------------------------------------------------------------
|TagMob
|---------------------------------------------------------------------------------------- 

Sub TagMob

   /echo Attacking Mob NOW! 
   /varset RV_Fighting 1 
   /varset RV_TargetDead 0 

    
   /doevents 
   /attack on
   /g Incoming {{{{%T}}}} get ready to kick its ass!!!
   /1 Incoming {{{{%T}}}} get ready to kick its ass!!!
   

/return




|---------------------------------------------------------------------------------------
|RunBack
|---------------------------------------------------------------------------------------

Sub RunBack

/if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call ReturnToAnchor

/return


|---------------------------------------------------------------------------------------
|ReturnToAnchor
|---------------------------------------------------------------------------------------

Sub ReturnToAnchor
    /declare iCount int local 

    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
    /varset iCount 0 

    /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 

:AnchorMoveLoop  
    /delay 1 
    /doevents 
    /face nolook loc ${AnchorY},${AnchorX} 
    
    /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
       /return 
    } 

    /if (${iCount}>2) { 
        /face nolook loc ${AnchorY},${AnchorX} 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :AnchorMoveLoop 
/return 



|-------------------------------------------------------------------------------- 
|SUB: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 

   /echo Attacking Mob NOW! 
   /varset RV_Fighting 1 
   /varset RV_TargetDead 0 
    
   :CombatLoop 
   /doevents 
   
   /attack on

    
   /call MoveToMob 
   /call SpecialIT 

   /if (!${Target.ID}) { 
      /attack off 
      /keypress forward 
      /keypress back 
      /delay 1s
      /return 
      /if (!${Target.ID}) { 
         /call ResetSub 
         /return 
      } 
      /face fast 
   } 
   /if (!${RV_TargetDead}) { 
      /goto :CombatLoop 
   } 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Special Combat 
|-------------------------------------------------------------------------------- 
Sub SpecialIt 

   /if ((${Target.Distance}<11)&&(${Me.AbilityReady["Flying Kick"]})) /doability "Flying Kick" 

   /if ((${Int[${Me.PctHPs}]}<40) && ${Me.AbilityReady["Mend"]}) { 
      /echo Mending at ${Me.PctHPs} health... 
      /doability "Mend" 

      /if (${Int[${Me.PctHPs}]}<20) { 
        /echo Getting my ass kicked, feigning death... 
        /cleanup 
        /keypress esc 
        /attack off 
        /keypress forward 
        /keypress back 
        /delay 1 
        /doability "Feign Death" 
        /beep 
        /beep 
        /endmacro 
      } 
   } 
/return

|-------------------------------------------------------------------------------- 
|SUB: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 

   /keypress esc 
   /keypress esc 
   /keypress esc 
   /keypress esc 
    
   /varset RV_HasTarget 0 
   /varset RV_TargetDead 0 
   /varset RV_Fighting 0 
   /varset MyMob 0
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Buff Check checked working
|-------------------------------------------------------------------------------- 
Sub BuffCheck 

  /echo Checking Buffs... 

:Buff
  /if (${Me.Buff["Spirit of Wolf"].Duration}<30) { 
  /1 I need sow please
  /g I need sow please
  /delay 30 
  /goto :Buff
  } else {
  /return
  }
/return


|-------------------------------------------------------------------------------- 
|SUB: TankTag checked working
|-------------------------------------------------------------------------------- 

Sub TankTag
:tag
   /if (${Target.Distance}<=100) {
   /g Tank Tag %t
   /1 Tank Tag %t
   /doability "Feign Death" 
     
   } 
   /if (${Target.Distance}>100) {
   /echo mob to far
   /delay 10
   /goto :tag
   }
/return

|-------------------------------------------------------------------------------- 
|SUB: Stand  checked working
|-------------------------------------------------------------------------------- 

:Stand
   /if (${Target.PctHPs}<=95) {
   /stand
   /echo get ready to kick some ass!!!
   /return
}

  /if (${Target.PctHPs}>=95) {
  /echo MoB still above 95%
  /delay 10
  /goto :Stand
    }

[color=cyan]|-------------------------------------------------------------------------------- 
|SUB: ChkAdds
|-------------------------------------------------------------------------------- 

Sub ChkAdds

   /declare MyMob int Global
   /varset MyMob ${Target.ID}
   /declare AD_CurrentRadius   int local 
   /declare AD_MaxRadius   int local  
   /declare AD_MyTargetID   int local
   /varset  AD_MaxRadius 400

:MoveToNext 
  
   /for AD_CurrentRadius 100 to ${AD_MaxRadius} step 100 
         /target radius ${AD_CurrentRadius} nopcnear notid ${Target.ID} npc "${RV_MobArray[${RV_TargetSub}]}" 
         /varset AD_MyTargetID ${Target.ID} 
         /goto :ChkMob


:ChKMob
/if (${MyMob.Equal[${AD_MyTarget}]}) {
    /goto :MoveToNext
    } else {
    /goto :ChkTargetsTarget
    }
:ChkTargetsTarget
    /assist
    /if (${Target.Name.Equal[${My.Name}]}) {
    /delay 15
    /call FDAdds
    } else {
    /goto :CheckRadius
    }

:CheckRadius

    /if (${AD_CurrentRadius[${AD_MaxRadius}]}) {
   /varset AD_CurrentRadius 0
   /varset AD_MyTargetID    0
   /target &{MyMob}
   } else {
   /goto :MovetoNext
   }

/return[/color]
|-------------------------------------------------------------------------------- 
|SUB: FDAdds
|-------------------------------------------------------------------------------- 

Sub FDAdds

/doability "Feign Death" 

:FDMoveToNext

   /declare FD_CurrentRadius   int local 
   /declare FD_MaxRadius   int local  
   /declare FD_MyTargetID   int local
   /varset  FD_MaxRadius 400
   
   /for FD_CurrentRadius 100 to ${FD_MaxRadius} step 100 
         /target radius ${AD_CurrentRadius} nopcnear notid ${Target.ID} npc "${RV_MobArray[${RV_TargetSub}]}" 
         /varset FD_MyTargetID ${Target.ID} 
         /goto :FDChkTargetsTarget


:FDChkTargetsTarget
    /assist
    /if (${Target.Name.Equal[${My.Name}]}) {
    /echo still have agro!!! 
    } else {
    /goto :FDCheckRadius
    }

:FDCheckRadius

    /if (${FD_CurrentRadius[${FD_MaxRadius}]}) {
   /varset FD_CurrentRadius 0
   /varset FD_MyTargetID    0
   /target &{MyMob}
   /call MoveToMob
   } else {
   /goto :FDMovetoNext
   }

/return

Posted: Thu Jun 03, 2004 5:47 am
by MoonRaverX
I'll reiterate what was said already...

Code: Select all

   /for AD_CurrentRadius 100 to ${AD_MaxRadius} step 100
         /target radius ${AD_CurrentRadius} nopcnear notid ${Target.ID} npc "${RV_MobArray[${RV_TargetSub}]}"
         /varset AD_MyTargetID ${Target.ID}
[color=red]     /goto :ChkMob[/color]
[color=green]/next AD_CurrentRadius[/color]
The line in red will ALWAYS fire, breaking the for loop anyway. If you want to to check the mob and return to the for loop, either add a tag to /goto back to, or make ChkMob a sub that you /return from.

The line in green is missing, so even if you fixed the line in red, it'll never iterate.

Posted: Thu Jun 03, 2004 11:38 am
by Chill

Code: Select all

if (${Target.Name.Equal[${My.Name}]})
Will prolly get you errors since I dont think "My" is valid. When it was Me.Name at least you didnt get errors, but it would only return true if you had yourself targetted.

If you want to check to see if a mob has you targetted, the code you want is:

Code: Select all

/if (${Me.TargetOfTarget.ID} == ${Me.ID}) {
I suppose you could use Names instead of ID's and do a string comparison, but why?

Good luck to you on the rest of the code.