Hunter bot for druids

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

orthodude
decaying skeleton
decaying skeleton
Posts: 1
Joined: Sat Jan 03, 2004 12:56 am

Hunter bot for druids

Post by orthodude » Sat Jan 03, 2004 1:02 am

I use this hunter bot in frontier mountains farming high quality brute hides, as well as easier lions and spiders. Yes, I know it reeks of BASIC style programming but I added to it as I went along. Killed spiders for about 4 straight hours in EC without a glitch...I commented out the nuke command since the root is enough to kill them. Please have fun with this and note that it is not an attempt at programming elegance.

Code: Select all

| This macro will hunt for any particular target and loot contents
| of specified number of slots of target inventory.
| It will also med when mana low and gate when hp low.
| This works best if you are bound in same zone targets



#turbo
#define ENEMY "spiderling"
#define ROOT "Earthen Roots" 	
	|Spell you want to root with
	|Doesn't seem to work right so be sure to specify in code below
#define NUKE "Wildfire" 	
	|Spell you want to nuke with
#define SNARE "Ensnare"		
	|Spell you want to snare with
#define GETOUTPLACE "Egress"	
	|Spell to use to port out when hp low
#define MEDPLACE "Egress"		
	|Spell to use to port out when mana low
#define NOLOOTA "Backpack"
	|Items you don't want to loot
#define NUMSLOTS 6
	|Number of slots you want to loot from

Sub Main
|Declare Variables
/declare loopvar local
/declare checkstucka local
/declare checkstuckb local
:Start

|Check mana first
/goto :CheckMana

:StartTargeting
/stand
/echo Attempting to find and attack targets!
/echo Targeting...

:Target
	/target npc ENEMY nopcnear 200	
		|npc tag to avoid targeting and attacking corpses
		|pc tag to avoid ks'ing
	/if "$target()"=="FALSE" /goto :NoTarget	
		|No targets in zone
	/if n $target(hp,pct)<100 /goto :AnothersTarget	
		|Likely has been attacked by someone else

	/echo Heading to Target

:GotoTarget
      	
	
	|Check for damage as we move along
	/if n $char(hp,pct)<70 /goto :GetOut
	/varset checkstucka $target(distance)
	
	|Move to target
	/if n $target(distance)>=80 /sendkey down up
      	/if n $target(distance)<80 /sendkey up up
      	/if n $target(distance)<80 /goto :Cast
	/face fast      	
	/delay 1
	/varset checkstuckb $target(distance)
	
	/if @checkstucka==@checkstuckb {
	|If we are stuck move back and to the side and retry
	
	/sendkey up up
	/sendkey down down
	/delay 5
	/sendkey up down
	/sendkey down left
	/delay 8
	/sendkey up left
	/sendkey down up
	/delay 1s
	/sendkey up up
	/varset checkstuckb 0
	}

	|Move randomly side to side a bit to avoid obstacles   	
	/if n $rand(50)==19 {
	/sendkey down right
	/delay 4
	/sendkey up right
	/delay 1s
	/goto :GotoTarget
	}
	/if n $rand(50)==18 {
	/sendkey down left
	/delay 4
	/sendkey up left
	/delay 1s
	/goto :GotoTarget
	}
	|Make sure target is still there
	/if "$target()"=="TRUE" /goto :GotoTarget
	/echo Lost Target.	
	/goto :Target

:Cast
	/face fast
	/echo Casting on Target
	/delay 13
	/echo Casting Root
	/cast "Engorging Roots"
		|Put defined ROOT here but didn't work
	/delay 5s
	|Back up a little to get away from rooted enemy

	/sendkey down down
	/delay 15
	/sendkey up down	
	/delay 1s
	/echo Casting Nuke
	/cast NUKE
	/delay 8s	

	/if "$target()"=="TRUE" /goto :GotoTarget

:Loot
	/echo Approaching corpse to loot
	/Target corpse ENEMY
	/if "$target()"=="FALSE" /goto :DoneLooting
		|Nothing left to loot


