Page 1 of 1

ranger auto-harmony

Posted: Thu Aug 12, 2004 3:38 pm
by Mimatas
Okay.. I've seen requests for it.. but never implementation. This is a VERY rough, untested, poorly debugged piece of code... but I wanted input as to whether or not it would work.

Code: Select all

 
   /declare spawnnum int outer 1
   /declare targ int outer 0 
   /declare range int outer 20 

Sub Harmony    
 
   |Auto-harmonies mobs within a certain range of your target 
   |Directions: have a mob targeted, run the snippet, 
   |by the end of the code all of the mobs should be harmonied and your 
   |target ready to pull. 
	
   /varset targ ${Target.ID} 
   /varset spawnnum 1 
		
   :harmonyLoop 

   /if ( ${Spawn[${targ}].NearestSpawn[${spawnnum}, npc radius ${range}].ID} ) { 
      /target ${Spawn[${targ}].NearestSpawn[${spawnnum}, npc radius ${range}]} 
      /call Cast "Harmony of Nature" 
      /delay 55
      /varset spawnnum ${Math.Calc[${spawnnum}+1]} 
      /echo incremented, retargeting ${targ}
      /goto :harmonyLoop 
   } 
   /target id ${targ} 
/return
This is my first attempt to actually do something productive... I'm open to ideas/criticisms. Sorry for posting here, but it really IS more of a snippit than a macro... and will eventually be edited to become a real snippet.

edit 8/13/2004 - added blueninja's suggestion to use ${Spawn[${targ}].NearestSpawn} rather than ${Target.NearestSpawn}

edit 8/12/2004 - Untested generalized version of code that did work (changed mob name to 'radius ${range}' to work at a camp other than my specific camp}

The mob must be targeted when this is called.

I'd be interested in any feedback anyone has. The version I tested had the meat of this placed into a sub, rather than as a sub itself.

I'm also not sure if ${Target.NearestSpawn[${spawnnum}, npc radius ${range}].ID} will 1. evaluate correctly, and 2. evaluate within a 20 unit radius of me, or of the mob. Initial testing makes me think the mob, but I'm not sure.

Feedback would be good.

Posted: Thu Aug 12, 2004 6:09 pm
by hiipii
Pinnochio.inc tells you, 'I wish i were a real snippet!'

sorry bout that

first prob i see is that spawnnum is never declared. Maybe it doesn't need to be? iono..yea

Posted: Thu Aug 12, 2004 6:10 pm
by hiipii
oh yea and there are no subs

and i think

Code: Select all

 /varset spawnnum ${Math.calc[spawnnum+1]}
should be

Code: Select all

 /varset spawnnum ${Math.Calc[${spawnnum}+1]}
but im not quite sure

and as far as i can tell inner is not a valid type for a variable. loacal > outer > global

Posted: Thu Aug 12, 2004 6:20 pm
by Mimatas
It's less of a .inc and more of a copy/paste piece of code.

Right now, it's in the middle of a sub for a macro I'm using. I added the #include to show that you had to have that .inc file.. but otherwise, it's not intended to be its own sub. Yet. I simply haven't achieved quite that much mastery of the macro language.

Good catch on the Math.Calc thing though. I'll edit to fix that right now.

Any logical problems? Reasons it wouldn't work as intended? More efficient ways of doing this?

Posted: Thu Aug 12, 2004 7:36 pm
by Fippy
not sure that would work. Wouldnt you end up harmonying forver with that? I think youd prolly be better adding all the id's of the spawns around your target spawn to an array then loop around that array and harmony them.

Posted: Thu Aug 12, 2004 8:00 pm
by Mimatas
Spawnnum increments, and NearestSpawn has a range... so it *should* (theoretically) return false once you're out of spawns within the range... I'll have to try that and see.

Posted: Thu Aug 12, 2004 8:02 pm
by Mimatas
Just tried it by targeting a mob in PoTranq and /echoing it. It will return null once the next nearest spawn is out of the range.

Posted: Fri Aug 13, 2004 10:09 am
by blueninja
Fippy is right. The problem is that you use ${Target.NearestSpawn} and you keep changing targets. What you need to do is save the ID of the original target, then use ${Spawn[${OriginalID}].NearestSpawn} instead.

Posted: Fri Aug 13, 2004 11:37 am
by Mimatas
hmm.. it worked when I tried it.. but I wasn't trying to pull a specific mob, I was just happy it harmonied all of them. I'll change that now.

Posted: Sat Aug 28, 2004 1:19 pm
by ins
Very very nice. Will start working this into my hunter.

Posted: Mon Sep 20, 2004 5:38 pm
by loadingpleasewait
Does this snippet work now? I'd like to add it to my Arch.mac, but wanna know if it works first..


:EDIT: Tried it out, and it does indeed work. Included in the newest Arch.Mac found in the Macro Depot.