modified druid.mac help

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

Moderator: MacroQuest Developers

caewen
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 13, 2003 5:09 am

modified druid.mac help

Post by caewen » Mon Jun 09, 2003 4:35 am

heyas everyone. i have modified druid.mac a bit to work with my shaman that i have started. the script is running fine, except for a couple little things. whenever i tell the bot to heal, it says "couldn't find comparison operator in 'heal' " two times. when i tell it to sow, it says "couldn't find comparison operator in 'sow'" four times. I am pretty sure this is an effect of having to read the previous if statements and not finding the comparison, but is there any way to fix this? like i said, the script runs great, and it will cast the spell, just gives those errors on heal and sow... thanks.

caewen

here is the script

Code: Select all

| Shaman.mac - Shaman pet script, modified Druid.mac
| Work in progress, rewrites as I gain new spell levels.  Currently lvl 9
|
| Spells in use (Type 1)..........: Heal, Shield, Strength, Cure Poison, Cure Disease, Drowsy, Gate, Nuke
|
| Start with /macro druid <Controller Name> <Type> e.g. /macro druid Buranda 1
|
| Spells for PLing (Type 1)........: Heal, DS, Skin, Chloro, STR, SoW, Snare, Root
| Spells for Hunting (Type 2)......: Heal, DS, Skin, Winged, STR, SoW, Breath, Evac
| or if indoors (Type 3)...........: Heal, DS, Skin, Winged, STR, Immolate, Breath, Evac
| or if a Nuke is required (Type 4): Heal, DS, Skin, Winged, STR, Nuke, Debuff, Evac
|

#chat tell

#define CurrentMaster v30
#define LastTellSender v33
#define CurrentSpellSet v34
#define CurrentTarget v35
#define CurrentHelpCommand v36
#define CurrentHealTarget v37
#define CurrentSlowSpell v38
#define CurrentHealSpell v39
#define CurrentBuffSpell v40
#define CurrentNukeSpell v41
#define LastTellMessage v42
#define MasterDistance v43
#define CurrentCurePoisonSpell v44
#define CurrentCureDiseaseSpell v45
#define TargetDead v46
#define MobDistance v47
#define MyXLoc v48
#define MyYLoc v49
#define HomeX v50
#define HomeY v51
#define BackHome v52
#define CurrentBuffTarget v53
#define CurrentRunSpeedSpell v54
#define CurrentAttackTarget v55

#define CastStatus v59
#define CastTimer t7
#define CAST_SUCCESS 0
#define CAST_UNKNOWNSPELL 1
#define CAST_RESTART 2
#define CAST_OUTOFMANA 3
#define CAST_OUTOFRANGE 4
#define CAST_CANNOTSEE 5
#define CAST_STUNNED 6
#define CAST_RESISTED 7

#event GainedALevel "You have gained a level!"
#event GroupInvite "click on the 'FOLLOW' option, or 'DISBAND' to cancel.
#event SlowOff "Your Drowsy spell has worn off."
#event IAmPoisoned "You have been poisoned."
#event CuredPoison "You have cured your target."

#event Fizzle "Your spell fizzles!"
#event Interrupt "Your spell is interrupted."
#event Recover "You haven't recovered yet..."
#event Resisted "You target resisted the"
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
#event Stunned "You cannot cast while stunned"
#event Standing "You must be standing to cast a spell"
#event Collapse "Your gate is too unstable, and collapses."


Sub Main
    /zapvars
    /varset HomeX -927
    /varset HomeY -2789
    /varset MobDistance 18
    /varset MasterDistance 30
    /varset CurrentMaster $p0
    /varset CurrentSpellSet $p1
    /call SetVarsForSpells
|    /call MemSpells $CurrentSpellSet
    /tell $CurrentMaster Ready
    :loop
      /doevents
    /goto :loop
/return

Sub SetVarsForSpells
	/if $CurrentSpellSet==1 {
	/varset CurrentHealSpell "Light Healing"
	/varset CurrentBuffSpell "Inner Fire"
	/varset CurrentSlowSpell "Drowsy"
	/varset CurrentNukeSpell "Frost Rift"
	/varset CurrentCurePoisonSpell "Cure Poison"
	/varset CurrentCureDiseaseSpell "Cure Disease"
	/varset CurrentRunSpeedSpell "Spirit of Wolf"
	}
