cleric_ch_bot.mac (my first mac)

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

donk
decaying skeleton
decaying skeleton
Posts: 1
Joined: Fri Apr 09, 2004 1:38 pm

cleric_ch_bot.mac (my first mac)

Post by donk » Fri Apr 09, 2004 2:03 pm

hey! first i would like to say thanks to everybody out there that has contributed to this awesome tool!
It is for a boxed cleric so he doesnt require quite as much attention. It still has all my debugging /echo's in it hehe.
It is supposed to:
1. Respond to chat text that lets the cleric know its his turn to cast a CH.
2. Check to see if he should cast it.
3. Cast and notify the next cleric.
4. Respond to remote toggle commands that change how he responds.
I used pieces of that awesome casting subroutine i found in my SUB Cast but everything else is original.

I tested it and all the functions i included seem to be working. I would love some help cleaning up the variables a bit. And any of the Sub's i could combine or streamline.

Also i could use some help getting it to notice /rs and /tell seperatly.

thanks! -donk


Code: Select all

| /macro clericbot.mac (delay) (nextcleric) (maintank)
| /tell clericbot (Password) (Operation) (Arguement)
| Not sure what turbo i should use
#turbo 50
| Declare Events
#chat tell
#event Fizzle "Your spell fizzles"
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Recover "You can't use that command while casting..."
#event OutOfMana "Insufficient Mana to cast this spell!"
#event Standing "You must be standing to cast a spell"
#event Range "Your target is out of range"
Sub Main
|** Declare Variables **|
	/zapvars
	/declare Trigger global
	/declare Access global
	/declare MainTank global
	/declare NextCleric global
	/declare NextDelay global
	/declare County global
	/declare Number global
	/declare WaitToCast global
	/declare DoIt global
	/declare MyTarget global
	/declare Moving global
	/declare MySpell global
	/declare Operation global
	/declare Arguement global
	/declare OOM global
|** Preset of Variables **|
	|** CHANGE ME **|
	 /varset Trigger "cast"
	/varset Access "go"
	/varset MainTank @Param2
	/varset NextCleric @Param1
	/varset NextDelay @Param0
	/varset WaitToCast 0
	/varset DoIt "TRUE"
	/varset MyTarget @MainTank
	/varset MySpell "Complete Heal"
	/echo @Access
	
|** Main Loop **|
	:Waiting
	/doevents
	/goto :Waiting
/endmacro

Sub Event_Chat(ChatType,Sender,ChatText)
	| ****
	| Test for activation line
	| **** 
		/if "@ChatText"=="@Trigger" {
			/echo ill try to ch him
			/call CompleteHeal
			/return
		} else {
		/echo not a ch rotation
		}
		| **** put chat text into global variables 
		/echo gonna try to parse it now
		/varset Operation "$arg(2,"@ChatText")"
		/echo @Operation is what to do
		/varset Arguement "$arg(3,"@ChatText")"
		/echo @Arguement is what i should do it to
	| ****
	| Test for access.
	| ****
		/if "$arg(1,"@ChatText")"~~"@Access" {
			/echo @Sender issued a valid activation code.
		} else {
			/echo nope sorry
			/return
		}
	| **** skip turn(s)
		/echo checking for skip
		/if @Operation=="skip" {
			/echo Im skipping @Arguement Rotations!
			/varset County 1
			/varset Number @Arguement
			/call Skip
			/return
		}
		/echo not a skip
	| **** patch healing
		/if @Operation=="patch" {
			/varset County $calc(@Number+1)
			/call Patch
			/return
		}
	| **** toggle the pause (@delay) time before alerting next cleric
		/if @Operation=="delay" {
			/varset NextDelay @Arguement
			/return
		}
	| **** toggle wait time (@WaitToCast) from recieving trigger and casting CH.
		/if @Operation=="wait" {
			/varset WaitToCast @Arguement
			/return
		}
	| **** Stop the macro outright
		/if @Operation=="stop" {
			/zapvars
			/endmacro
		}
	| **** toggle the maintank (@MainTank)
		/if @Operation=="maintank" {
			/varset MainTank @Arguement
			/return
		}
	| **** toggle the cleric to go next (@NextCleric)
		/if @Operation=="nextcleric" {
			/varset NextCleric @Arguement
			/return
		}
	| **** this should boot ya from your skip loop
		/if @Operation=="resume" {
			/varset County $calc(@Number+1)
			/return
		}
	/echo whoever blah blah 
/return
Sub Skip
	/varset DoIt "FALSE"
	:TakingBreak
	/if @County>=@Number {
		/varset DoIt "TRUE"
		/echo duh
		/echo @County
		/return
	}
	/doevents
	/goto :TakingBreak
/return
Sub Patch
	/if "@MyTarget"~~"$char(name)" {
	/target myself
	} else {
	/target pc @MyTarget
	}
	/call MovingTest
	/if @Moving=="TRUE" { 
		/echo im moving so i shouldnt cast now
		/return
	}
	/varset MySpell "Supernal Light"
	/varset OOM "NULL"
	/call Cast
	/if @OOM=="CAST_OUTOFMANA" {
		/echo im oom, not gonna do it
		/return
	}
	/if @OOM=="NOT_INRANGE" {
		/echo get closer numnuts.
		/return
	}
	/echo light to @MyTarget !
/return
Sub CompleteHeal
	/if "@DoIt"=="FALSE" {
		/echo Cant make this round!
		/echo @NextCleric your up!
		/echo @County
		/echo @Number
		/varset County $calc(@County+1)
		/return
	}
	/target pc @MainTank
	/call MovingTest
	/if @Moving=="TRUE" {
		/echo Cant make this round!
		/echo @NextCleric your up!
		/return
	}
	/varset MySpell "Complete Heal"
	/echo @MySpell
	/varset OOM "NULL"
	/echo ill try to cast
	/if $target(name,clean)=="NULL" {
	/echo you dont have a target!
	/return
	}
	/call cast
	/if @OOM=="CAST_OUTOFMANA" {
		/echo oom!
		/echo @NextCleric your up!
		/return
	}
	/if @OOM=="NOT_INRANGE" {
		/echo get closer numnuts.
		/return
	}
	/if $target(name,clean)=="NULL" {
	/varset MyTarget "Target"
	}
	/echo Casting CH on --- $target(name,clean) --!
	/delay @NextDelay
	/echo @NextCleric your up!
	/varset County 0
/return
Sub MovingTest
	/varset Moving $char(ismoving)
/return
Sub cast
	 /call ClearReturnValue
  	/sendkey up up 
  	/sendkey up down 
 	 /delay 2	 
  	:StartCast
     	 /cast "@MySpell"
 	 /delay 1
  	/call ClearReturnValue
  	/doevents Fizzle
  	/doevents Recover 
  	/doevents Standing
 	 /doevents OutOfMana
 	 /doevents Range
 	/if "$return"=="CAST_OUTOFMANA" {
 	/varset OOM $return
 	 /return
 	 }
 	 /if "$return"=="NOT_INRANGE" {
 	 /varset OOM $return
 	 /return
 	 }
  /if "$return"!="NULL" /goto :StartCast
  /if "$return"=="NULL" {
  /echo casting spell
  /return
  }
/return

Sub ClearReturnValue 
/return NULL 

Sub Event_Fizzle 
/return CAST_RESTART 
Sub Event_Range
/return NOT_INRANGE

Sub Event_Recover 
  /delay 5 
/return CAST_RESTART 

Sub Event_Standing 
  /stand 
/return CAST_RESTART 

Sub Event_OutOfMana 
/return CAST_OUTOFMANA