NecroFarm v0.3.0b - Basic pet class hunt/farm script

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

NecroFarm v0.3.0b - Basic pet class hunt/farm script

Post by Scrime » Sun Sep 21, 2003 10:54 pm

My first "serious" script in MQ, my thanks to GrimJack for some great ideas and examples.

This is geared towards a commandable pet class (necro, magician, BL), where the pet does most of the fighting.

Comments are welcome.

Code: Select all

|
|  necrofarm.mac - v0.3.0b 10/01/2003 by Scrime
|  Basic pet hunter script
|  	w/ some ideas borrowed from GrimJack's hunter script.
|
|  Usage: 
|   ! Have a pet up.
|   ! Put the correct spells in the spell names. 
|   ! Use /call AddToMobList to add the mobs that you want to hunt.
|   ! Use /call AddToLootList to add the items that you want to loot
|   ! Use /call AddToDontLootList to add the items that you want to destroy
|	    because they accidently get looted due to the wildcard nature of the loot list.
|  
|  Features: 
|   + Anti-KS code.  Selects targets with no other PCs within a variable radius.
| 	  Also checks to make sure the target is undamaged and is not already attacking 
|     someone else before engaging.
|   + Selective auto-looting.  Only keeps the items that you want it to.  Also has a 
|     destroy list, in the case that you are looting all "lightstones", but still want
|     to destroy "Burned Out Lightstones" (for example)
|   + Closest mob selection.  Looks through the whole list of mobs you want to hunt
|     goes after the closest one.
|   + Debugging code.  Set DEBUG to "1==1" to show debugging code, set to "0==1" to turn 
|     it off.
|   + Buff tracking.  Keeps track of buffs up on you and your pet, refreshes as nescessary.
|   + Heals your pet once it drops below 90% health.
|		+ Obstruction avoidance.  Should back up and try to go around something if it gets stuck.
| 
|  Known Issues/Limitations/Bugs:
|		- Does not know when to stop hunting.  $freeinv works for some people, crashes the client for 
|     other people.  Until it is fixed, the script will not know when you bags are full.
|  	- Does not stop to med up, stops casting spells once below 20% mana.
|   - Obstruction detection needs some tweaking, maybe an "allowance" value for being in the same spot
|     instead of waiting for the x/y locs to be the same.
|  	  
|  Release Notes for v0.3.0b :
|   * NOTE: This is considered a beta release, it still needs some more testing.  Use at you own risk, 
|     please report any problems.  Enjoy and macro responsibly.
|		* Hunt distance is now a constant (cHuntDistance) that you can set at the beginning of the script.  This 
|	    is the maxiumum distance away from you that the script will look for a new target.  Set to 99999 for no 
|     max distance.
|		* In the anti-ks code, when looking at our targets assisted target, it will look at the name and if
|     the name contains the word "corpse" it will disregard the assist and attack anyway.
|   * In the anti-ks code, if a mob it tries to target becomes invalid because it is not full health or is
|     currently attacking someone it will not be considered the next time thru the loop.
|		* Aggro'd mob protection.  If we have a mob aggro'd on us, then the script will select that mob as our next
|     target to kill AFTER we are done with out current target before doing a normal search for a hunt target.
|   * Continuous target re-evaluation.  As long as we are moving towards our target, the script will keeping 
|     looking for closer targets.  This makes it so that we wont run past newly spawned valid targets on our way
|     to our current target (which is farther away).
|   * Script now backs away from a target if it gets too close to us (too close range defined as cTooCloseRange)
|

#turbo

#define CurrTarget 				v1
#define CurrMana 				v2
#define LastPosX				v4
#define LastPosY				v5
#define OldTarget				v6

#define PetHasteStatus			v30

#define MobArraySize			v50
#define LootArraySize			v51
#define MobArrayIndex			v52
#define LootArrayIndex			v53
#define ClosestMobID			v54
#define ClosestMobDist			v55
#define HaveTarget				v56
#define ObstCount				v57
#define DontLootArraySize		v58
#define InvalidTargetID			v59

