small bug.. take a look at this Assist-Melee Macro

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

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

small bug.. take a look at this Assist-Melee Macro

Post by eqjoe » Thu Oct 31, 2002 11:45 pm

:roll:

This works, however every OTHER time the event fires the target is NULL.

Anyone have an idea as to why?

Code: Select all

| Melee Assist Macro .
| Attack on Assist request 


#event AssistAF "Assist me"

Sub Main
 
 /varset v30 $p0
 


:Start

/delay 1
/doevents 
/goto :Start

/return

sub CombatAF
 :CloserAF 
   /if "$target(id)"!="$v1" /goto :EndAF 
   /if n $target(distance)>20 /sendkey down up 
   /if n $target(distance)<11 /sendkey down down 
   /if n $target(distance)<21 /sendkey up up 
   /if n $target(distance)>10 /sendkey up down 
   /doability 9 
   /doability 8 
   /doability 7 
   /face 
   /goto :CloserAF 
  
 :EndAF 
   /echo $v0 is dead 
   /sendkey up up 
   /sendkey up down 
   /attack off 
   /varset v0 0 
   /varset v1 0
/return

sub Event_AssistAF

   /assist $v30
   /echo assisting $v30 
| the next line echos "Fighting NULL. It is level 0." every OTHER time it runs
   /echo Fighting $target(name). It is level $target(level). 
   /varset v0 $target(name) 
   /varset v1 $target(id) 
   /face 
   /sendkey down up 
   /attack on 
   /call CombatAF
/return


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

Post by eqjoe » Wed Nov 06, 2002 11:47 pm

Ok... Figured this one out.. it was simple enough.

The fix was to add a delay after the /assist and before the /varset.
Here is the working macro.

Code: Select all

| Melee Assist Macro . 
| Attack on Assist request 
| useage /macro af <name of person to assist>
| Bot assists when a tell or group tell is send to trigger event
|

#event AssistAF "Assist me" 

Sub Main 

/varset v30 $p0 



:Start 
/doevents 
/goto :Start 

/return 

sub CombatAF 
:CloserAF 
   /if "$target(id)"!="$v1" /goto :EndAF 
   /if n $target(distance)>20 /sendkey down up 
   /if n $target(distance)<11 /sendkey down down 
   /if n $target(distance)<21 /sendkey up up 
   /if n $target(distance)>10 /sendkey up down 
   /doability 9 
   /doability 8 
   /doability 7 
   /face 
   /goto :CloserAF 
  
:EndAF 
   /echo $v0 is dead 
   /sendkey up up 
   /sendkey up down 
   /attack off 
   /varset v0 0 
   /varset v1 0 
/return 

sub Event_AssistAF 

   /assist $v30 
   /echo assisting $v30 
   /delay 2
   /echo Fighting $target(name). It is level $target(level). 
   /varset v0 $target(name) 
   /varset v1 $target(id) 
   /face 
   /sendkey down up 
   /attack on 
   /call CombatAF 
/return 
Last edited by eqjoe on Fri Nov 08, 2002 1:44 am, edited 1 time in total.

User avatar
rizwank
Huggle Police
Huggle Police
Posts: 524
Joined: Tue Jul 23, 2002 12:07 am
Contact:

Post by rizwank » Thu Nov 07, 2002 2:54 am

nice.

Id add like 4 triggers just so its less obvious if you are in a group or if vi is watching.
#macroquest op
Macroquest Official Documentarion
Macroquest Board Moderator
All around cool guy

[img]http://medicomuerte.users.btopenworld.com/images/fairy_bounce08.gif[/img]