Am I on the right track?

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

Article22
decaying skeleton
decaying skeleton
Posts: 6
Joined: Fri Feb 27, 2004 4:21 am

Am I on the right track?

Post by Article22 » Fri Feb 27, 2004 4:28 am

Hiya,

Just starting to get into the mad world of MQ2, and wondered if I could get a few pointers on writing Macros?

Here is the code I have come up with so far, it is cribbed from a few sources, but I am trying to sort out a Shaman Bot which both responds to simple events from me (Incoming, Mob dead, End session) as well as rebuff automatically.

I have also tried to add in a simple "Get me out of here" procedure as I hate loops with no end :)

Anyway here is the code, thanks in advance.

Article22.

Code: Select all

|** 
  Shaman Bot
  ShmBot.mac

  Assumes that Shaman is on a lizard/horse, has epic, Canni5 and spells

  Pseudo code of actions required:
  If MA is < 80% and Quiescence hasnt been cast
	cast Quiescence
  If MA is < 40% 
	cast Tnarg's Mending
  On 'incoming' tell 
	assist MA
	wait for target to be in range
	cast Turgur's Insects
	pet attack
	activate epic
	cast Quiescence
  On Death of pet, MA or health dropping below 40%
	cast Gate
	camp to desktop
  When my health drops below 80%
	cast Quiescence
  When mana drops below 60% and CanniV is up
	cast Quiescence
	wait till health hits 100%
	cast Cannibalize V AA ability
  When mana drops below 60% and CanniV isnt up
	cast Quiescence
	cast Cannibalize IV lots
  When Haste wears off pet
	cast Swift like the Wind on pet
	cast Swift like the Wind on MA
	cast Talisman of the Boar on MA
	cast Talisman of the Boar on me
  When Focus wears off me
	cast Focus of Soul on me
	cast Focus of Soul on MA
	cast Focus of Soul on puppy
 
  Version 1
**|

#turbo 10
#chat tell 

/include SpellCast.inc

#event HasteGone "Your pet's Swift like the Wind spell has worn off."
#event QuiescenceGone "Your state of quiescence ends."

Sub Main 
   /declare MAName global 
   /declare HasteGone global 
   /declare BattleMode global 
   /declare QuiescenceCast timer
   /declare CannAATimer timer

   /if $defined(Param0)==FALSE { 
      /echo Usage: /macro shmbot.mac MA_name 
      /echo Example: /macro shmbot.mac Furor 
      /end 
   } 

   /varset MAName @Param0 
   /varset HasteGone 1
   /varset BattleMode 0

   /if n $char(pet)=0 { 
      /call Cast "True Spirit"
   }

   :WatchLoop
   /delay 1 

   /if n $char(pet)=0 { 
      /call TimeToGo
   }
   /if n $char(hp,pct)<40 {
      /call TimeToGo
   }

   /if n @BattleMode==0 { 
      /if n $char(mana,pct)<60 {
         /call GatherMana
      }
   }

   /if n @BattleMode==0 { 
      /if n $char(hp,pct)<80 {
         /target myself
         /if n $char(buff,"Quiescence")==0 {
            /call Cast "Quiescence" 
         }
      }
   }

   /target @MAName 
   /if n $target(distance)>200 { 
      /return
   }

   /if n $target(hp,pct)<=80 { 
      /if n QuiescenceCast=0 { 
         /call WaitForQuiescence
      }
   } 

   /if n $target(hp,pct)<=40 { 
      /call Cast "Tnarg's Mending" 
   } 

   /if n @BattleMode==0 { 
      /if n $char(buff,"Focus of Soul")==0 {
         /call FocusMode
      }
   }

   /if n @BattleMode==0 { 
      /if n @HasteGone==1 { 
         /call BuffMode
      }
   }

   /if n @BattleMode==1 { 
      /call BattleMode
   }

   /goto :WatchLoop

/return 

Sub WaitForQuiescence
   /if @QuiescenceCast<=1 { 
      /call Cast "Quiescence" 
      /varset QuiescenceCast 24s
   }
/report

Sub BattleMode
   /assist @MAName 
   /call WaitForTarget 30
   /call Cast "Turgur's Insects"
   /pet attack
   /delay 1s
   /call Cast "Spear of Fate" item
   /delay 1s
   /assist 
   /call Cast "Quiescence" 
   /varset QuiescenceCast 24s
   /varset BattleMode 2
/return

Sub FocusMode
   /target myself
   /call Cast "Focus of Soul" 
   /target pet 
   /call Cast "Focus of Soul" 
   /target @MAName 
   /call Cast "Focus of Soul" 
/return

Sub BuffMode
   /target myself
   /call Cast "Endurance of the Boar" 
   /target pet 
   /call Cast "Swift like the Wind" 
   /target @MAName 
   /call Cast "Swift like the Wind" 
   /call Cast "Endurance of the Boar"
   /call Cast "Spirit of Wolf"
   /varset HasteGone 0
/return

Sub GatherMana
   /call Cast "Quiescence"
   /if n $char(hp,pct)>80 { 
      /if @CannAATimer<=1 { 
         /alt activate 47 
         /varset CannAATimer 3m
         /return
      } 
   }
   /call Cast "Cannibalize IV" 
   /call Cast "Cannibalize IV" 
   /call Cast "Cannibalize IV" 
   /call Cast "Cannibalize IV" 
   /call Cast "Cannibalize IV" 
   /call Cast "Cannibalize IV" 
/return

Sub WaitForTarget (Distance)
   :WaitForTarget
   /doevents 
   /if n $target(Distance)<@Distance { 
      /return
   }
   /delay 1s
   /goto :WaitForTarget
/return

Sub TimeToGo
   /call SpellSub "Gate"
   /camp desktop 
   /endmacro
/return

Sub Event_HasteGone
   /varset HasteGone 1
/return

Sub Event_Chat (MsgType, MsgFrom, MsgText)
  /if "@MsgText"~~"incoming" /varset BattleMode 1
  /if "@MsgText"~~"mob dead" /varset BattleMode 0
  /if "@MsgText"~~"end session" /call TimeToGo
/return