#define LootSlot				v60
#define BagsFull				v61
#define FizzleFlag				v62

| used to echo debugging messages.  set to 1=1 if you want to see them, 0==1 if you dont
#define DEBUG					1==1

| array number defines, dont change
#define cMobArrayNumber			1
#define cLootArrayNumber		2
#define cDontcLootArrayNumber 	3

| distance defines, setting these alters the behavior of the script
| cAntiKSRadius is the distance from each mob that will exclude it from selecting as a 
| target if there is another PC within this range.
#define cAntiKSRadius			50
| cAtkRange is how close we get to the mob before we send in the pet
#define cAtkRange				50
| cTooCloseRange is how close we let a mob we are attacking get to us before we start to 
| back away
#define cTooCloseRange			30
| cHuntDistance is the maximum distance away that the script will select a new target.
#define cHuntDistance			99999

| spell names
#define SelfShieldSpell		"Major Shielding"
#define PetBuffSpell		"Intensify Death"
#define PetHealSpell		"Renew Bones"

| special events to respond to
#event PetHasteDown	"Your pet's Intensify Death spell has worn off."
#event Fizzle		"Your spell fizzles!"

| MAIN =========================================================

Sub Main
	| clear out all variables.
	/zapvars

	| clear target, et al
	/press esc
	/press esc
	/press esc
	/press shift
	/press alt
	/press ctrl

	| never confirm looting nodrop items
	/lootn never

	| macro title
	/echo Starting NecroFarm v0.3.0a - by Scrime
	/if DEBUG /echo Debugging messages WILL be shown.
	/echo Attack range is cAtkRange.
	/echo AntiKS range is cAntiKSRadius.
	/echo TooClose range is cTooCloseRange.
	/echo Hunt range is cHuntDistance.

	| set up our hunting array
	/call AddToMobList "willowisp"
	/call AddToMobList "spider"
	/call AddToMobList "kodiak"
	/call AddToMobList "bear"
	
	| set up the loot array
	/call AddToLootList "quality" 
	/call AddToLootList "lightstone" 
	/call AddToLootList "silk" 
	
	| set up the dont loot array
	/call AddToDontLootList "burned out lightstone"
	
:StartHunting
	/doevents
	
	/call CastSpells
	
	/if n $HaveTarget==0 /call FindAggroTarget
	/if n $HaveTarget==0iiiiiiiiii /call MoveToTarget
	/if n $HaveTarget==1 /call KillTarget
	/if n $HaveTarget==1 /call LootTarget
		
	/if n $BagsFull==1 /goto :EndMacro
	/goto :StartHunting
	
:EndMacro
	/if n $BagsFull==1 /echo NecroFarm ended: Bags are full, go sell!
/return

| SUBS =========================================================

Sub AddToMobList
	/if "$p0"!="" {
		/varadd MobArraySize 1
		/varset a(cMobArrayNumber,$MobArraySize) "$p0"
		/if DEBUG /echo Added $p0 to the MobArray at position $int($MobArraySize).
	}
/return

Sub AddToLootList
	/if "$p0"!="" {
		/varadd LootArraySize 1
		/varset a(cLootArrayNumber,$LootArraySize) "$p0"
		/if DEBUG /echo Added $p0 to the LootArray at position $int($LootArraySize).
	}
/return

Sub AddToDontLootList
	/if "$p0"!="" {
		/varadd DontLootArraySize 1
		/varset a(cDontcLootArrayNumber,$DontLootArraySize) "$p0"
		/if DEBUG /echo Added $p0 to the DontLootArray at position $int($DontLootArraySize).
	}
/return

| ==============================================================