:LootLoop
	|Move close to corpse
	/varset checkstucka $target(distance)
	
      	/if n $target(distance)>2 /sendkey down up
      	/if n $target(distance)<=2 /sendkey up up
	/if n $target(distance)<=2 /goto :LootCorpse		
	/face fast
      	/delay 1
	/varset checkstuckb $target(distance)
	
	/if @checkstucka==@checkstuckb /goto :Start
	|If we aren't moving any closer to the corpse then we will retarget start again
   	/if "$target()"=="TRUE" /goto :LootLoop
	|Restart if something unusual happens
	/goto :Start

:LootCorpse
	/echo Looting the Corpse
	|Make sure we have a corpse targeted	
	/if "$target()"=="FALSE" /goto :Start
	/loot
	/delay 2s

	|Go through corpse looting items		
	|Can change to pick up with left click, check for NO DROP and LORE, and destroy if needed
	/varset loopvar 0

:LootCorpseLoop
	/mouseto corpse @loopvar
	/delay 4
|**
	|This section just wasn't working right for me so I commented it out

	
	/click left
	/delay 1s
	/if "$cursor()"=="FALSE" /goto :DoneLooting

	
		|Skips the Nodrop items
	/if "$cursor(name)"==NOLOOTA {
		echo Destroying $cursor(name) in 2 seconds
		/delay 2s
		/destroy()
	}
		|Destroys the items we don't want
	/mouseto auto
	/delay 5
	/click left

**|
	/click right
	/varadd loopvar 1
	/delay 1

	/if n @loopvar<NUMSLOTS /goto :LootCorpseLoop


:DoneLooting
	/click left corpse done
	/delay 1s
|	/goto :Loot
		|May have killed more than one during battle - messes up if there are nodrop items	
		|so I commented out for now

:CheckMana
	/echo Checking Mana..
	/echo Mana level: $char(mana,pct)
	/if n $char(mana,pct)<20 /goto :Med
	/echo Mana OK
	/goto :StartTargeting

:Med
	/echo Time to med
	|goto safe place
	/cast MEDPLACE
	/delay 10s

:MedLoop	

	/if "$char(state)"=="STAND" /sit
	/delay 10s
	/if n $char(mana,pct)>90 /goto :Start
	/echo Mana level: $char(mana,pct)
	
	|Check for attack while medding
	/if n $char(hp,pct)<75 /goto :GetOut

	/goto :MedLoop


:NoTarget
	/echo Could not locate a target in this zone...waiting 15 seconds to try again.
	|Make sure we are not getting attacked
	/if n $char(hp,pct)<70 goto :GetOut
	/delay 15s
	/goto :StartTargeting

:AnothersTarget
	|Just to play nice, can also be from damage we already caused prior to gate
	/echo Someone else has targeted this NPC
	/echo Waiting 10s and resetting...
	/delay 10s
	/goto :Start

:GetOut
	/cast GETOUTPLACE
	|Cast Gate to go to safe spot, try again if doesn't work
	/delay 1s
	|Check and see if we got out
	/target
	/if n $target(distance)<200 /goto :GetOut
	/delay 10s
:GetOutHeal
	|Heal ourself
	/target myself
	/echo Complete Heal Incoming
	/cast "Tunare's Renewal"
	/sit
	/delay 20s
	/if n $char(hp,pct)<75 /goto :GetOutHeal
		|Spell may have fizzled
	|Try again
	/goto :Start
	
:EndRoutine

/echo End of Routine

/return







sinaelr
decaying skeleton
decaying skeleton
Posts: 7
Joined: Fri Jan 02, 2004 9:34 pm

error

Post by sinaelr » Sun Jan 04, 2004 1:41 pm

for some reason MQ tells me it cant find the CheckMana label, any reason why it doesnt work? :?:

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Mon Jan 05, 2004 10:38 am

Getting the same problem with CheckMana.


I'll look at the code tonight after work.
-Elric

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Tue Jan 06, 2004 9:03 pm

Okay.

Only time and brainpower enough for ONE project.

SO I can't find anything wrong. Maybe I'm just tired, or maybe too hungry.

Perhaps it's in the variables?

Lord help me. Someone help me.
-Elric

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Tue Jan 06, 2004 10:35 pm

I don't have a druid, but out of sheer boredom started re-writing this, fixing a couple things that were commented out as not working, and improving reliability in other areas (specifically, spell casting).

As long as I'm just sitting on my ass and literally doing nothing at work all day, I'll keep pounding away at it.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

Spliffeh
orc pawn
orc pawn
Posts: 15
Joined: Wed Jan 07, 2004 4:42 pm

Post by Spliffeh » Wed Jan 07, 2004 4:57 pm

I've also re-written this and gotten it working fairly well. My version is specifically for level 65 druids hunting Hill Giants in Rathe Mountains. It combines some stuff from the necro hill giant hunter and some from Genbot. In keeping with the original author's style my version reeks of basic even worse then his did :roll: It aint pretty, but it does work for low level hunting.

However, the Hill Giants are a bit trickier because eventually you will get adds and they have the potential to kill you, unlike spiders and rats. So far my version can safely handle 2 targets beating on it but once you get three or more then he gets in trouble. I am digging through other macros trying to find a good way for it to root park & deal with adds. Any suggestions or references to other macros are welcomed.

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Wed Jan 07, 2004 6:46 pm

Soon as Bad gets around to posting his mac, I'll get around to answering some PMs. :-D
-Elric

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Thu Jan 08, 2004 12:48 am

Ack! So, the whole world waits for me to finish! lol

I haven't forggoten. Today is a duty day for me, which means long hours at work (36, to be exact).

I have the mac here, but haven't had time up until now to look at it today. I'm about half way done with it. There's just a few things I'm looking to streamline and hopefully nuke the hangs people were experiencing. I've come up with a couple ways to deal with some of the situational responses the mac will handle, and they should work very nicely, assuming I put the calls in the right place! lol...

Again, no druid to test on, and doing this from work, but should have something posted tonight for you to start playing with.

I tend to use |comments when I code things for quick reference when I write. I'll leave these in when I post the first version so you can see what I'm trying to do, and what/where the different settings you can tweak are located for customization. I'm not changing any of the basic features/objectives of the mac, just trying to clean it up a bit and fix a couple things I've noticed.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Thu Jan 08, 2004 12:24 pm

Just comment anything that would be misty to anyone else..

And I'll test it on my druid for you to make it easier.

Expect bug reports.
-Elric

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Duid Farming / Hunting Macro - Release Notes

Post by Bad Karma » Fri Jan 09, 2004 8:22 am

Sorry for being a day late in posting this. I was playing with the old loot code and saw a |comment to the effect of "there may be more"...but it didn't appear to really do anything. That gave me an idea of how to loop the looting in case there were more corpses, and in the process, I accidentally made it so it will handle adds. lol Did a bit of tweaking to the various subroutines and finally got it looking the way I want it to.

Let me first start by thanking everyone who helped with with this in either ideas, or code, especially ml2517. I've learned a lot by testing out your macs and talking to ya in IRC. I never did incorporate that follow /call in this (mainly because not many people have the latest version yet). I never set out to rewrite this mac, either - just clean it up a bit and see if I could get the known broken stuff working again. I will definately be using it in the future, though! =)

Thanks in advance to Elric for testing this out for me. I keep saying I'm going to make a druid, but never do. I'll be waiting for those bug reports you promised. This is actually my first "release" of a full multi-function macro. Everything to this point has been at the Sub level helping other people out as I learn, and simplistic stuff to practice and test theories.

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

OK...what this does...

First, when you first look at this, it's going to look like a total rewrite....if you do a side-by-side comparison, however, you'll see that it's really just a patch-up job of the orginal code.

I did a lot of combining of routines here, and put like functions together. I reuse a lot of "common" routines, and keep everything running within the Sub level, rather than jumping all over the script like the first one did. This should help in tracking down bugs and making personal tweaks.

I used a lot of |comments at what I felt to be key locations. This was done for several reasons... Mainly, it was done to help me find what I needed while patching everything together. Secondly, there are a lot of things you can tweak yourself depending on where you use this, your level, level of mobs, number of possible adds in the area, etc. Read the comments. If you have any questions about something, just ask. The default settings are based mainly on the orginal code, with only one or two tweaks by me to help eliminate a possble hang/loop I found.

For the same reason, I also left in (but changed the wording) the /echo's. This is mainly to give you a reference as to the state of what the macro is doing and really doesn't have any bearing on how it runs. Feel free to change them or rip them out completely. I suggest leaving in the ones at the start of each Sub so you will at least know where your problem is if something does break.

YOU WILL NEED TO CHANGE THE #DEFINES AT THE START OF THE MACRO!!!!

The |comments will tell you what they are, if you can't figure out what it's supposed to be...I left the default values in from the orginal posted script. This is the ONLY thing that you will HAVE to change to make the script run, and only then if you are using different values (target mob/spells/etc).

This script should loop itself endlessly until you type /endmacro
To start the macro, there are no tricky variables to pass...a simple /macro DruidFarm will get you off and running!

Anti-KS code was cleaned a little, but has not changed in the WAY it works. It's VERY basic, and you should search the forums on the many suggested methods of improved/advanced anti-KS techniques. I did not improve on it here, again, as my intent was not to rewrite, but clean up and fix, so the authors could expand it to their desires. I don't run a druid....what I think might work for me, may not be best for most of you experienced dr00ds who are running this.

The major changes to the macro are in how it jumps to the various routines. A lot of duplicate code was deleted. Some is re-used by other parts of the script. Some subsections were combined to single larger sections.
I added a few more checks to make sure you're on the right target, and deleted a couple redundant commands. There are a few things you'll see a couple places, such as the /stand checks....this is just for safety in case you manually do something and don't return the toon to the state the macro will expect it to be in. Also, in case you get jumped.

Speaking of which...this will KIND OF handle adds, now! What I mean is, if you get jumped, EQ should auto-target the mob....this will detect that, and run through a few checks for your safety, then engage the mob if safe to do so (enough HP and mana). Once all the adds are done, THEN it will actually loot the corpses....yes....all of them. I did set a maximum range on corpses, though....currently 500, fell free to change it. Again, this is for your safety. Don't want to chase after a corpse on the other side of the zone where all those KOS guards are waiting....like hunter.mac does! I also left the PC check radius at 200, which you can change. Both of those Sub's are near the top of the mac.