/return

Sub Event_GainedALevel
/tell $CurrentMaster I have gained a level!  I am now $char(level)
/return

Sub Event_GroupInvite
/invite
/return

Sub Event_IAmPoisoned
/tell $CurrentMaster I am poisoned.  I am going to try to remove it myself.
/varset CurrentHealTarget myself
/call CurePoisonSub
/return

Sub Event_Chat
   /varset LastTellSender $p1
   /varset LastTellMessage "$p2"
   /if "$LastTellSender"!="$CurrentMaster" {
      /mqlog Tell from $LastTellSender : $LastTellMessage
      /tell $CurrentMaster Tell from $LastTellSender to $char(name), you might wanna talk to them.
      /return
   }
   /target $CurrentMaster

/if $left(3,"$LastTellMessage")==sow /varset CurrentBuffTarget $arg(2,"$LastTellMessage")
/if $left(4,"$LastTellMessage")==heal /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $left(6,"$LastTellMessage")==poison /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $left(7,"$LastTellMessage")==disease /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $CurrentBuffTarget==$char(name) /varset CurrentBuffTarget myself
/if $CurrentHealTarget==$char(name) /varset CurrentHealTarget myself

|This section just redirects to the correct subs
   /if "$LastTellMessage"~~"status" /tell $CurrentMaster Mana: $char(mana,pct)%, HP: $char(hp,pct)%, EXP: $char(exp)%
   /if "$LastTellMessage"~~"gohome" /call HomeBase
   /if "$LastTellMessage"~~"heal" /call HealSub
   /if "$LastTellMessage"~~"slow" /call SlowSub
   /if "$LastTellMessage"~~"sow" /call SowSub
   /if "$LastTellMessage"~~"melee" /call MeleeSub
   /if "$LastTellMessage"~~"follow" /call FollowSub
   /if "$LastTellMessage"~~"stopfollow" /call StopFollowSub
   /if "$LastTellMessage"~~"comehere" /call GoTargetSub
   /if "$LastTellMessage"~~"help" /call HelpSub
   /if "$LastTellMessage"~~"poison" /call CurePoisonSub
   /if "$LastTellMessage"~~"disease" /call CureDiseaseSub
   /if "$LastTellMessage"~~"sitdown" /call SitSub
   /if "$LastTellMessage"~~"standup" /call StandSub

|This section will determine what kind of spells to mem whenever function is restored.
|  /if $p2~~"buffspells" /call MemSpells 1
|  /if $p2~~"supportspells" /call MemSpells 2
|  /if $p2~~"offensespells" /call MemSpells 3
|  /if $p2~~"00type4" /call MemSpells 4
   /doevents
/return

Sub StopFollowSub
/sendkey down right
/sendkey up right
/return

Sub SitSub
/stand
/delay 5
/sit
/return

Sub StandSub
/stand
/return

Sub FollowSub
	/target $CurrentMaster
	/delay 6
	/follow
/return

Sub MeleeSub
	/assist $CurrentMaster
	/delay 10
	/varset CurrentAttackTarget $target(id)
	/tell $CurrentMaster Going into MELEE mode!  Gonna kill %T
	/attack on
	:combatloop
    /face fast nopredict
    /if n $target(distance)>13 {
       /sendkey down up
       /goto :combatloop
    }
    /if n $target(distance)<=$MobDistance /sendkey up up
    /face fast nopredict
    /if $char(ability,"Slam")>0 /doability "Slam"
	/if n $target(id)!=$CurrentAttackTarget /varset TargetDead 1
    /if n $TargetDead!=1 /goto :combatloop
    /delay 1s
    /varset TargetDead 0
    /target id $MyTarget
/return

Sub SlowSub
	/assist $CurrentMaster
	/delay 5
	/tell $CurrentMaster Going to slow %T
	/call Cast $CurrentSlowSpell
	/tell $CurrentMaster All done...%T is slowed
/return