| FindAggroTarget
| this function targets the closest mob that is not our pet and looks to see if it has us as its
| target.  If we find a target here, then we put our pet on it and skip normally finding
| a target.
Sub FindAggroTarget
	/if DEBUG /echo Entering FindAggroTarget...
	| clear our current target
	/press esc

	| target the closest mob that is not our pet
	/target npc notid $char(pet)

	| if we have a target, then we need to see if it has a target
	/if $target()=="TRUE" {
		/if DEBUG /echo Checking closest target ($target(name), id:$target(id)) for aggro.
		/varset ClosestMobID $target(id)
		/assist
		
		| if the closest mob's target is us, then select it as our target to kill.
		/if n $target(id)==$char(id) {
			/target id $ClosestMobID
			/if DEBUG /echo $target(name) ($target(id)) is aggro'd on us, selecting as target to kill.
			/varset HaveTarget 1
			/varset ClosestMobID $target(id)
		}
	}
	/if DEBUG /echo Leaving FindAggroTarget...
/return

| ==============================================================

Sub FindTarget
	/if DEBUG /echo Entering FindTarget...

	| make sure we have nothing targeted
	/press esc
	
	| routine to find the closest, non-engaged mob from our list
	| returns nothing, but ClosestMobID will be set to the mob to engage. Keeps looking until it finds a target.
:StartFindTarget
	
	| reset the distance and ID of closest mob
	/varset ClosestMobDist cHuntDistance	
	/varset ClosestMobID 0
	/varset HaveTarget 0
	
	| go thru the list of mobs we want to hunt and find the closest one that isn't being engaged.
	/for MobArrayIndex 1 to $MobArraySize
		/target npc nopcnear cAntiKSRadius notid InvalidTargetID $a(cMobArrayNumber,$MobArrayIndex)
		/if DEBUG {
			/if $target()=="TRUE" {
				/echo Looking for $a(cMobArrayNumber,$MobArrayIndex), found $target(name,clean) (id: $target(id)), Distance: $target(distance,nopredict)			
			}
		}
		
		| check to make sure we targeted something
		/if $target()=="FALSE" /goto :SkipMob
		
		| if the target is not full life, someone else is probably fighting it, skip it
		/if n $target(hp,pct)!=100 {
			/if DEBUG /echo Target is not full life, skipping.
			/varset InvalidTargetID $target(id)
			/goto :SkipMob
		}
		
		| see if this mob is closer than the last mob we checked
		/if n $target(distance,nopredict)<$ClosestMobDist {
			/if DEBUG {
				/echo $target(name) is closer than our former target, switching.
			}
			/varset ClosestMobID $target(id)
			/varset ClosestMobDist $target(distance,nopredict)
			/varset InvalidTargetID 0
			/varset HaveTarget 1
		}

:SkipMob
	/next MobArrayIndex
	
	| if we didn't find a target, start over	
	/if n $HaveTarget!=1 /goto :StartFindTarget
	
	| re-target whichever mob was closest
	/target id $ClosestMobID
	
:EndFindTarget
	/if DEBUG /echo Leaving FindTarget...
/return

| ==============================================================

Sub MoveToTarget

	/if DEBUG /echo Entering MoveToTarget...
	| moves us to the currently target, stops once we are within our cAtkRange
	
:KeepMoving
	| constantly look for a closer target
	/call FindTarget
	/call CheckForObst

	| check to make sure our target is still alive
	/if $target()=="FALSE" {
		/if DEBUG /echo Our target died before we got to it, finding a new one.
		/sendkey up up
		/varset HaveTarget 0
		/goto :EndMoveToTarget
	}	
	
	| check to make sure our target is still full life, if not someone is probably fighting it
	/if n $target(hp,pct)!=100 {
		/if DEBUG /echo Our target started losing hp before we got to it, finding a new one.
		/sendkey up up
		/varset InvalidTargetID $target(id)
		/varset HaveTarget 0
		/goto :EndMoveToTarget
	}
	
	/face
	/sendkey down up
	
	| check to see if we are close enough yet
	/if n $target(distance,nopredict)<=cAtkRange {
		/if DEBUG /echo In range of target, stop moving.
		/sendkey up up
		/goto :EndMoveToTarget
	}
	
	/goto :KeepMoving
	
:EndMoveToTarget
	/if DEBUG /echo Leaving MoveToTarget...
/return

| ==============================================================

Sub KillTarget
	/if DEBUG /echo Entering KillTarget...
	
	| check to make sure our target is still alive
	/if $target()=="FALSE" {
		/if DEBUG /echo Our target died before we attacked it, finding a new one.
		/varset InvalidTargetID 0
		/varset HaveTarget 0
		/goto :EndKillTarget
	}	
	
	| check to make sure our target is still full life, if not someone is probably fighting it
	/if n $target(hp,pct)!=100 {
		/if DEBUG /echo Our target started losing hp before we attacked it, finding a new one.
		/varset InvalidTargetID $target(id)
		/varset HaveTarget 0
		/goto :EndKillTarget
	}
	
	| make sure our target doesnt have a target, if it does then it's attacking someone, skip it
	/assist
	/delay 1s
	/if DEBUG /echo Our target's ID=$ClosestMobID, assisted target's ID=$target(id)
	
	| check the assisted target's id, then check its name.  if the name contains "corpse", then 
	| our original target should be considered valid.
	/if n $target(id)!=$ClosestMobID /if n $instr(corpse,$target(name))==-1 {
		/if DEBUG /echo Our target had a living target, it must've been fighting someone, skip it.
		/varset InvalidTargetID $target(id)
		/varset HaveTarget 0
		/goto :EndKillTarget
	}
	
	| send our pet in
	/pet attack

	| wait until mob is dead, if it starts to flee, follow it
:MainCombatLoop
	/call CastSpells
:FollowMob
	| check to see if the mob is getting away from us, if so follow
	/if n $target(distance,nopredict)>cAtkRange {
		/if DEBUG /echo Target moved away from us, following.
		/face
		/sendkey down up
	} else {
		/face
		/sendkey up up
	}
	
	| check to see if the mob is getting too close to us, if so back off
	/if n $target(distance,nopredict)<cTooCloseRange {
		/if DEBUG /echo Target getting too close to us, backing away.
		/face
		/sendkey down down
	} else {
		/face
		/sendkey up down
	}
	
	| if we lose our target while attacking it, then the mob died.
	/if $target()=="FALSE" /goto :EndKillTarget
	/goto :MainCombatLoop

:EndKillTarget
	| make sure our pet follows us
	/pet follow
	| make sure we stop moving
	/sendkey up up
	/sendkey up down
	
	/if DEBUG /echo Leaving KillTarget...
/return

| ==============================================================

Sub LootTarget
:StartLootTarget
	/if DEBUG /echo Entering LootTarget...
	
	| target the corpse of the mob we just killed
	/target id $ClosestMobID
	
	| move up to it
	/face
:CheckCorpseDistance
	/call CheckForObst
	/if n $target(distance)>15 {
		/face
		/sendkey down up
		/goto :CheckCorpseDistance
	} else {
		/sendkey up up
	}

	| open the loot window
	/loot
	/delay 2s
	
	| check each slot (0-7) to see if its something we want to keep
	/for LootSlot 0 to 7
		/click left corpse $LootSlot
		/delay 1s

		| if there is nothing on the cursor, then we are out of loots, stop the loop
		/if "$cursor()"=="NULL" /goto :EndLootTarget
		
		/if DEBUG /echo Checking loot slot #$LootSlot: $cursor(name)

		| check whats on our cursor against the list of things we DONT want to keep
		/for LootArrayIndex 1 to $DontLootArraySize
			/if "$cursor(name)"=="$a(cDontcLootArrayNumber,$LootArrayIndex)" { 
				/if DEBUG /echo $cursor(name) matches $a(cDontcLootArrayNumber,$LootArrayIndex), destroying.
	      		/click left destroy 
	      		/delay 1s
	 			/goto :NextLoot
	   	}
		/next LootArrayIndex

		| check whats on our cursor against the list of things we want to keep
		/for LootArrayIndex 1 to $LootArraySize
			/if "$cursor(name)"~~"$a(cLootArrayNumber,$LootArrayIndex)" { 
				/if DEBUG /echo $cursor(name) matches $a(cLootArrayNumber,$LootArrayIndex), keeping.
	      		/click left auto 
	      		/delay 1s
	 			/goto :NextLoot
	   	}
		/next LootArrayIndex
		
		| if we make it to here, it means that the loot didnt match anything in our list
		| so, we destroy the object.
		/if DEBUG /echo $cursor(name) doesn't match anything in our list, destroying.
		/click left destroy
		/delay 1s
		
:NextLoot
	/next LootSlot

:EndLootTarget
	/press esc
	/varset HaveTarget 0
	
	| if our bags are full, its time to stop hunting and go sell.  For now, end the macro.
	| /if n $freeinv(space)==0 /varset BagsFull 1
	| /if DEBUG /echo Inventory space remaining: $freeinv(space) slots.
	
	/if DEBUG /echo Leaving LootTarget...
/return


| ==============================================================

Sub CastSpells
	/if DEBUG /echo Entering CastSpells...
:StartSpells

	| see if we have mana to spare
	/if n $char(mana,pct)<20 /goto :SkipSpells
	
	| decide which spell to cast
	/if	n $char(buff,"SelfShieldSpell")==0 {
		/if DEBUG /echo Trying to cast "SelfShieldSpell".
		/call NoFizzleCast "SelfShieldSpell"
		/if DEBUG /echo Delay time is: $int($calc($spell("SelfShieldSpell",casttime)*10+5))
		/delay $int($calc($spell("SelfShieldSpell",casttime)*10+5))
		/goto :StartSpells
	}
	
	| check to see if we have a pet up
	/if n $char(pet)!=0 {

		| check to see if we need to heal our pet.
		/if n $spawn($char(pet),hp,pct)<50 {
			/if DEBUG /echo Trying to cast "PetHealSpell".		
			/target id $char(pet)
			/call NoFizzleCast "PetHealSpell"
			/if DEBUG /echo Delay time is: $int($calc($spell("PetHealSpell",casttime)*10+5))
			/delay $int($calc($spell("PetHealSpell",casttime)*10+5))
			/goto :StartSpells
		}

		| check to see if we need to buff our pet
		/if n $PetHasteStatus==0 {
			/if DEBUG /echo Trying to cast "PetBuffSpell".
			/target id $char(pet)
			/call NoFizzleCast "PetBuffSpell"
			/if DEBUG /echo Delay time is: $int($calc($spell("PetBuffSpell",casttime)*10+5))
			/delay $int($calc($spell("PetBuffSpell",casttime)*10+5))
			/varset PetHasteStatus 1
			/goto :StartSpells
		}
	}
:SkipSpells	
	/target id $ClosestMobID
	/if DEBUG /echo Leaving CastSpells...
/return

| ==============================================================

Sub NoFizzleCast
	| make sure we dont get passed a null spell name
	/if "$p0"!="" {
:NoFizzleCastStart
		/varset FizzleFlag 0
		| check to make sure we have mana to cast this spell
		/if n $char(mana,cur)<$spell("$p0",mana) /goto :NoFizzleCastEnd
		
		/cast "$p0"
		/doevents Fizzle
		
		| if we fizzled, try to cast again
		/if n $FizzleFlag==1 /goto :NoFizzleCastStart
	}
:NoFizzleCastEnd
/return

| ==============================================================

Sub CheckForObst 
	/if n $char(x)==$LastPosX /if n $char(y)==$LastPosY {
		/varadd ObstCount 1
	} else {
		/varset ObstCount 0
	}
	
	/varset LastPosX $char(x)
	/varset LastPosY $char(y)
	
	/if n $ObstCount>3 {
		/call GoAroundObst
	}
/return 

| ==============================================================

Sub GoAroundObst
	/if DEBUG /echo Entering GoAroundObst...
	| back up some
	/sendkey up up
	/sendkey down down
	/delay 1s
	/sendkey up down
	
	| go left or right a bit, randomly
	/if n $rand(2)==1 {
		/sendkey down left
		/delay 5
		/sendkey up left
	} else {
		/sendkey down right
		/delay 5
		/sendkey up right
	}
	
	| move forward a bit
	/sendkey down up
	/delay 1s
	/sendkey up up
	
	/if DEBUG /echo Leaving GoAroundObst...	
/return

| EVENTS =======================================================

Sub Event_PetHasteDown
	/varset PetHasteStatus 0
/return

Sub Event_Fizzle
	/varset FizzleFlag 1
/return

Last edited by Scrime on Wed Oct 01, 2003 9:30 pm, edited 4 times in total.

md703
a lesser mummy
a lesser mummy
Posts: 34
Joined: Wed Oct 09, 2002 11:04 pm

Post by md703 » Mon Sep 22, 2003 2:31 am

awesome script, was looking for this exact script so i can hunt for some tradeskill parts.

Going to try it out tomarrow, i'll likely run into some problems while trying to figure it all out.

md703
a lesser mummy
a lesser mummy
Posts: 34
Joined: Wed Oct 09, 2002 11:04 pm

Post by md703 » Mon Sep 22, 2003 1:58 pm

whelp tested the script, it worked well, however a few things:
1) is there anyway for the script to just not loot at all the things i list, rather then looting something off the corpses and then going to destroy (which then i would have to set to destroy without notification, which is risky when using something automated)

2) I tried to get the mac to just kill the mobs i listed, but it first searched for the things i listed, then went for things i didn't list either. Heres my code that list the things i wanted to kill:

Code: Select all

   | set up our hunting array 
   /varset a(MobArrayNumber,1) "a brownie"
   /varset a(MobArrayNumber,2) "a brownie guard"
   /varset a(MobArrayNumber,4) "a brownie outcast"
   /varset a(MobArrayNumber,5) "a brownie scout"
    
   | set up the loot array 
   /varset a(LootArrayNumber,1) "brownie part" 
    
   | set up the dont loot array 
   /varset a(DontLootArrayNumber,1) "brownie torso" 
3) Its been crashing on me every time i got the message "corpse is too far too loot". Sometimes there are walls blocking the path when its trying to loot and it'll crash when i get this message.



Other then those, it works well in finding things to kill and then killing them and looting them.

md703
a lesser mummy
a lesser mummy
Posts: 34
Joined: Wed Oct 09, 2002 11:04 pm

Post by md703 » Mon Sep 22, 2003 2:43 pm

it also crashes when it tries to loot a empty corpse/slot on a corpse. However when i set it to loot everything (instead of a destroy list), macro wont crash.

I was using this modification that crashes:

Code: Select all

#define MobArrayNumber      1 
#define LootArrayNumber      2 
#define DontLootArrayNumber 3 

#define MobArraySize         1 
#define LootArraySize         1 
#define DontLootArraySize 15 

