question about this snippet.

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

Moderator: MacroQuest Developers

3djoker
a hill giant
a hill giant
Posts: 167
Joined: Thu Jun 24, 2004 11:19 pm

question about this snippet.

Post by 3djoker » Wed Jul 14, 2004 8:50 pm

ok, im toying around with trying to make my own macro, just wanna see if i can do it and get some hands on.

i want to use this snippet from "quick"

Code: Select all

#turbo 

Sub Main 

  
:loopstart 
/if (${Target.Distance}>220) /keypress esc 
/if (${Target.ID}==FALSE) /tar NPC radius 220 
/delay 10 
/goto :loopstart 
/return
now, my question is, will this just do a constant loop till it finds a target then stop when it has a target until i need a new target? or will it continue to change targets?

if i'm thinking right, when the target =false (no target) it will look for one in that range (radius 220). once it is target=true (you have a target) it will stop searching till you no longer have a target.

also, my next question... if i put this in the middle of a macro, once it obtains a target, will it continue on with the rest of the macro? what is really confusing me at this point is....

Code: Select all

/delay 10 
/goto :loopstart 
/return
im not sure if putting this in the middle of a macro will just get it stuck on targeting or will continue on with the mac.

thanks for any help.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 14, 2004 8:55 pm

First I will admit I know jack, I am learning.

I would think that this would be something that you would call from a script when target dies. Such as You have gained experience, or If targt=null, then you would do event aquiretarget.

Wish I knew enough to put it into code, but I think you'll get the idea.

3djoker
a hill giant
a hill giant
Posts: 167
Joined: Thu Jun 24, 2004 11:19 pm

Post by 3djoker » Wed Jul 14, 2004 9:18 pm

ok what im trying to do is take a part out of a macro that someone made already, i'm using chant.mac. when it kills a mob, it checks for agroed mobs to target next.

what happens alot of time, is if i have a bunch of junk on me, it will sometimes turn towards the mobs on tail and target something, and cuase me to get hit, then i have to fade and start over. OR sometimes i will have a few mobs on me and it won't target anything even though i have stuff in trail.

so what i want to do is, just take all the code out for trying to figure out what to target next, and just use this snippet for targeting instead, since i know what is on me already, and don't need to turn around to see what it is, i want to prevent having to fade when it decides to turn back on itself.

here is the section of the code (i think) that i want to replace with this snippet....

Code: Select all

/if (${Target.ID}) { 
/varset CirX ${AnchorY} 
/varset CirY ${AnchorX} 
} else { 

/if (${TargetUpNext}!=0) { 

/varset CirX ${AnchorY} 
/varset CirY ${AnchorX} 

/if (${Spawn[ID ${TargetUpNext}].Distance}<=${Math.Calc[${CirR}*2]}) { 
/if (${Target.ID}) { 
/if (${Target.ID}!=${TargetUpNext}) { 
/target id ${TargetUpNext} 
} 
} else { 
/target id ${TargetUpNext} 
} 
/varset TargetUpNext 0 
} 
} 
} 

/if (${Math.Distance[${CirX},${CirY}]}<${Math.Calc[${CirR}/2]}) { 
/face heading ${Math.Calc[${Heading[${CirX},${CirY}].DegreesCCW}+180]} 
} else { 
/face heading ${Math.Calc[${Heading[${CirX},${CirY}].DegreesCCW}+${Math.Calc[90*${CirR}/${Math.Distance[${CirX},${CirY}]}]}]} 
} 
/return 

Sub SongFailed 
/if (!${PrevSong}) { 
/varset SongTimer 1 
/return 
} 
/varset CurSong ${PrevSong} 
/varset SongTimer 1 
/return 

Sub Event_NeedTarget 
/if (${TargetUpNext}<=0) /call GetTarget 
/return 

Sub Event_Died 
/delay 20 
/sit 
/delay 20 
/camp desktop 
/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 
im not sure how to call the proccess to get it to just target something inside of a certain radius, and then have it start casting the chants again when it has a target.