Sub HealSub
    /target $CurrentHealTarget
    /delay 3
    /tell $CurrentMaster Starting heal process for %T
    :Begin
    /call Cast "$CurrentHealSpell"
    /if $CastStatus==3 {
    	/tell $CurrentMaster OOM!  No more healing possible!
    	/return
    	}
    /if $target(hp,pct)<=90 {
    	/goto :Begin
    	}
    /tell $CurrentMaster Healing done, Mana: $char(mana,pct), HP: $char(hp,pct)
/return

Sub CurePoisonSub
    /target $CurrentHealTarget
    /delay 3
    /tell $CurrentMaster Going to cure poison for %T
    /for v80 0 to 3
    /call Cast "$CurrentCurePoisonSpell"
    /if $CastStatus==3 {
    	/tell $CurrentMaster OOM!  Can't remove poison now!!
    	/return
    	}
    /next v80
    /tell $CurrentMaster Done casting, Mana: $char(mana,pct), HP: $char(hp,pct)
/return

Sub CureDiseaseSub
    /target $CurrentHealTarget
    /delay 3
    /tell $CurrentMaster Going to cure disease for %T
    /call Cast "$CurrentCureDiseaseSpell"
    /if $CastStatus==3 {
    	/tell $CurrentMaster OOM!  Can't remove disease now!!
    	/return
    	}
    /tell $CurrentMaster Done casting, Mana: $char(mana,pct), HP: $char(hp,pct)
/return

Sub GoTargetSub
    /target $CurrentMaster
    /delay 3
    :combatloop
    /varset MyXLoc $char(x)
    /varset MyYLoc $char(y)
    /delay 1
    /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /call Obstacle
    /face fast nopredict
    /if n $target(distance)>$MasterDistance {
       /sendkey down up
       /goto :combatloop
    }
    /if n $target(distance)<=$MasterDistance {
       /sendkey up up
       /return
    }
    /return

Sub Nuke
    /assist $CurrentMaster
    /delay 6
    /tell $CurrentMaster Nuking %T
    /call SpellSub 6 5.5
    /tell $CurrentMaster Nuke on %T done, Mana: $char(mana,pct), HP: $char(hp,pct)
    /target $CurrentMaster
/return

Sub Debuff
    /assist $CurrentMaster
    /delay 6
    /tell $CurrentMaster Debuffing %T
    /call SpellSub 7 5.5
    /tell $CurrentMaster %T successfully debuffed, Mana: $char(mana,pct), HP: $char(hp,pct)
    /target $CurrentMaster
/return

Sub MemSpells
|
|This section doesn't work, as MQ is quite broken atm.  When the spellmemming is fixed in MQ, I will
|Do a rewrite of this section to make it work.  I am going to add some code here, just so I have a
|  point of reference when it does work again :)
|
/return

Sub HelpSub
    	/tell $CurrentMaster Current commands are:
    	/delay 15
    	/tell $CurrentMaster heal targetname--slow--follow--info--comehere--help
/return

Sub Cast
  /if n $char(gem,"$p0")==0 /return CAST_UNKNOWNSPELL
  :StartCast
  /if n $char(gem,"$p0")<0 /call WaitForRefresh "$p0"
  /cast "$p0"
  /varset CastTimer $int($spell("$p0",casttime)*10+$spell("$p0",recoverytime)*10)
  /varset CastStatus CAST_SUCCESS
  :WaitCast
     /doevents Fizzle
     /doevents Interrupt
     /doevents Recover
     /doevents Standing
     /doevents OutOfRange
     /doevents OutOfMana
     /doevents NoLOS
     /doevents Resisted
     /if n $CastStatus==CAST_RESTART /goto :StartCast
     /if n $CastStatus>CAST_RESTART /return $CastStatus
  /if n $CastTimer>0 /goto :WaitCast
  /varset CastTimer 0
/return CAST_SUCCESS

Sub WaitForRefresh
   :LoopWaitForRefresh
      /delay 0
   /if n $char(gem,"$p0")<0 /goto :LoopWaitForRefresh
/return

Sub Event_Fizzle
   /varset CastStatus CAST_RESTART
/return

Sub Event_Interrupt
   /varset CastStatus CAST_RESTART
/return

Sub Event_Recover
   /varset CastStatus CAST_RESTART
   /delay 5