Code: Select all

   /varset a(MobArrayNumber,1) "A Mountain Brownie"
    
   | set up the loot array 
   /varset a(LootArrayNumber,1) "brownie part"

    
   | set up the dont loot array 
   /varset a(DontLootArrayNumber,1) "rat ears" 
   /varset a(DontLootArrayNumber,2) "infected rat livers"
   /varset a(DontLootArrayNumber,3) "harpy wing" 
   /varset a(DontLootArrayNumber,4) "brownie torso"
   /varset a(DontLootArrayNumber,5) "rebel clockwork arm section"
   /varset a(DontLootArrayNumber,6) "rebel clockwork wrist section"
   /varset a(DontLootArrayNumber,7) "rebel clockwork leg section"
   /varset a(DontLootArrayNumber,8) "rebel clockwork back plate"
   /varset a(DontLootArrayNumber,9) "rebel clockwork chest plate"
   /varset a(DontLootArrayNumber,10) "brownie leg"
   /varset a(DontLootArrayNumber,11) "rat tooth"
   /varset a(DontLootArrayNumber,12) "rat whiskers"
   /varset a(DontLootArrayNumber,13) "ebon drake bile"
   /varset a(DontLootArrayNumber,14) "silver earring"
   /varset a(DontLootArrayNumber,15) "Young ebon drake bile"

md703
a lesser mummy
a lesser mummy
Posts: 34
Joined: Wed Oct 09, 2002 11:04 pm

Post by md703 » Mon Sep 22, 2003 2:56 pm

As you can see i'm trying to farm steamfront for brownie parts, but the script is pretty slow if it tries to loot all the trash mobs that needs to be cleared for a brownie to spawn. The the mobs dont drop anything i need, i just need to kill them to get a brownie to spawn. What needs to be taken out of your script so i could just kill them and not loot them at all?

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Mon Sep 22, 2003 2:57 pm

md703 wrote: 1) is there anyway for the script to just not loot at all the things i list, rather then looting something off the corpses and then going to destroy (which then i would have to set to destroy without notification, which is risky when using something automated)
Not that I know of. In order for it to know what an item is (so that it can decide what to do with it) it has to put it on the cursor. Once it is on the cursor, you have to do something with it.
md703 wrote: 2) I tried to get the mac to just kill the mobs i listed, but it first searched for the things i listed, then went for things i didn't list either. Heres my code that list the things i wanted to kill:

Code: Select all

   | set up our hunting array 
   /varset a(MobArrayNumber,1) "a brownie"
   /varset a(MobArrayNumber,2) "a brownie guard"
   /varset a(MobArrayNumber,4) "a brownie outcast"
   /varset a(MobArrayNumber,5) "a brownie scout"
    
   | set up the loot array 
   /varset a(LootArrayNumber,1) "brownie part" 
    
   | set up the dont loot array 
   /varset a(DontLootArrayNumber,1) "brownie torso" 
I suspect that your problem here is that you skipped item number 3 in the MobArray. This makes it a blank entry which matches anything, thus it attacks any mob.
md703 wrote: 3) Its been crashing on me every time i got the message "corpse is too far too loot". Sometimes there are walls blocking the path when its trying to loot and it'll crash when i get this message.
Not sure what to do about this one. It should move up to the corpse after the mob is dead, least it does for me. Maybe if you could provide some additional info?

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Mon Sep 22, 2003 3:04 pm

md703 wrote:As you can see i'm trying to farm steamfront for brownie parts, but the script is pretty slow if it tries to loot all the trash mobs that needs to be cleared for a brownie to spawn. The the mobs dont drop anything i need, i just need to kill them to get a brownie to spawn. What needs to be taken out of your script so i could just kill them and not loot them at all?
I think that maybe I didn't explain how the "Dont Loot" list works.

Sometimes, due to the pattern matching, you will have something on your Loot list that will cause the script to loot an item that you don't want to keep. For instance, when I put "lightstone" in my Loot list it causes the script to loot ANYTHING with "lightstone" in the name. This includes "Burned Out Lightstone", "Lightstone", and "Greater Lightstone". In order for it to not keep the "Burned Out Lightstone", I have to put it in the "Dont Loot" list.

If an item does not match the Loot list (which uses pattern matching), then it will be destroyed. If an item does match the Loot list, but also matches the Dont Loot list, then it will be destroyed. Otherwise, it will be kept.