One last change... This will kill a mob dead. The orginal post didn't do that. It nuked, then if the target was still there, it restarted the whole macro. This one just nukes until the mob is dead, then continues by checking for corpses and adds before restarting. One other major issue I saw with the first one....WHEN it checked your HP and Mana...it did it AFTER you engaged the target! bad bad bad...this one does it BEFORE every fight....before even targeting a mob....if you get adds, it checks again, then ports out if you're too low on HP or Mana. (set the min/max values in the CheckHP and CheckMana sub's at the bottom of the macro)

Another "major" change...This macro no longer handles spell casting. There was NO safety in the way it did it before. My suggestion: Use SpellCast.inc for everything. You will define your spells at the top of the macro. This macro will then auto-memorize the required spells (you can change the gem# at the very bottom of the macro). Here's the safety you get by using SpellCast.inc: It will do whatever is necessary to make sure the spell succeeds. If root is resisted, it will re-cast. If you fizzle, it will recast. If you are low mana...it will auto-med and retry. The orginal macro had NONE of that. Also, if something happens and the required spell is not available, it will auto-mem the spell on-the-fly, ensuring you get the spell you need, when you need it. You can't go wrong with SpellCast.inc!

I will post a copy of the one I twinked and use following the macro itself for those who don't have a copy.

Hope this works! Enjoy!
Last edited by Bad Karma on Fri Jan 09, 2004 8:29 am, edited 1 time in total.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Fri Jan 09, 2004 8:24 am

[edit]:
- Fixed the problem of it not loading the spell list properly when you first start the macro.
[edit:]
- fixed some syntax, another missing 'n', missing or unneeded " and a few other minor things here and there.
- Changed the DIST to approach a corpse...it was overshooting the corpse, but still looting...looks ood to observers.
- Added some pauses to prevent/reduce intrrupted spells during the KillMob routine...changed others to give a more human appearance.
- made all /face commands 'nolook'....I like my shoes, but I don't want to stare at them all day.
- Changed to loot code! Since this is a farming script, it now destroys everything, unless you tell it otherwise in the defines....
** Known bug? Would not properly pre-mem the spells for me if they were not already there. It does mem the spells, however, before casting if it needs to. If the spells are already mem'd before running the script, it just does its thing like it should. I've been having problems on my system with /memspell in scripts, so this may work for you. The syntax has been verified and should work as written...

[edit]:
- Fixed an overlooked 'n' when setting up the spell list.
[edit]:
- Added a missing = in an /if statement which may have been causing not to target correctly.
- Added a missing " in an /if statement which may have been causing not to target correctly.
- Changed /declares to Global due to issues with Local setting.
- Corrected syntax on a couple /varset and /if statements.

Code: Select all

| DruidFarm.mac
| 11-JAN-2004 @ 11:30 SYD
|
| Orginally written by:  orthodude
| Re-worked and optimized by:  Bad Karma
|   - BK's NOTE: This is best suited for farming lower level mobs, as its very basic in nature.
|   - It's 100% automatic now.  Just define your varables at the top, and let it run!
|
| This macro will hunt for any particular target and loot
| contents of specified number of slots of target inventory.
| It will also med when mana low and gate when hp low.
| This works best if you are bound in same zone targets.


#turbo 50

#include SpellCast.inc

#define ENEMY "spider"            | What you want to hunt.
#define HEAL "Tunare's Renewal"   | Spell to heal yourself with.
#define ROOT "Earthen Roots"      | Spell you want to Root with.
#define NUKE "Wildfire"           | Spell you want to Nuke with.
#define SNARE "Ensnare"           | Spell you want to Snare with.
#define HPEVAC "Egress"           | Spell to use to port out when your HP gets too low.
#define MEDEVAC "Egress"          | Spell to use to port out when your Mana gets too low.
#define KEEP "silk"               | Looted items you want to KEEP.
#define NUMSLOTS 6                | Number of empty inventory slots you have available to fill up with loot.


Sub Main
   /declare LootLoopVar global
   /declare CheckStuckA global
   /declare CheckStuckB global
   /declare DIST global
   /call SetupSpells

:MainLoop
   /call CheckHP
   /call CheckMana
   /call GetTarget
   /call KillMob
   /call GetCorpse
   /call LootCorpse
   /goto :MainLoop
/return

Sub GetTarget
   :TargetLoop
      /press ESC
      /echo Searching for a victim!
| Selects the nearest target available AND makes sure we don't KS if we do find one.
| NOTE: There is MUCH better anti-KS code out there!  Search the forums and find one that works best for you.
      /target npc ENEMY nopcnear 200
| If unable to find an available target, sit and med for 15 seconds before trying again.  (May as well put the down time to use!)
      /if ("$target()"=="FALSE" || n $target(hp,pct)<=95) {
         /echo Unable to locate any targets nearby... Will try again in 15 seconds.
         /if "$char(state)"!="SIT" /sit
         /delay 15s
         /goto :TargetLoop
      }
   /echo Closing in on $target(name,clean)...
   /varset DIST 80
   /call MoveToTarget
/return


Sub GetCorpse
   /echo Looking for the corpse...
   /target corpse ENEMY radius 500
   /if "$target()"=="FALSE" {
      /echo No lootable corpses within established range...
      /return
   }
   /varset DIST 7
   /call MoveToTarget
/return


Sub MoveToTarget
   /if "$char(state)"!="STAND" /stand
   /face nolook
   /delay 3s
:Run
   /varset CheckStuckA $target(distance)
   /face fast nolook
   /if n $target(distance)>=@DIST /sendkey down up
   /if n $target(distance)<=@DIST {
      /sendkey up up
      /return
   }
   /delay 1
   /varset CheckStuckB $target(distance)
| If we are stuck move back and to the side and retry
   /if n @CheckStuckA==n @CheckStuckB {
      /sendkey up up
      /sendkey down down
      /delay 5
      /sendkey up down
      /sendkey down left
      /delay 8
      /sendkey up left
      /sendkey down up
      /delay 1s
      /sendkey up up
      /varset CheckStuckB 0
   }
| Move randomly side to side a bit to avoid obstacles
   /if n $rand(50)==19 {
      /sendkey down right
      /delay 4
      /sendkey up right
      /delay 1s
      /goto :Run
   }
   /if n $rand(50)==18 {
      /sendkey down left
      /delay 4
      /sendkey up left
      /delay 1s
      /goto :Run
   }
| Make sure target is still there
   /if "$target()"=="TRUE" /goto :Run
   /echo I lost my target.
/return


Sub KillMob
| You can make this /face fast if you want.  I don't use it here, to give it a more "human" appearance to observers.
   /face nolook
   /echo Showing $target(name,clean) what dr00ds are made of!
   /delay 13
| Time to park it!
   /echo Rooting:  $target(name,clean)
   /call cast "ROOT"
   /delay 2s
| Back up a little bit from the rooted mob.
   /sendkey down down
   /delay 2s
   /sendkey up down
   /delay 2s
| Nuke that muth`a!
   :nuke
      /echo Nuking:  $target(name,clean)
      /call cast "NUKE"
      /delay 3s
   /if "$target()"=="TRUE" /goto :nuke
/return


Sub LootCorpse
| Make sure we still have a lootable corpse targeted.
| If we got an add or jumped on the way to the corpse, then it should automatically be on target now.
| If this is the case, it will start the script over from the start:
|    1. Check Health and Mana to make sure we are healthy enough to keep fighting.
|    2. If so, kill the new mob.  If not, bug out to our safe spot.
|    3. Rinse and repeat as necessary.
|    4. After killing the add(s), it will loot all corpses in the area.
:LootMainLoop
   /if ("$target()"=="FALSE" || "$target(state)"!="DEAD") /return
   /echo Collecting all the Phat little L3wtz, my precious!
   /loot
   /delay 3s
   /varset LootLoopVar 0

| Sort through corpse looting items and keep only what we want.
| Can change to pick up with left click, check for NO DROP and LORE, and destroy if needed.
:LootCorpseLoop
   /mouseto corpse @LootLoopVar
   /delay 3
   /click left
   /delay 1s
| If the corpse is empty, we're done looting.
   /if "$cursor()"=="FALSE" /goto :DoneLooting
| Destroy the items unless we said we want to KEEP them, but give us a moment to change our mind.
   /if "$cursor(name)"!~"KEEP" {
      /echo Auto-Destroying $cursor(name) in 4 seconds...
      /delay 3s
      /mouseto destroy
      /delay 1s
      /click left 
   }
   /mouseto auto
   /delay 1s
   /click left
   /varadd LootLoopVar 1
   /delay 1
   /if n @LootLoopVar<=n @NUMSLOTS /goto :LootCorpseLoop

| We're done looting now, so let's close everything up and check to see if there are any more corpses in the area.
:DoneLooting
   /press ESC
   /press ESC
   /press ESC
   /delay 1s
   /call GetCorpse
   /goto :LootMainLoop
/return


Sub CheckHP
| Check our current Hit Points and Port out if below 20%.
   /if n $char(hp,pct)<=20 {
      /echo HEY!!!  I'm DIEING!!!  Time to bug out!!!  [HP: $char(hp,pct)%]
      /call cast "HPEVAC"
   }
| Check our current Hit Points and if below 60%, Heal until we reach 90%.
   /if n $char(hp,pct)<=60 {
      /target myself
      :HealLoop
         /echo LOW HEALTH!!!  Healing to 90%...  [HP: $char(hp,pct)%]
         /call cast "HEAL"
         /if n $char(hp,pct)<=90 /goto :HealLoop
   }
/return


Sub CheckMana
| Check our current Mana and Port out if below 20%.
   /if n $char(mana,pct)<=20 {
      /echo HEY!!!  I'm almost OOM!!!  Time to bug out!!!  [MANA: $char(mana,pct)%]
      /call cast "MEDEVAC"
   }
| Check our current Mana and if below 40%, Meditate until we reach 90%.
   /if n $char(mana,pct)<=40 {
      /echo LOW MANA!!!  Medding to 90%...  [MANA: $char(mana,pct)%]
      :MedLoop
         /if "$char(state)"!="SIT" /sit
         /delay 15s
         /if n $char(mana,pct)<=90 /goto :MedLoop
   }
/return


Sub SetupSpells
| Memorize our spells if they are not already memorized.
| You can put these in any slot you want by changing the # after /memspell.
   /if n $char(gem,"HEAL")==0 {
      /memspell 1 "HEAL"
      /delay 5s
   }
   /if n $char(gem,"ROOT")==0 {
      /memspell 6 "ROOT"
      /delay 5s
   }
   /if n $char(gem,"NUKE")==0 {
      /memspell 2 "NUKE"
      /delay 5s
   }
   /if n $char(gem,"SNARE")==0 {
      /memspell 8 "SNARE"
      /delay 5s
   }
   /if n $char(gem,"HPEVAC")==0 {
      /memspell 7 "HPEVAC"
      /delay 5s
   }
   /if n $char(gem,"MEDEVAC")==0 {
      /memspell 5 "MEDEVAC"
      /delay 5s
   }
/return


Sub End
   /echo End of Routine
   /endmacro
/return
Last edited by Bad Karma on Sat Jan 10, 2004 8:24 pm, edited 4 times in total.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Fri Jan 09, 2004 8:24 am

Code: Select all

| SpellCast.inc
| This will cast a spell reliably for you...
|
| Usage:
|      /call Cast "spellname"
|   or
|      /call Cast "itemname" [item]
|
| It will return the following values:
|    CAST_SUCCESS
|    CAST_UNKNOWNSPELL
|    CAST_OUTOFMANA
|    CAST_OUTOFRANGE
|    CAST_CANNOTSEE
|    CAST_STUNNED
|    CAST_RESISTED
|    FD_FAILED
|
| New Vars Modification
| Plazmic's no globals needed version
|
| Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf
| Oct 11, 2003 - switched some logic, removed defines - gf
| Oct 15, 2003 - Item support added by EqMule
|  Modified to add automeming of spells. Goofmester1
| Dec 26, 2003 fd fail 1 added by m0nk
| Dec 28, 2003 Modded for functionality in a variety of macs for multiple classes - Bad Karma
|
|  NOTE:  All /echo commands are for debugging and feedback only.  They can be safely removed.
|

#event Collapse "Your gate is too unstable, and collapses."
#event FDFail "You are no longer feigning death"
#event Fizzle "Your spell fizzles"
#event Interrupt "Your casting has been interrupted"
#event Interrupt "Your spell is interrupted."
#event NoLOS "You cannot see your target."
#event NotHold "Your spell would not have taken hold on your target."
#event OnlyAtNight "Spell can only be cast during the night."
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "You target resisted the "
#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground."
#event Stunned "You cannot cast while stunned"
#event TooPowerful "You spell is too powerful for your intended target."

Sub Cast(SpellName,Item)
   /sendkey up up
   /sendkey up down
/if n $char(gem,"@SpellName")==0 {
  /memspell 7 "@SpellName"
  /delay 5s
}
:StartCast
   /if $char(state)!="STAND" /stand
   /face fast
   /look 0                                  | Temporary fix to the "stare at the sky" issue.
   /echo Incoming @SpellName to %T
   /if "@Item"=="Item" {
     /call ClearReturnValue
     /cast item "@SpellName"
   } else {
     /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL
     /call ClearReturnValue
     /if n $char(gem,"@SpellName")<0 {
       /delay 0
       /goto :StartCast
     }
     /cast "@SpellName"
   }
   :WaitCast 
      /if "$char(casting)"=="TRUE" { 
      /delay 1 
      /goto :WaitCast 
      }
   /doevents Fizzle
   /doevents Interrupt
   /doevents Recover
   /doevents Resisted
   /doevents OutOfMana
   /doevents OutOfRange
   /doevents NoLOS
   /doevents Stunned
   /doevents Standing
   /doevents Collapse
   /doevents OnlyAtNight
   /doevents NotHold
   /doevents TooPowerful
   /doevents FDFail

   /if "$return"=="CAST_RESTART" /goto :StartCast
   /if "$return"!="CAST_SUCCESS" /return "$return"
   /if "$return"=="CAST_OUTOFMANA" /goto :StartCast
   /if "$return"=="CAST_STUNNED" /goto :StartCast
   /if "$return"=="CAST_RESISTED" /goto :StartCast
   /if "$return"=="CAST_OUTOFRANGE" /goto :StartCast
   /if "$return"=="CAST_CANNOTSEE" /goto :StartCast
   /if "$return"=="FD_FAILED" /return "$return"
/return CAST_SUCCESS

Sub ClearReturnValue 
/return CAST_SUCCESS 


Sub Event_Fizzle
   /echo Event_Fizzle
/return CAST_RESTART

Sub Event_Interrupt
   /echo Event_Interrupt
/return CAST_RESTART

Sub Event_Recover
   /echo Waiting for recovery...
   /delay 5
/return CAST_RESTART

Sub Event_Standing
   /echo Event_Standing
   /stand
/return CAST_RESTART

Sub Event_Collapse
   /echo Event_Collapse
/return CAST_RESTART

Sub Event_OutOfMana
   /echo Event_OutOfMana
   /tell "@Sender" "I'm out of mana at the moment.  Let me med for 10 seconds and I'll try again!"
   /sit
   /delay 10s
   /stand
/return CAST_OUTOFMANA

Sub Event_OutOfRange
   /echo Event_OutOfRange
   /tell "@Sender" "%T is out of range.  Waiting for it to get a little closer before casting again."
   /sit
   /delay 10s
   /stand
/return CAST_OUTOFRANGE

Sub Event_NoLOS
   /echo Event_NoLOS
   /tell "@Sender" "I cannot see %T.  Waiting for it to get a little closer before casting again."
   /sit
   /delay 10s
   /stand
/return CAST_CANNOTSEE

Sub Event_Stunned
   /echo Event_Stunned
   /tell "@Sender" "I am STUNNED at the moment!  I will try again in 5 seconds."
   /sit
   /delay 5s
   /stand
/return CAST_STUNNED

Sub Event_Resisted
   /echo Event_Resisted
   /tell "@Sender" "%T resisted my spell.  Trying again..."
   /sit
   /delay 5s
   /stand
/return CAST_RESISTED

Sub Event_OnlyAtNight
   /echo Event_OnlyAtNight
/return CAST_SUCCESS

Sub Event_NotHold
   /echo Event_NotHold
/return CAST_SUCCESS

Sub Event_TooPowerful
   /echo Event_TooPowerful
/return CAST_SUCCESS

Sub Event_FDFail
   /echo FD_FAILED
   /stand
/return FD_FAILED
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Fri Jan 09, 2004 12:27 pm

Very good. I'll test it tonight after I get home from work.

And I'll go check my old PMs now.
-Elric

Spliffeh
orc pawn
orc pawn
Posts: 15
Joined: Wed Jan 07, 2004 4:42 pm

Post by Spliffeh » Fri Jan 09, 2004 5:02 pm

I gave your macro a quick test and I got errors regarding fail to parse IF command starting from this line (55):

/if ("$target()"="FALSE" || n $target(hp,pct)<=95) {

So I commented out that unnecessary IF command out to see if it would run, I got a bad variable error regarding line 62: /varset DIST 80

Also, before I made any changes I noticed it was not grabbing the target properly, it was adding the character @ in front of the proper name.

User avatar
psychotik
a ghoul
a ghoul
Posts: 112
Joined: Mon Oct 06, 2003 3:48 am

Post by psychotik » Fri Jan 09, 2004 5:07 pm

Code: Select all

Sub GetTarget 
   :TargetLoop 
      /echo Searching for a victim! 
| Selects the nearest target available AND makes sure we don't KS if we do find one. 
| NOTE: There is MUCH better anti-KS code out there!  Search the forums and find one that works best for you. 
      /target npc "@ENEMY" nopcnear 200 
| If unable to find an available target, sit and med for 15 seconds before trying again.  (May as well put the down time to use!) 
      /if ("$target()"="FALSE" || n $target(hp,pct)<=95) { 
         /echo Unable to locate any targets nearby... Will try again in 15 seconds. 
         /if "$char(state)"!="SIT" /sit 
         /delay 15s 
         /goto :TargetLoop 
      } 
   /echo Closing in on $target(name,clean)... 
   /varset DIST 80 
   /call MoveToTarget 
/return 
you never stand up by the looks of it