healwatch.mac

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

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

healwatch.mac

Post by grimjack » Tue Sep 23, 2003 12:22 pm

When running will watch whatever you target and if it drops below whatever percent
Is specified it will cast whatever spell is specified.
Usage: /macro healwatch.mac percent spellname
Example /macro healwatch.mac 41 Complete Heal

Code: Select all

|  healwatch.mac
|
|  When running will watch whatever you target and if it drops below whatever percent
|  Is specified it will cast whatever spell is specified.
|
|  Usage: /macro healwatch.mac percent spellname
|  Example /macro healwatch.mac 41 Complete Heal
|
|  Version 1
|  Date: 09/23/2003


#event Collapse "Your gate is too unstable, and collapses."
#event FollowOff "You are no longer auto-following"
#event RootOff "Your Immobilize spell has worn off."
#event NoLOS "You cannot see your target."
#Event CastStart "You begin casting"
#Event CastFizzle "Your spell fizzles!"
#Event CastInterrupt "Your spell is interrupted."
#Event CastNoMana "Insufficient Mana to cast this spell"
#Event CastTooFar "Your target is out of range, get closer!"
#Event Recovered "You haven't recovered yet..."
#Event CastResist "Your target resisted "
#Event Distracted "You are too distracted to cast a spell now!"
#Event NoTarget "You must first select a target for this spell!"
#Event Sitting "You must be standing to cast a spell."
#Event NoMem "You do not seem to have that spell memorized."
#Event Stunned "You can't cast spells while stunned!"
#define HealSpell v1
#define HealPct v2
#define Fail v3
#define DoAgain v4
#define StartCast v5
#define Remem v6
#define CastTime v7
#define SpellSlot v8
#define SpellName v9
#define CTimer t1
#define OOMtimer t2
#define MasterName target(name)


Sub Main
   /if n $strlen("$p0")<=0 {
      /echo Usage: /macro healwatch.mac Percent Healspell
      /echo Example: /macro healwatch.mac 41 Complete Heal
      /end
   }
   /if n $strlen("$p1")<=0 {
      /echo Usage: /macro healwatch.mac Percent Healspell
      /echo Example /macro healwatch 41 Complete Heal
   }
   /if n $strlen("$p2")<=0 {
      /varset HealSpell "$p1"
   } else /if n $strlen("$p3")<=0 {
      /varset HealSpell "$p1 $p2"
   } else /if n $Strlen("$p4")<=0 {
      /varset HealSpell "$p1 $p2 $p3"
   } else {
      /varset HealSpell "$p1 $p2 $p3 $p4"
   }
   /varset HealPct $p0
   :HealWatchLoop
   /delay 1
   /if "$target()"=="TRUE" {
      /if n $target(hp,pct)<=$HealPct {
         /call SpellSub "$HealSpell"
      }
   }
   /goto :HealWatchLoop
/return
         
         
          
Sub SpellSub
   /stand
   /varset Remem 0
   /varset Fail 0
   /varset SpellName "$p0"
   :MemWait
   /doevents
   /if n $Fail==1 {
      /varset Fail 0
      /if n $Remem==1 {
         /memspellset default
         :loadsploop
         /delay 5
         /if $char(spellbook)=="TRUE" /goto :loadsploop
      }
      /return
   }   
   /varset SpellSlot $char(gem,"$SpellName")
   /if n $SpellSlot<0 {
      /delay 1s
      /goto :MemWait
   }
   /if n $SpellSlot==0 {
      /memspell 2 "$p0"
      /varset SpellSlot 2
      /varset Remem 1
      :refreshwait
      /doevents
      /if n $Fail==1 {
         /varset Fail 0
         /if n $Remem==1 {
            /memspellset default
            :loadsploop
            /delay 5
            /if $char(spellbook)=="TRUE" /goto :loadsploop
         }
         /return
      }   
      /delay 5
      /if n $char(gem,"$SpellName")<=0 /goto :refreshwait
   }
   /varset CastTime $spell("$SpellName",mycasttime)
   /varadd CastTime 1
   :BeginCast
   /varset Fail 0
   /varset DoAgain 0
   /varset StartCast 0
   /call WaitForStart
   :TimerLoop
   /doevents
   /if n $DoAgain==1 /goto :BeginCast
   /if n $Fail==1 {
      /varset Fail 0
      /if n $Remem==1 {
         /memspellset default
         :loadsploop
         /delay 5
         /if $char(spellbook)=="TRUE" /goto :loadsploop
      }   
      /return
   }
   /if n $CTimer>0 /goto :TimerLoop
   /delay 2
   /doevents
   /if n $DoAgain==1 /goto :BeginCast
   /if n $Remem==1 {
      /memspellset default
      :loadsploop
      /delay 5
      /if $char(spellbook)=="TRUE" /goto :loadsploop
   }   
/return


Sub WaitForStart
   /cast $SpellSlot
   :StartLoop
   /doevents
   /if n $Fail==1 /return
   /if n $DoAgain==1 /return
   /if n $StartCast==0 {
      /goto :StartLoop
   }
   /varset CTimer "$CastTime"s
/return


Sub Event_CastStart
   /varset StartCast 1
/return

Sub Event_CastFizzle
   /delay 2
   /varset DoAgain 1
/return

Sub Event_CastInterrupt
   /delay 2
   /if n $Fail==1 /return
   /varset DoAgain 1
/return

Sub Event_FollowOff
   /press esc
   /press esc
   /delay 5
   /tell $MasterName Auto Follow Off.
/return

Sub Event_Sitting
   /stand
   /delay 2
   /varset DoAgain 1
/return

Sub Event_CastTooFar
   /varset Fail 1
   /tell $MasterName Too far away.
   /varset CTimer 0
/return

Sub Event_Distracted
   /tell $MasterName I can't cast. I'm too distracted.
   /varset Fail 1
   /varset CTimer 0
/return

Sub Event_NoTarget
   /varset Fail 1
   /tell $MasterName I have no target to cast on.
   /varset CTimer 0
/return

Sub Event_NoMem
   /tell $MasterName That spell is not memed.
   /varset Fail 1
   /varset CTimer 0
/return

Sub Event_RootOff
   /tell $MasterName Root has worn off.
/return

Sub Event_CastNoMana
   /if $OOMtimer<=0 {
      /tell $MasterName I am OOM!
      /varset OOMtimer 100
      /return
   }
   /tell $MasterName OOM. Medding 13 seconds and trying again.
   /varset DoAgain 1
   /sit off
   /sit on
   /varset OOMtimer 130
   :medingwait
   /delay 1
   /doevents
   /if n $OOMtimer>0 /goto :medingwait
   /sit off
/return

Sub Event_Stunned
   /tell $MasterName Stunned waiting 3 seconds to try again.
   /delay 3s
   /varset DoAgain 1
/return

Sub Event_Recovered
   /delay 2s
   /varset DoAgain 1
/return

Sub Event_CastResist
   /tell $MasterName Resisted. Trying again.
   /varset DoAgain 1
/return

Sub Event_Collapse
   /varset DoAgain 1
/return

Sub Event_NoLOS
   /tell $MasterName I can't see my target.
   /varset Fail 1
   /varset CTimer 0
/return

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack