Help with ks'ing.

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Guest

Help with ks'ing.

Post by Guest » Wed Dec 03, 2003 8:22 pm

Hi guys. Im having problems running the hunter.mac. It works wonderfully, and sometimes too good. I cant seem to think of what lines I could add to make it so I would NOT engage a mob if its allready being fought. If anyone could tell me a few lines I could add to stop myself from ks'ing allready engaged mobs it would be greatly appreciated. Thank you.

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Wed Dec 03, 2003 9:23 pm

Increase the KSRadius variable to a larger setting and add the following code:

Code: Select all

sub GetTarget
	:Aquire
	/target nopcnear @KSRadius npc "@MainArray(2,$rand(@MobArraySize))"
	/varset MyTarget $target(id)
	/varset TargetDead 0
	/if n $target(id)==0 /goto :Aquire
	[color=red]/if n $target(hp)<=95 /goto :Aquire[/color]
	/if $target()=="False" /goto :Aquire
	/varset HasTarget 1
	/varset MobToHunt $target(name)
/return
This code change will make it ignore any mobs with 95% health or less, since mobs with less than max HP's are most likely already being attacked by someone/something.
Opinions are like assholes, everyone has one, but most of them stink.

Guest

Post by Guest » Wed Dec 03, 2003 10:23 pm

Thanks GD :)

Diggler
> Oid
Posts: 120
Joined: Thu Oct 09, 2003 3:28 pm
Location: Lexington, KY

Post by Diggler » Wed Dec 03, 2003 11:58 pm

Good strat but still faulty, as a mob can easily be engaged in the time it takes you to get to it, especially spiders in EK, etc. I've been tinkering with some ks protection that checks % right before you engage, but it's not done yet.

Catt
a lesser mummy
a lesser mummy
Posts: 76
Joined: Mon Sep 16, 2002 2:49 am

Post by Catt » Thu Dec 04, 2003 1:31 am

Maybe /assist and check to see if you still have the same target?

Bio_War
a lesser mummy
a lesser mummy
Posts: 36
Joined: Sun Sep 29, 2002 1:03 pm

Post by Bio_War » Thu Dec 04, 2003 6:57 am

ok, here is what I have come up with, its pieced to gather from of course grimjack( most of it), mamba666 for the /alert mob prioritizing, and additional ks code and buffing by Jon100.

The only problem, and maybe some of the devs could check this out is that the final ks code is kind of wierd, I used /if n $searchspawn(pc,radius:100)!=0, to Idendtify the closest mob to me, and return a value if there is a pc near, the problem is with this, is that no matter how close a pc is to the mob, if the radius value is below 100, it will ALWAYS return 0 and attack the mob.

Hope this helps you, it has been working great for me, in over 80 hours of running it, I have not recieved 1 tell about KSing.

Bio

Code: Select all