/return

Sub Event_Standing
   /varset CastStatus CAST_RESTART
   /stand
/return

Sub Event_Collapse
   /varset CastStatus CAST_RESTART
/return

Sub Event_OutOfMana
   /varset CastStatus CAST_OUTOFMANA
/return

Sub Event_OutOfRange
   /varset CastStatus CAST_OUTOFRANGE
/return

Sub Event_NoLOS
   /varset CastStatus CAST_CANNOTSEE
/return

Sub Event_Stunned
   /varset CastStatus CAST_STUNNED
/return

Sub Event_Resisted
   /varset CastStatus CAST_RESISTED
/return

sub HomeBase
:RunHome
    /doevents
    /if $char(ability,"Sense Heading")>0 /doability "Sense Heading"
    /face loc $HomeY,$HomeX
    /if n $distance($HomeY,$HomeX)>15 /call autorun2 1
    /varset MyXLoc $char(x)
    /varset MyYLoc $char(y)
    /delay 1
    /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /call Obstacle
    /if n $distance($HomeY,$HomeX)<15 {
    /call autorun2 0
    /varset BackHome 1
    }
    /delay 0
    /if n $BackHome!=1 /goto :RunHome
    /varset BackHome 0
    /return
	
sub Obstacle
   /sendkey up up
   /sendkey down down
   /delay 2
   /sendkey up down
   /sendkey down ctrl
   /if n $rand(99)>50 {
      /sendkey down right
   } else {
      /sendkey down left
   }
   /delay 3
   /sendkey up right
   /sendkey up left
   /sendkey up ctrl
   /sendkey down up
   /return

Sub AutoRun2
   /if $p0==1 /sendkey down up
   /if $p0==0 /sendkey up up
/return

Sub SowSub
    /target $CurrentBuffTarget
    /delay 3
    /tell $CurrentMaster Incoming Spirit of Wolf for %T
    /call Cast "$CurrentRunSpeedSpell"
    /if $CastStatus==3 {
    	/tell $CurrentMaster OOM!  Can't SoW now!!
    	/return
    	}
    /tell $CurrentMaster Done casting, Mana: $char(mana,pct), HP: $char(hp,pct)
/return

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

shaman bot.

Post by grimjack » Mon Jun 09, 2003 4:40 am

I have a shaman bot I just put up not too long ago. It is very easy to change and update. If you try it and have any requests for changes that you can't do yourself I'd be glad to help. I could add melee mode into it fairly easy and the other events you may want would not be a problem. Just make sure you use the newest version.

caewen
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 13, 2003 5:09 am

Post by caewen » Mon Jun 09, 2003 4:45 am

Saw it a bit ago, looks nice:) I am just goofin right now, seeing what all i can make it do. Just was wondering why this error pops up..makin me a little nuts.

caewen

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

hmm

Post by grimjack » Mon Jun 09, 2003 5:01 am

Code: Select all

/if $left(3,"$LastTellMessage")==sow /varset CurrentBuffTarget $arg(2,"$LastTellMessage")
/if $left(4,"$LastTellMessage")==heal /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $left(6,"$LastTellMessage")==poison /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $left(7,"$LastTellMessage")==disease /varset CurrentHealTarget $arg(2,"$LastTellMessage") 
A bit confused what you are trying to do here.

Code: Select all

/if $arg(1,"$LastTellMessage")=="sow" /varset CurrentBuffTarget $arg(2,"$LastTellMessage")
/if $arg(1,"$LastTellMessage")=="heal" /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $arg(1,"$LastTellMessage")=="poison" /varset CurrentHealTarget $arg(2,"$LastTellMessage")
/if $arg(1,"$LastTellMessage")=="disease" /varset CurrentHealTarget $arg(2,"$LastTellMessage") 
If you want to check if the first word in $LastTellMessage = sow, heal, poison, or disease and if it is set a variable to the second word in $LastTellMessage, I think this would do it better.

Also you will run into a problem here too. If you send a tell of just heal with no target it might give errors.

At that point you would want to have it check if a second word exsisted with sizeof before setting the variable to the second word.

That's about all the debuging I can do on this though hehe.