Necromancer Macro - Review for Efficiency

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

ReK2
decaying skeleton
decaying skeleton
Posts: 6
Joined: Wed Sep 11, 2002 3:39 pm

Necromancer Macro - Review for Efficiency

Post by ReK2 » Wed Sep 11, 2002 4:00 pm

Please look at this macro and check it for errors/problems. It's my first complete macro so be kind.

It will find a mob in your level range (DB I hope), chase it down, attack it and kill it. You'll sit and rest if you're low on health and if you're really low, you'll chase down a guard and rest. (this checks the guards zradius so you dont chase a guard that's 5000 ft above you like in GFay). Once done resting you'll stand and check buffs. This macro also attempts to tell the pet to attack, sit and follow accordingly. It also tries to keep your pet up and your buffs up. I don't expect it will work but I'll be messing with it more ASAP. Any feedback is great:

Ok, I editted this.. seems to start out OK but gets lost when I get close to the MOB, sometimes it likes to just MACRO ENDED on me.... ?

Code: Select all

| - NecroLevel.mac - 
| Created by ReK
| Date Created: 09.11.2002

#include routines.mac
#Event SkillUp "You have become better at " 
#Event CastFizzle "Your spell fizzles!" 
#Event CastStart "You begin casting" 
#Event CastInterrupt "Your spell is interrupted." 
#Event CastResist "Your target resisted " 
#Event BackItUp "You cannot see your target"
#Event NotEnoughMana "You have insufficient mana"
#Event Ding "Welcome to Level"
#Event StandUp "You must be standing"

#chat tell 
#chat say 

#define Buff1 1
#define Buff2 2
#define Buff3 3
#define Pet1 4
#define Spell1 5

Sub Main
	/call SetVars
|	/call Buff 1
|	/call Buff 2
|	/call Buff 3
	/call FindTarget
/return

Sub SetVars
	/varcalc v50 $char(level)*2/3
	/varcalc v51 $char(level)*7/5
	/alert clear 1
	/alert add 1 npc range $v50 $v51 "skeleton"
	/alert add 1 npc range $v50 $v51 "orc"
	/alert add 1 npc range $v50 $v51 "gobblin"
	/alert add 1 npc range $v50 $v51 "bat"
	/alert add 1 npc range $v50 $v51 "beetle"
	/alert add 1 npc range $v50 $v51 "spider"
	/alert add 1 npc range $v50 $v51 "widow"
	/alert add 1 npc range $v50 $v51 "snake"
	/alert add 1 npc range $v50 $v51 "scarab"
	/alert add 1 npc range $v50 $v51 "klicnik"
	/alert add 1 npc range $v50 $v51 "bee"
	/alert add 1 npc range $v50 $v51 "wasp"
	/alert add 1 npc range $v50 $v51 "drake"
	/alert add 1 npc range $v50 $v51 "kobold"
	/alert add 1 npc range $v50 $v51 "wolf"
	/alert add 1 npc range $v50 $v51 "rogue clock"
	/alert add 1 npc range $v50 $v51 "cougar"
	/alert add 1 npc range $v50 $v51 "lion"
	/delay 1s
/return

Sub FindTarget
	:KeepLooking
		/varset v71 0
		/call CheckPet
		/doevents
		/target alert 1 nopcnear 60
		/if "$target()"=="TRUE" /call AttackIt
		/pet follow
		/press ESC
		/call AutoRun 0 
		/call Rest
	/goto :KeepLooking
/return

Sub AttackIt
	/varset t0 1m
	/varset t3 5m
	/if n $t3==0 /goto :DoneAttacking
	/face
	/echo Chasing down $target(name)... 
	/varset v71 0
	:KeepAttacking
		/call ChaseIt
		/if n $v71!=1 {
			/pet attack
			/varset v71 1
			}
		/call SpellSub 5
		/face
		/if $combat!=TRUE /attack on
		/if n $t0==0 /goto :DoneAttacking
		/if $combat==FALSE /goto :DoneAttacking
		/if $target()!=TRUE /goto :DoneAttacking
		/if n $char(hp,perc)<25 /goto :DoneAttacking
		/goto :KeepAttacking
	:DoneAttacking
	/attack off
	/return
/return
	

Sub ChaseIt
	:KeepChasing
		/doevents
		/varset v68 500
		/varset v67 $target(distance)
|		/if n "$target(hp,pct)"!="100" /goto :DontKS
		/face
|		/varset t2 1s
|		/if n $t2==0 /face
|		/if n $t2==0 /varset t2 1s
		/call AutoRun 1
		/if n $v67<=12 {
			/call AutoRun 0
			/goto :DoneChasing
		}
		/delay 1s
| mess with this figure
		/varcalc v68 $abs($v67-$target(distance))
		/if n $v68<5 /call Stuck 
		/goto :KeepChasing
	:DontKS
		/echo "$target(hp,pct)"
		/press ESC
	:DoneChasing
/return

Sub Stuck
	/call AutoRun 0
	/varset v65 $char(heading)
	/varcalc v65 $v65+50
	/if n $v65>360 /varcalc v65 $v65-360
	/face heading $v65
	/call AutoRun 1
	/delay 5s
/return

Sub CheckPet
	/if n $char(pet)==0 /if n $char(mana,curr)>$spell($char(gem,$Pet1),mana) /if n $count("bone chip")>0 /call SpellSub Pet1 12 |Cast Pet if not already out
/return

Sub Rest
	/stand
	/pet follow
	:GetHelp
		/doevents
		/if n $char(mana,pct)>90 /if n $char(hp,pct)>90 /goto :DoneResting
		/if n $char(hp,pct)<25 {
			/target npc zradius 40 "guard"
			/if "$target()"!="TRUE" /target npc "guard"
			/if "$target()"!="TRUE" /target npc zradius 40 "watcher"
			/if "$target()"!="TRUE" /target npc "watcher"
			/if "$target()"!="TRUE" /goto :NoHelp
			/call ChaseIt
		}
	/sit
	/pet sit
	/varset v71 0
	:NoHelp
		/doevents
		/if "$gm"=="TRUE" /call Crap
		/if n $char(mana,pct)>90 /if n $char(hp,pct)>90 /goto :DoneResting
		/if n $target(distance)>20 /goto GetHelp
		/goto :NoHelp
	:DoneResting
		/stand
		/call CheckPet
		/pet follow
/return


Sub SpellSub 
	/varset v98 $p0
	/varset v99 $spell($v98,casttime)
	/varset v97 $spell($v98,mana)
	:ReCast 
		/varset v1 0 
		/if n $char(mana,cur)>$v97 /cast $v98
		/delay 2s
		/doevents
		/if n $v1==6 {
			/stand
			/varset v1 2
		}
		/if n $v1==5 {
			/echo "Not enough Mana to cast spell: " &v98
			/goto :SpellSubGetMana
		}
		/if n $v1>1 /goto :ReCast 
		/if n $v1==0 /goto :SpellSubGetMana 
	/return 
	:SpellSubGetMana 
|		/delay $v99s
/return

Sub Event_SkillUp 
	/varset v1 1 
/return 

Sub Event_CastStart 
	/varset v1 1
|	/delay $v99s
	/delay 5s
	/varset v1 0
/return 

Sub Event_CastFizzle 
	/varset v1 2 
/return 

Sub Event_CastInterrupt 
	/varset v1 3 
/return 

Sub Event_CastResist 
	/varset v1 4 
/return 

Sub Event_NotEnoughMana
	/varset v1 5
/return 

Sub Event_StandUp
	/varset v1 6
/return 


Sub Event_Chat 
	/if "$p1"~~"MERCHANT" /return 
	/if "$p3"=="$target(name)" /return
	/beep 
	/if $p0==tell { 
		/delay 2 
		/beep 
		/delay 2 
		/beep 
	} 
	/mqlog $p0 from $p1: $p2 
	/if n $v35==1 /return 
	/if "$p0"~~"GM" /call Crap2 "$p1" 
	/if "$p2"~~"GM" /call Crap2 "$p1" 
	/if "$p2"~~"Guide" /call Crap2 "$p1" 
/return 

Sub Crap2 
	/varset v35 1 
	/afk
	/beep 
	/cleanup 
	/press ESC
	/reply sec
	/mqlog GM talked to us... 
	/delay 25
	/reply bad lag let me relog
	/delay 5 
	/who all GM 
	/who all $p0 
	/call LogStats 
	/beep 
	/sit
	:LoopTillMasterHome 
		/doevents 
		/delay 20 
		/beep 
		/if n v37==0 /goto :LoopTillMasterHome 
	/endmacro 
/return 

Sub Crap 
	/target myself 
	/beep 
	/delay 2 
	/cleanup
	/press ESC
	/delay 5 
	/beep 
	/mqlog GM in zone... idling 
	/who all GM
	/delay 4 
	/who GM
	/delay 6
	/afk
	/beep 
	/call LogStats 
	:LoopTillMasterHome 
		/doevents 
		/delay 20 
		/beep 
		/if n v37==0 /goto :LoopTillMasterHome 
	/mqlog finally master home, they can take over 
	/endmacro 
/return 

Sub Buff
	/target myself
	/call SpellSub $p0
/return

| Sub Event_Timer
| 	/if n $p0 == 11 /call Buff $Buff1
|	/if n $p0 == 12 /call Buff $Buff2
|	/if n $p0 == 13 /call Buff $Buff3
|	/if n $p0 == 20 /SpellSub $Spell1
|	/varset p0 $p1
| /return

Sub Event_BackItUp
| Add code to account for target falling below zradius range
	/call Stuck
/return

Sub Event_Ding
	/call SetVars
End Sub
Last edited by ReK2 on Wed Sep 11, 2002 8:15 pm, edited 1 time in total.

User avatar
rizwank
Huggle Police
Huggle Police
Posts: 524
Joined: Tue Jul 23, 2002 12:07 am
Contact:

Post by rizwank » Wed Sep 11, 2002 4:12 pm

best way to debug is to try it.

does it work?

User avatar
RPZip
a lesser mummy
a lesser mummy
Posts: 63
Joined: Sun Aug 11, 2002 11:31 pm

Post by RPZip » Wed Sep 11, 2002 4:15 pm

/agree Rizwank.

ReK2
decaying skeleton
decaying skeleton
Posts: 6
Joined: Wed Sep 11, 2002 3:39 pm

Post by ReK2 » Wed Sep 11, 2002 7:34 pm

Yeah there were lots of mistakes...

Can anyone tell me if $spell works?

Code: Select all

/varset v99 $spell($v98,casttime)
Just sets v99 to -1 ?

User avatar
rizwank
Huggle Police
Huggle Police
Posts: 524
Joined: Tue Jul 23, 2002 12:07 am
Contact:

Post by rizwank » Wed Sep 11, 2002 8:09 pm

whats $v98 in that case?

ReK2
decaying skeleton
decaying skeleton
Posts: 6
Joined: Wed Sep 11, 2002 3:39 pm

Post by ReK2 » Wed Sep 11, 2002 8:19 pm

Sorry, $v98 is the spell gem number...

I'm trying to set the /delay based on that spell's casttime value.

Code: Select all

/cast $v98
/delay $spell($v98,casttime)s

ReK2
decaying skeleton
decaying skeleton
Posts: 6
Joined: Wed Sep 11, 2002 3:39 pm

Interest wanes...

Post by ReK2 » Tue Aug 12, 2003 1:17 pm

Well I'm going to dig this macro out and work on it some more...
anyone using a variation of it?

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Tue Aug 12, 2003 1:36 pm

Salutations,
Good For you.