If in your case you are trying to keep anything with "brownie" in the name, then just add a "brownie" entry to the Loot list and nothing to the Dont Loot list. If you want to match anything brownie, but dont want to keep brownie legs, then add "brownie" to the loot list and add "brownie leg" to the dont loot list.

Have I totally confused you yet? :)

md703
a lesser mummy
a lesser mummy
Posts: 34
Joined: Wed Oct 09, 2002 11:04 pm

Post by md703 » Mon Sep 22, 2003 7:25 pm

i understood that perfectly. I'll have to test out some of the things you just said when i get home.

What has been happening after i editted the script to only loot certain things or not loot certain things has been crashes. So i just gave up on the whole destroy option and somehow made it just loot everything, which seems to fix the crashing problem. Also To speed farming up a bit, i've took out " /if n $HaveTarget==1 /call LootTarget ".

So it would basically kill something and move on without looting. I watch it so when it does kill a brownie, i end the macro and loot it manually. Seems to work okay.

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Wed Sep 24, 2003 1:12 pm

Looks like the multi-line comment section at the top was messing up the script some how.

Changed it to use single-line comment style, should fix the problem some were having with "Can't call when not running a macro".

User avatar
FreQuency
a hill giant
a hill giant
Posts: 215
Joined: Tue Sep 23, 2003 6:03 pm

Post by FreQuency » Wed Sep 24, 2003 4:10 pm

hey Scrime
i'd like to borrow/steal some of your obstruction code for a groundspawn collecter im writing you'll be mentioned in comments up top

I tweaked it around abit and it seeming to work ok for me gota put it to the real test though yet but prelim results seem ok

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Wed Sep 24, 2003 4:26 pm

Quite honestly I got most of the code or ideas for the code for that section from GrimJacks hunter script. I did clean it up a bit and make some minor mods, but if credit is due, it is due to GrimJack.

It still needs to be fixed (which you may have already done), as it sees that it is stuck but doesn't back up correctly. Prolly get fixed tonight, with some other mods, including enabling it to cast spells during combat.

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

v0.2.8 is up

Post by Scrime » Wed Sep 24, 2003 9:33 pm

Release Notes for v0.2.8 :
* Made adding things to hunt, loot, and dont loot easier (and safer). It keeps track of how many items are in the lists for you. No need to manually set list size.

* Obstruction avoidance should be working now.

* Optimized pet monitoring. No more need to target ole Gebartik to check his health.

* Made it easier to change the name of the spells used in the macro

* Should be casting spells between and during fights. Needs to be tested though.

* Now tries to recast spells if they fizzle, as long as you have mana.

Snappahead
orc pawn
orc pawn
Posts: 19
Joined: Sun Oct 27, 2002 4:41 am

Post by Snappahead » Fri Sep 26, 2003 11:16 am

First off, thanks for creating the script, it is very handy for studying/working/doing other things while farming crap. One feature I wanted to see if you could incorporate would be to have your pet attack a mob that hits you. I have been collecting stuff from Nethebrian drones and their buddies and one will often aggro on me while my pet is killing another. The pet automatically hits it because it has hit me, but then the macro seems to get a bit "confused".

Because the mob is below 100 percent health, it does not want to target the mob (part of the anti-ks code). Is there any way you could get it to skip the anti-ks loop if you have been hit by a mob, and engage the mob till it is dead, then begin looking for another target?

GuardianX99
a lesser mummy
a lesser mummy
Posts: 43
Joined: Tue Dec 31, 2002 6:31 pm
Contact:

Post by GuardianX99 » Tue Sep 30, 2003 6:57 pm

Personaly what I did was comment out the Anti KS part but left the code in place incase I needed to turn it back on. Pet Should auto attack anything that hits you unless you eidted it to use /pet hold.

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Wed Oct 01, 2003 11:07 am

I've been sitting on v0.3.0 that should take care of killing the things that attack you. It still needs a bit of testing and I didn't want to release something that was broken. Expect to see it out some time this week.