| hunter.mac
| v3.1
| Hunt script with loot for new loot parser.
| As always much of this script is inspired or taken directly from
| pieces of macro's found at macroquest2.com's macro depot
| Thank you to all the people who have donated their scripts which
| made this possible.  And thank you to the MQ developers.
|
| Edit  /varset MainArray(1,0) "silk" and /varset MainArray(1,1) "skin"
| Also edit /varset MainArray(2,0) "widow" and /varset MainArray(2,1) "wolf"
| You can also make these arrays bigger.  If you want to search for
| wolfs, widows and orcs you would have this
| /varset MainArray(2,0) "widow"
| /varset MainArray(2,1) "wolf"
| /varset MainArray(2,2) "orc"
| /varset MobArraySize 3
| This picks a random number based on MobArraySize to pick which
| Type of mob it will chose from the array.
|
| What type of loot you want can be expanded in a similar way to
| the mobs you want to hunt.  Just add your array entry and update
| /varset LootTotal 2 to be /varset LootTotal [# of loot entries]
|
| Another thing, for the code to actualy destroy items you don't want to
| keep you must have fast item destroy turned on in the game.  I would
| test the script for a while on your machine before doing this.  It would
| really suck if it picks up your Eyepatch of Plunder and destroies it
| due to a bug.

|#turbo 90

Sub Main
   /declare MobToHunt global
   /declare MainArray array2
   /declare MyXLOC global
   /declare MyYLOC global
   /declare KSRadius global
   /declare NotSee global
   /declare TooFar global
   /declare MyTarget global
   /declare TargetDead global
   /declare HasTarget global
   /declare ObstCount global
   /declare LootSlot global
   /declare CheckLoot global
   /declare LootTotal global
   /declare MobArraySize global
   /declare RangeMax global
   /declare RangeMin global
   /declare FastRange global
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl
   /varset RangeMax 8
   /varset RangeMin 4
   /varset FastRange 10
   /varset LootSlot 0
   /varset CheckLoot 0
   /varset MainArray(1,0) "pelt"
   /varset MainArray(1,1) "ears"
| Add as many of these  as you want but make sure you
| increase LootTotal
   /varset LootTotal 2
   /varset KSRadius 60
   /varset HasTarget 0
   /varset ObstCount 0
   :Start
   /call CheckBuffs
   /call SetAlerts
   /call GetTarget
   /if @HasTarget=="1" /call MoveToMob
   /if @HasTarget=="1" /call CombatSub
   /if @HasTarget=="1" /call MoveToMob
   /if @HasTarget=="1" /call LootMob
   /call ResetSub
   /goto :Start
/return


sub SetAlerts
/alert clear 1
/alert clear 2
/alert clear 3
|/alert clear 4

| Rare (Most important)
/alert add 1 npc radius 1000 nopcnear @KSRadius "rat"

| Uncomon (next most important)
/alert add 2 npc radius 700 nopcnear @KSRadius "Bear"
/alert add 2 npc radius 700 nopcnear @KSRadius "Spider"
/alert add 2 npc radius 700 nopcnear @KSRadius "Puma"

| Common (every day stuff)
|/alert add 3 npc

| Scarry (Stay away from)
| /alert add 4 npc radius 10 corpse

/return


Sub MoveToMob
   /face
   /if n $target(distance)>=@FastRange /call Fastmove
   /if n $target(distance)>@RangeMax {
      /press up
   }
   /if n $target(distance)<@RangeMin {
      /press down
   }
/return

sub GetTarget
   :Aquire
/if "$alert(1)"=="TRUE" {
/target npc alert 1 nopcnear @KSRadius
} else /if "$alert(2)"=="TRUE" {
/target npc alert 2 nopcnear @KSRadius
} else {
/target npc alert 3 nopcnear @KSRadius
}
   /varset MyTarget $target(id)
   /varset TargetDead 0
   /if n $target(id)==0 /goto :Aquire
   /if $target()=="False" /goto :Aquire
   /varset HasTarget 1
   /varset MobToHunt $target(name)
/return 

Sub Fastmove
   /varset MyXLOC $char(x)
   /varset MyYLOC $char(y)
   /varset ObstCount 0
   :fastmoveloop
   /if $target()=="FALSE" {
      /sendkey up up
      /if $combat=="TRUE" {
         /attack off
         /return
      }
   }
   /face
   /if n $target(distance)>@FastRange {
      /sendkey down up
   }
   /if n $target(distance)<=@FastRange {
      /sendkey up up
      /return
   }
   /varadd ObstCount 1
   /if n @ObstCount>=3 {
      /call CheckObst
   }
   /goto :fastmoveloop
/return

sub CombatSub
   /if $target()=="FALSE" {
      /varset HasTarget 0
      /return
   }
   | Check no PCs are in KSradius still
   /delay 1s
   /if n $searchspawn(pc,radius:100)!=0 /goto :WeKilledIt 
   /attack on
   :combatloop
   /face
   /if $char(class)==Ranger /call BackstabIt
   /call MoveToMob
   /face
   /if n $target(id)==0 /varset TargetDead 1
   /if n @TargetDead!=1 /goto :combatloop
   /sendkey up up
   /delay 1s
   /target corpse
   /delay .5s
 :WeKilledIt
/return

sub LootMob
   /loot
   /delay 1s
   :lootloop
   /if n @LootSlot>=9 /goto :doneloot
   /click left corpse @LootSlot
   /delay 1s
   /if "$cursor()"!="TRUE" /goto :doneloot
   :lootChecker
   /if "$cursor(name)"~~"@MainArray(1,@CheckLoot)" {
      /delay .5s
      /auto
      /echo Keep
      /delay .5s
      /varadd LootSlot 1
      /goto :lootloop
   }
   /varadd CheckLoot 1
   /if "$cursor()"=="TRUE" {
      /if n @CheckLoot<@LootTotal /goto :lootchecker
   }
   /if "$cursor()"=="TRUE" {
      /delay .5s
      /destroy
      /echo Destroy
      /delay .5s
   }
   /varadd LootSlot 1
   /varset CheckLoot 0
   /goto :lootloop
   :doneloot
   /varset LootSlot 0
/return

sub ResetSub
   /sendkey up up
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl
   /varset CheckLoot 0
   /varset HasTarget 0
   /varset ObstCount 0
   /delay 1s
/return

sub CheckObst
   /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) /call HitObst 5
   /varset MyXLOC $char(x)
   /varset MyYLOC $char(y)
   /varset ObstCount 0
/return

sub HitObst
   /sendkey up up
   /sendkey down down
   /if n $rand(99)>50 {
      /delay 1s
      /sendkey up down
      /sendkey down Right
      /delay @Param0
      /sendkey up Right
      /sendkey down up
      /delay 1s
      /sendkey up up
   } else {
      /delay 1s
      /sendkey up down
      /sendkey down left
      /delay @Param0
      /sendkey up left
      /sendkey down up
      /delay 1s
      /sendkey up up       
   }
   /sendkey up down
   /sendkey up Right
   /sendkey up Left
   /sendkey down up
/return

Sub BackstabIt
   /if n $char(ability,"kick")!=-2 {
      /if $target()=="TRUE" {
         /face
         /doability "kick"
      }
   }
/return

Sub CheckBuffs

  /call SelfBuff "spirit of wolf"
  
/return



Sub SelfBuff

  /if n $char(buff,"@Param0")==0 {
    /target myself
    /delay .5

    /cast "@Param0"
    /delay "$calc($spell("@Param0",casttime)+4.5)"s

    /press esc
  }
/return 

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Thu Dec 04, 2003 7:39 am

The best code I have seen assists the mob then checks to see if the target is an NPC if so the mob is not engaged.

Anyone know what the farthest range you can assist the mob and get that info??

Thanks!

wrangler
a ghoul
a ghoul
Posts: 93
Joined: Fri Nov 28, 2003 3:07 pm

Post by wrangler » Thu Dec 04, 2003 9:26 am

""| Scarry (Stay away from)
| /alert add 4 npc radius 10 corpse "

does this code avoid npc's? i use this fabulous macro to farm for pelts in EK, and there is a particularly mean hill giant that sometimes roams.

will /alert add 4 tarbul radius 100
prevent me from acquiring a target that is within that radius of him?

thanks

Bio_War
a lesser mummy
a lesser mummy
Posts: 36
Joined: Sun Sep 29, 2002 1:03 pm

Post by Bio_War » Thu Dec 04, 2003 5:19 pm

ya know, I was wondering about that myself, it seems that mamba666 never finished that part of his noclickhunt macro which is where I got it from, if somebody can complete it, cool, not sure how to do it myself. as for the anti ks code in there, each alert checks a ks radius when aquiring a mob, this however does not account for the time it takes to get to the mob after it has been targeted, so after we get to tme mob, the macro delays for 2 seconds, then checks again for a ks radius on the mob, if a pc other than youself is within the ks range, it will aquire a new target,

Bio

merkzu
a ghoul
a ghoul
Posts: 99
Joined: Wed May 14, 2003 2:08 pm

Post by merkzu » Thu Dec 04, 2003 5:26 pm

Just right before you engage it, /assist it and see if the target changed. If it changed to something other than the mob or yourself, it is already engaged.

Guest

Post by Guest » Thu Dec 04, 2003 8:56 pm

That sounds like a good idea to /assist the mob to see if its engaged considering some ppl cast snare or slow to pull and checking the mob to see if its below a certain percentage of health wont work to tell if its been engaged. Is there any way to write a few lines that would leave the mob if /assist shows another pc other than yourself?

elretardo
a lesser mummy
a lesser mummy
Posts: 36
Joined: Thu Oct 16, 2003 3:24 am

Post by elretardo » Fri Dec 05, 2003 6:01 pm

Code: Select all

  /declare OriginalMob global

  /varset OriginalMob $target(name)
  /assist
  /if $target(name)!=@OriginalMob /press esc
Should reset to aquire automatically if the mob is engaged. Fairly simple, pretty accurate. Of course, you'll always run into the problem of the whiners who will say, "I WAS CASTING ON IT WHEN YOU TOOK IT!"

No real substitute for human behavior when trying to work ks related stuff. Everyone has an opinion and they all suck.
I must go, for there they go and I am their leader.

merkzu
a ghoul
a ghoul
Posts: 99
Joined: Wed May 14, 2003 2:08 pm

Post by merkzu » Fri Dec 05, 2003 8:41 pm

if you use that code you will want to modify it in case the mob aggro'd you while doing the ks check

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Fri Dec 05, 2003 10:59 pm

Code: Select all

  /declare OriginalMob global 
  /varset OriginalMob $target(name) 
  /assist 
  /if $target(name)!=@OriginalMob /press esc
It'd probably be a better idea to use $target(id), cause if you use just $target(name), you have the possibility of it giving false positives on mobs of the same name, like a charmed pet for example.

* * OFF TOPIC * *
elretardo wrote:Everyone has an opinion and they all suck.
That's pretty close to my sig, hehe.
Opinions are like assholes, everyone has one, but most of them stink.

User avatar
a_troll_01
a lesser mummy
a lesser mummy
Posts: 46
Joined: Sat Dec 06, 2003 6:06 am
Location: Memphis, TN
Contact:

Post by a_troll_01 » Fri Dec 19, 2003 4:59 am

*EDITED: Added the /declares I somehow managed to leave out, highlighted in red text.*


I modified a few things in Bio's code, and added some small tweaks here and there for us Rogues. I ran this macro for 5 hours in WC (Leveled a rogue from 11-14) without any trouble aside from obvious enviromental stuff, like the lake in the middle of the zone sans EB item. As always, play with the code, have some fun, learn some stuff, rip it to shreds, and for the love of MQ, please DO NOT AFK while running it.

Good luck, lemme know what you think. This is my first big project for MQ, I spent hours and hours scripting and debugging this. Lots of fun, though, and learned alot. Thanks for the support.

<-- CHANGES -->
*If you're under 40% health, you'll automatically (granted you have the mad skillz) Hide yourself (If Hide fails, retry until you are indeed hidden), bind wound to 50%, sit and regen HP to 100% (complete with agro-detection/elimination in case for some reason something sees past hide), then hop up and continue hunting.
* Edited the Sub Backstabit to actually Backstab (Bio had his set to Ranger compatibility) as well as Pick Pocket for skills training.
*Added variables to set for Lowest and Highest level mobs to hunt, configurable only in the *.mac (No command line yet, and no intention of adding it since you have to configure the Alerts every time you need to change the Min/Max Level anyway.)
*This particular code has the loot parser sort'a skipped (look at the loot array for the obvious method), since (at least for me) all these hunting scripts in MQ2 are occasionally deleting loot I actually wanted to keep. So, now, everything is looted (quickly, at that) and you have to sort it out later. Now, I mention this, because aside from changing the array variables, I also hacked apart the Sub Loot to go much faster.
*Added some code to use a ranged weapon when close enough to use them.
*Changed KS code a bit in the process of the above. You'll no longer pause when doing a $search command for PC's around you. You'll check on-the-fly then use your ranged weapon, all in the close approach. Also did some junk to make the possibility of KS'ing anyone even smaller.
*Tweaked the code for Adds during battle and such. It used to be where if you got an add, you'd run away to the nearest corpse. Fixed that by just moving a command up a few lines around :HaveMob.
*A few tweaks to make movement more fluid, at the cost of looking *very slightly* more robot-like.
*Took out the Radius check from /alerts. At the cost of, again, being more obviously robotic. (targetting stuff across the zone).
*Added in a section to dump cursor contents into inventory before attempting to loot, in case you have Forage bound to a Hotbutton, or have Pick Pocketed items on your cursor.
*Cleaned stuff up in general to be more organized and easier to read.
*Some other stuff I'm forgetting ...

Code: Select all

 

| hunter.mac 
| v3.1 
| Hunt script with loot for new loot parser. 
| As always much of this script is inspired or taken directly from 
| pieces of macro's found at macroquest2.com's macro depot 
| Thank you to all the people who have donated their scripts which 
| made this possible.  And thank you to the MQ developers. 
| 
| Edit  /varset MainArray(1,0) "silk" and /varset MainArray(1,1) "skin" 
| Also edit /varset MainArray(2,0) "widow" and /varset MainArray(2,1) "wolf" 
| You can also make these arrays bigger.  If you want to search for 
| wolfs, widows and orcs you would have this 
| /varset MainArray(2,0) "widow" 
| /varset MainArray(2,1) "wolf" 
| /varset MainArray(2,2) "orc" 
| /varset MobArraySize 3 
| This picks a random number based on MobArraySize to pick which 
| Type of mob it will chose from the array. 
| 
| What type of loot you want can be expanded in a similar way to 
| the mobs you want to hunt.  Just add your array entry and update 
| /varset LootTotal 2 to be /varset LootTotal [# of loot entries] 
| 
| Another thing, for the code to actualy destroy items you don't want to 
| keep you must have fast item destroy turned on in the game.  I would 
| test the script for a while on your machine before doing this.  It would 
| really suck if it picks up your Eyepatch of Plunder and destroies it 
| due to a bug. 

#turbo


Sub Main 
   /declare MobToHunt global 
   /declare MainArray array2 
   /declare MyXLOC global 
   /declare MyYLOC global 
   /declare KSRadius global 
   /declare NotSee global 
   /declare TooFar global 
   /declare MyTarget global 
   /declare TargetDead global 
   /declare HasTarget global 
   /declare ObstCount global 
   /declare LootSlot global 
   /declare CheckLoot global 
   /declare LootTotal global 
   /declare MobArraySize global 
   /declare RangeMax global 
   /declare RangeMin global 
   /declare FastRange global 
   /declare RangedCommand global
[color=red] /declare LowLevel global
   /declare HighLevel global
   /declare ThrowRange global
   /declare WaitForAdds global[/color]

   /press esc 
   /press esc 
   /press esc 
   /press esc 
   /press alt 
   /press shift 
   /press ctrl 
|------------------------------
|-------< QUICK TOGGLE >-------
| Lowest Level Mob to Hunt
     /varset LowLevel 10
| Highest Level Mob to Hunt
     /varset HighLevel 13
| Range of Current Ranged Weapon 
| 60 == In-Game Range: 45. Do the math to work out your personal range preference.
| Subtract 10 to make up for mob movement
| Ex: /varset ThrowRange 50 <-- Perfect for the 1sp/each Old-World Throwing Knives.
     /varset ThrowRange 50
| Range Command or Hotbutton
| Ex: /varset RangedCommand 4 is for Ranged Attack on Hotbutton #4
     /varset RangedCommand 4
| KS Radius for Kill-Steal Prevention
     /varset KSRadius 200 
| Add Detection & Elimination. 0=Off, 1=On
     /varset WaitForAdds 1 
|------------------------------
|------------------------------
   /varset RangeMax 11 
   /varset RangeMin 5 
   /varset FastRange 10 
   /varset LootSlot 0 
   /varset CheckLoot 0 
   /varset HasTarget 0 
   /varset ObstCount 0

| Add as many of these  as you want but make sure you increase LootTotal 
   /varset MainArray(1,0) a
   /varset MainArray(1,1) e
   /varset MainArray(1,2) i
   /varset MainArray(1,3) o
   /varset MainArray(1,4) u
   /varset LootTotal 5

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

   :Start 
   /if n $char(hp,pct)<="40" /call Rest
|   /call CheckBuffs 
   /call SetAlerts 
   /call GetTarget 
   /if @HasTarget=="1" /call MoveToMob 
   /if @HasTarget=="1" /call CombatSub 
   /if @HasTarget=="1" /call MoveToMob 
   /if @HasTarget=="1" /call LootMob 
   /call ResetSub 
   /goto :Start 
/return 

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

sub SetAlerts 
  /alert clear 1 
  /alert clear 2 
  /alert clear 3 
|/alert clear 4 

| Rare (Most important) 
/alert add 1 npc nopcnear @KSRadius "RareSpawn" 

| Uncomon (next most important) 
/alert add 2 npc radius 700 nopcnear @KSRadius "UncommonSpawn" 

| Common (every day stuff) 
/alert add 3 npc range @LowLevel @HighLevel "lion" 
/alert add 3 npc range @LowLevel @HighLevel "spider" 
/alert add 3 npc range @LowLevel @HighLevel "kodiak" 
/alert add 3 npc range @LowLevel @HighLevel "beetle" 
/alert add 3 npc range @LowLevel @HighLevel "skeleton" 
/alert add 3 npc range @LowLevel @HighLevel "scarab" 
/alert add 3 npc range @LowLevel @HighLevel "willo" 
/alert add 3 npc range @LowLevel @HighLevel "zombie" 

| Scary (Stay away from) 
| /alert add 4 npc radius 10 NPC_005

/return 

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

sub GetTarget 
| Below line moved above :HaveMob to conform with Add Control.
   /varset TargetDead 0 
   :Aquire 
   /if @WaitForAdds==1 { 
| Pause to wait for adds, Default is 3s. 
| Raised slightly in case mobs are gimp and have trouble hitting you.
      /delay 5s 
      /if n $target(id)!=0 /goto  :HaveMob 
      /if $target()!="False" /goto  :HaveMob 
   } 

   /if "$alert(1)"=="TRUE" { 
      /target npc alert 1 nopcnear @KSRadius 
   } else /if "$alert(2)"=="TRUE" { 
       /target npc alert 2 nopcnear @KSRadius 
   } else { 
       /target npc alert 3 nopcnear @KSRadius 
   } 

   /varset MyTarget $target(id) 
   /if n $target(id)==0 /goto :Aquire 
   /if $target()=="False" /goto :Aquire 
   :HaveMob
   /varset HasTarget 1 
   /varset MobToHunt $target(name) 
/return 

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

Sub MoveToMob 
   /face fast
   /if n $target(distance)>=@FastRange /call Fastmove 
   /if n $target(distance)>@RangeMax { 
      /press up 
   } 
   /if n $target(distance)<@RangeMin { 
      /press down 
   } 
/return 

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

Sub Fastmove 
   /varset MyXLOC $char(x) 
   /varset MyYLOC $char(y) 
   /varset ObstCount 0 
   :fastmoveloop 
   /if $target()=="FALSE" { 
      /sendkey up up 
      /if $combat=="TRUE" { 
         /attack off 
         /return 
      } 
   } 
   /face
   /if n $target(distance)>@FastRange { 
      /sendkey down up 
   } 
   /if n $target(distance)<=@FastRange { 
      /sendkey up up 
      /return 
   } 
| Below used for Ranged Weaponry. 
   /if n $target(distance)<=@ThrowRange { 
         /if n $searchspawn(pc,radius:@KSRadius)==0 {
      /face fast
      /press @RangedCommand
         } 
   }
   /varadd ObstCount 1 
   /if n @ObstCount>=10 { 
      /call CheckObst 
   } 
   /goto :fastmoveloop 
/return 

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

sub CombatSub 
   /if $target()=="FALSE" { 
      /varset HasTarget 0 
      /return 
   } 
| Check no PCs are in KSradius still 
| Disabled to conform with Ranged Attacks
|   /delay 1s
|   /if n $searchspawn(pc,radius:@KSRadius)!=0 /goto :PCinKSRadius 
   /attack on 
   :combatloop 
   /face
   /if $char(class)==Rogue /call BackstabIt 
   /call MoveToMob 
   /face
   /if n $target(id)==0 /varset TargetDead 1 
   /if n @TargetDead!=1 /goto :combatloop 
   :PCinKSRadius
   /attack off
   /sendkey up up 
   /delay 0.5s 
   /target corpse 
   /delay 0.5s 
/return 

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

sub LootMob
   /lootnodrop never 
   /loot 
   /delay 1s 
| In Case you have Forage linked to Hotbuttons,
| or Pick Pocketed an item . . .
   /click left auto
   /click left auto
   /click left auto
   :lootloop 
   /if n @LootSlot>=9 /goto :doneloot 
   /click left corpse @LootSlot 
   /delay 1s 
   /if "$cursor()"!="TRUE" /goto :doneloot 
   :lootChecker 
   /if "$cursor(name)"~~"@MainArray(1,@CheckLoot)" { 
|      /delay 1s 
      /click left auto 
      /varadd LootSlot 1 
      /goto :lootloop 
   } 
   /varadd CheckLoot 1 
   /if "$cursor()"=="TRUE" { 
      /if n @CheckLoot<@LootTotal /goto :lootchecker 
   } 
   /if "$cursor()"=="TRUE" { 
      /click left destroy 
   } 
   /varadd LootSlot 1 
   /varset CheckLoot 0 
   /goto :lootloop 
   :doneloot 
   /lootnodrop always
   /varset LootSlot 0 
/return 

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

sub ResetSub 
   /sendkey up up 
   /press esc 
   /press esc 
   /press esc 
   /press esc 
   /press alt 
   /press shift 
   /press ctrl 
   /varset CheckLoot 0 
   /varset HasTarget 0 
   /varset ObstCount 0 
   /delay 1s 
/return 

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

sub CheckObst 
   /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) /call HitObst 5 
   /varset MyXLOC $char(x) 
   /varset MyYLOC $char(y) 
   /varset ObstCount 0 
/return 

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

sub HitObst 
   /sendkey up up 
   /sendkey down down 
   /if n $rand(99)>50 { 
      /delay 1s 
      /sendkey up down 
      /sendkey down Right 
      /delay @Param0 
      /sendkey up Right 
      /sendkey down up 
      /delay 1s 
      /sendkey up up 
   } else { 
      /delay 1s 
      /sendkey up down 
      /sendkey down left 
      /delay @Param0 
      /sendkey up left 
      /sendkey down up 
      /delay 1s 
      /sendkey up up        
   } 
   /sendkey up down 
   /sendkey up Right 
   /sendkey up Left 
   /sendkey down up 
/return 

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

Sub BackstabIt 
   /if n $char(ability,"backstab")!=-2 { 
      /if $target()=="TRUE" { 
         /face 
         /doability "backstab" 
      } 
   } 
| Pick Pocket if the ability is Available
   /if n $char(ability,"Pick Pockets")!=-2 { 
      /if $target()=="TRUE" { 
         /face 
         /attack off
         /doability "Pick Pockets" 
         /attack on
      } 
   } 
/return 

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

Sub CheckBuffs 
  /call SelfBuff "spirit of wolf" 
/return 

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

Sub SelfBuff 
  /if n $char(buff,"@Param0")==0 { 
    /target myself 
    /delay .5 
    /cast "@Param0" 
    /delay "$calc($spell("@Param0",casttime)+4.5)"s 
    /press esc 
  } 
