/target

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

Moderator: MacroQuest Developers

the_horror
a lesser mummy
a lesser mummy
Posts: 36
Joined: Mon May 31, 2004 2:42 pm

/target

Post by the_horror » Fri Jun 04, 2004 5:52 pm

having trouble with /target. Trying to target the target of the target

*trying to snare the target once the mob drops below a certain %


when ran MQ says:

there are no spawns matching: (0-100) any null
[MQ2] NULL
The current Macro has ended

Code: Select all


Sub Main

/declare Casting string outer
/declare Delay int outer

/if (${Me.TargetOfTarget.PctHPs}<=20) /goto :Snare 


          
:Snare 
          
             /Target ${Me.TargetOfTarget.Name}
             /echo ${Me.TargetOfTarget.Name} 
             /stand 
             /g Snare on %t! 
             /varset Casting Ensnare 
             /cast "Ensnare" 
             /doevents 
             /varset Delay ${Math.Calc[${Spell[Ensnare].MyCastTime}*10+10]} 
             /delay ${Delay} 
             /if (${Sit}==1) /sit 
         


/return
 

macrolover
a ghoul
a ghoul
Posts: 107
Joined: Sun Jul 14, 2002 9:19 am

Post by macrolover » Fri Jun 04, 2004 7:19 pm

not certain on this but don't you need the group ability to use target of target? if so that would be a possibility of why it's returning that can't check becuase i don't have that ability myself. I'm not good at coding myself so can't help if that doesn't do it for you

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Fri Jun 04, 2004 7:20 pm

There are so many things wrong, I don't know where to start.

You know TargetOfTarget is not always available, right?

the_horror
a lesser mummy
a lesser mummy
Posts: 36
Joined: Mon May 31, 2004 2:42 pm

ok

Post by the_horror » Fri Jun 04, 2004 7:58 pm

when is targetoftarget avail? sorry just learning and that is what i saw in others code and that is what was suggest before. BTW thanks for the help

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Fri Jun 04, 2004 8:42 pm

Target of target is available when the leader of the group has purchased it with GoD leadership points.

Marze
a lesser mummy
a lesser mummy
Posts: 60
Joined: Wed Apr 14, 2004 12:08 pm

Post by Marze » Fri Jun 04, 2004 8:47 pm

Don't use /goto unless you have to. It leads to what we call sphagetti code. Here is the proper way:

Code: Select all

Sub Main 

/if (${Me.TargetOfTarget.PctHPs}<=20) {
   /echo ${Me.TargetOfTarget.Name} 
   /target ${Me.TargetOfTarget.Name} 
   /g Snare on %t! 
   /cast "Ensnare" 
   /doevents 
   /delay ${Math.Calc[${Spell[Ensnare].MyCastTime}*10+10]} 
   /if (${Sit}==1) /sit  | what is this? some global var?
   }       
/return
You don't need /stand anymore since they made it such that you auto stand when you cast a spell. Works on duck and FD too.

As to why its not targetting... I don't know, but I just tried Me.TargetOfTarget on someone nearby and it return NULL even though the character had me targetted. Maybe you need the ability, or maybe its not working right.