/return 

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

Sub Rest
   /call Hide
   /call BindWound
| This long delay is here for Bind Wound to clean up.
| If you attempt to /sit while still Bind Wound'ing,
| Bind Wound will fail, thus forcing you to stand.
| Though the Sub Sit will fix this, might as well
| stop it before it starts.
   /delay 8s
   /call Sit
/return

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

Sub Hide
   /doability "Hide"
   /delay 2s
| Check to see if Hide failed. If so, try again.
   /doevents
/return

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

Sub BindWound
   /target myself
   /delay 0.5s

   :Bind
   /if n $char(hp,pct)<="48" {
      /if n $char(ability,"Bind Wound")!="-2" {
         /doability "Bind Wound"
         /delay 3s
         /goto :Bind
      } else {
      /delay 3s
      /goto :Bind
      }
   } else {
      /goto :EndBindWound
   }
   :EndBindWound
/return

|
|=====================================================================================
|
   
Sub Sit
   /sit
   /delay 2s
   /press esc

   :Healthcheck
   /if n $char(hp,pct)!="100" {
      /if $char(state)!="SIT" {
         /if $target()=="TRUE" /goto :EndSit
      } else {
         /if $char(state)!="SIT" /sit
         /delay 3s
         /goto :Healthcheck
      }
   } else {
      /goto :Endsit
   }

   :EndSit
   /sit off

/return

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

Sub Event_HideFail
   /doability "Hide"
   /delay 11s
   /doability "Hide"
   /delay 2s
   /doevents
/return

-- a_troll_01