cast.mac - Spell Trainer (Updated: 12/10/2003)

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

serberus
a lesser mummy
a lesser mummy
Posts: 58
Joined: Tue Nov 19, 2002 5:04 am

cast.mac - Spell Trainer (Updated: 12/10/2003)

Post by serberus » Sat Oct 11, 2003 11:54 pm

This is an AFK spell trainer I wrote, the code is terribly formatted but should work, i've tested it and it seems to work, I haven't tested it very thoroughly though. I have completely written this myself, it doesn't include any other macros, there might be bits of code i've pulled from other macro's but I can't see them at the moment, the usage and features are as follows:

syntax: /macro cast <target> <spell 1,skill type> <spell 2,skill type> <spell 3,skill type> <spell 4,skill type> <spell 5,skill type>
example: /macro cast myself "spirit of wolf,alt" "courage,abj"

You must memorize the spells you want to use yourself, this will not do it for you, this is so it can be used in the new UI.

You can get help on how to use it by calling the macro without any parameters... "/macro cast"

Features:
-Casts what ever spells you tell it to until your skill for that casting type is maxxed out for your level cap.
-Very robust casting system, will cast through interrupts, fizzles and any error that can really occur, it lets you know if anything drastic goes wrong, it'll end the macro and tell you why...
-Casts until your OOM and then meditates and starts all over again
-Automatically calculates the required delay for casts and recasts
-Supports upto 9 different spells (although only 5 required due to only 5 skill types)
-GM detection
-unimplemented player detection, it's all coded in and ready to work but there is a problem with the way it works, I didn't want to keep using /target to see if a PC was in range, so I used a PC alert but it picks up yourself, and I can't find anyway to make the alerts ignore yourself, it checks to see if any PC with a vowel in their name is within a range, so there is a chance that it might miss people, but I couldn't find anyone without a vowel in their name, so it should be pretty reliable.

http://macroquest2.com/phpBB2/viewtopic.php?t=1583

Code: Select all

#event castmcr_err_oom "Insufficient Mana to cast this spell!"
#event castmcr_err_range "Your target is out of range, get closer!"
#event castmcr_err_fizzle "Your spell fizzles!"
#event castmcr_err_interrupt "Your spell is interrupted."
#event castmcr_err_recovered "You haven't recovered yet..."
#event castmcr_err_standing "You must be standing to cast a spell."
#event castmcr_err_target "You must first select a target for this spell!"
#event castmcr_err_cannotsee "You cannot see your target."
#event castmcr_err_recovery "Spell recovery time not yet met."
#event castmcr_err_memorized "You do not seem to have that spell memorized."
#define spellmaxskill_ 235
#define alertlistno_ 9
#define alertpcradius_ 250

Sub Main 

/declare castmcr_parametercur global
/declare castmcr_spellidno global
/declare castmcr_spellname global
/declare castmcr_spelltype global
/declare castmcr_spellcycle global
/declare castmcr_spellmaxskill global
/declare castmcr_spellskillabj global
/declare castmcr_spellskillalt global
/declare castmcr_spellskillcon global
/declare castmcr_spellskillevo global
/declare castmcr_spellskilldiv global
/declare castmcr_spellnull global
/declare castmcr_parameter0 global
/declare castmcr_parameter1 global
/declare castmcr_parameter2 global
/declare castmcr_parameter3 global
/declare castmcr_parameter4 global
/declare castmcr_parameter5 global
/declare castmcr_parameter6 global
/declare castmcr_parameter7 global
/declare castmcr_parameter8 global
/declare castmcr_parameter9 global
/declare castmcr_castingchecktimer timer

/if "@Param0"!~"Param0" /varset castmcr_parameter0 "@Param0"
/if "@Param1"!~"Param1" /varset castmcr_parameter1 "@Param1"
/if "@Param2"!~"Param2" /varset castmcr_parameter2 "@Param2"
/if "@Param3"!~"Param3" /varset castmcr_parameter3 "@Param3"
/if "@Param4"!~"Param4" /varset castmcr_parameter4 "@Param4"
/if "@Param5"!~"Param5" /varset castmcr_parameter5 "@Param5"
/if "@Param6"!~"Param6" /varset castmcr_parameter6 "@Param6"
/if "@Param7"!~"Param7" /varset castmcr_parameter7 "@Param7"
/if "@Param8"!~"Param8" /varset castmcr_parameter8 "@Param8"
/if "@Param9"!~"Param9" /varset castmcr_parameter9 "@Param9"
/call castmcr_casting
/alert clear alertlistno_

/return

Sub castmcr_casting
/if n $strlen("@castmcr_parameter1")==0 {
	/call castmcr_instructions
	/return
}

/varset castmcr_parametercur 0
/alert clear alertlistno_
/alert add alertlistno_ pc radius alertpcradius_ a
/alert add alertlistno_ pc radius alertpcradius_ e
/alert add alertlistno_ pc radius alertpcradius_ i
/alert add alertlistno_ pc radius alertpcradius_ o
/alert add alertlistno_ pc radius alertpcradius_ u
/if "@castmcr_parameter0"==#current /goto :castmcr_loop
/target "@castmcr_parameter0"
:castmcr_loop

/if $target()==FALSE {
	/echo 'Cast Macro' No valid target, ending macro
	/call castmcr_endmacro
}

/call castmcr_spellset
/call castmcr_spellskills
/call castmcr_spellmemorized

/if n $return==1 /goto :castmcr_loop

/if n @castmcr_spellnull==1 {
	/echo 'Cast Macro' Macro Ended - Skills:
	/echo 'Cast Macro' Alteration ($char(skill,alteration)/@castmcr_spellmaxskill)
	/echo 'Cast Macro' Abjuration ($char(skill,abjuration)/@castmcr_spellmaxskill)
	/echo 'Cast Macro' Conjuration ($char(skill,conjuration)/@castmcr_spellmaxskill)
	/echo 'Cast Macro' Divination ($char(skill,divination)/@castmcr_spellmaxskill)
	/echo 'Cast Macro' Evocation ($char(skill,evocation)/@castmcr_spellmaxskill)
	/return
}

/call castmcr_spellcast
/goto :castmcr_loop

/return

Sub castmcr_spellset
/varadd castmcr_parametercur 1
/if n $int(@castmcr_parametercur)==1 /call castmcr_spellidset "@castmcr_parameter1"
/if n $int(@castmcr_parametercur)==2 /call castmcr_spellidset "@castmcr_parameter2"
/if n $int(@castmcr_parametercur)==3 /call castmcr_spellidset "@castmcr_parameter3"
/if n $int(@castmcr_parametercur)==4 /call castmcr_spellidset "@castmcr_parameter4"
/if n $int(@castmcr_parametercur)==5 /call castmcr_spellidset "@castmcr_parameter5"
/if n $int(@castmcr_parametercur)==6 /call castmcr_spellidset "@castmcr_parameter6"
/if n $int(@castmcr_parametercur)==7 /call castmcr_spellidset "@castmcr_parameter7"
/if n $int(@castmcr_parametercur)==8 /call castmcr_spellidset "@castmcr_parameter8"
/if n $int(@castmcr_parametercur)==9 /call castmcr_spellidset "@castmcr_parameter9"
/if n $int(@castmcr_parametercur)>=10 /varset castmcr_spellnull 1
/varset castmcr_spellname "$left($calc($strlen("@castmcr_spellidno")-4),"@castmcr_spellidno")"
/varset castmcr_spelltype $right(3,"@castmcr_spellidno")
/varset castmcr_spellcycle $calc($calc($calc($spell("@castmcr_spellname",casttime)+$if(n,$spell("@castmcr_spellname",recasttime)<$spell("@castmcr_spellname",recoverytime),$spell("@castmcr_spellname",recoverytime),$spell("@castmcr_spellname",recasttime)))*10)+5)
/if n $int($calc($char(level)*5+5))<=spellmaxskill_ /varset castmcr_spellmaxskill $int($calc($char(level)*5+5))
/if n $int($calc($char(level)*5+5))>=spellmaxskill_ /varset castmcr_spellmaxskill spellmaxskill_
/call castmcr_spelltype
/return

Sub castmcr_spellcast
/stand
/echo 'Cast Macro' Casting: "@castmcr_spellname" to raise "@castmcr_spelltype" from skill level "$char(skill,"@castmcr_spelltype")" to "@castmcr_spellmaxskill" (level cap)
:castmcr_spellcastloop
/if n $char(skill,@castmcr_spelltype)>=@castmcr_spellmaxskill {
	/echo 'Cast Macro' "@castmcr_spelltype" cap reached.
	/return
	}



|		/if $alert(alertlistno_)==TRUE {
|		/echo 'Cast Macro' Player detected nearby, pausing for 5 seconds and trying again.
|		/delay 50
|		/goto :castmcr_spellcastloop
|		}



/if $gm==TRUE {
	/echo 'Cast Macro' A GM or Guide has been detected in the zone, the macro will be paused and the screen filled with '/who all' information, the macro will resume  when the zone is clear of GM/Guides
	/who all
	/goto :castmcr_spellcastloop
}

/call castmcr_castingcheck
/goto :castmcr_spellcastloop

/return

Sub castmcr_spellskills
/varset castmcr_spellskillabj $char(skill,abjuration)
/varset castmcr_spellskillalt $char(skill,alteration)
/varset castmcr_spellskillcon $char(skill,conjuration)
/varset castmcr_spellskillevo $char(skill,evocation)
/varset castmcr_spellskilldiv $char(skill,divination)

/return

Sub castmcr_instructions
/echo 'Cast Macro' Usage: /macro cast <target> <spell one,skill type> <spell two,skill type> <spell three,skill type> <spell four,skill type> <spell five,skill type>
/echo 'Cast Macro' Usage: skill types: Abjuration (abj); Alteration (alt); Conjuration (con); Divination (div); Evocation (evo)
/echo 'Cast Macro' Usage: example: /macro cast "player's corpse" "spirit of wolf,alt" "blessing of aegolism,abj" "invisibility versus undead,div" "summon drink,con" "burst of flame,evo"
/echo 'Cast Macro' Usage: The best target's for casting skill ups are player corpses with plenty of time left on their expiration timer, alternatively use 'myself' to target yourself.
/echo 'Cast Macro' Usage: You can have the macro use your current target by entering "#current" for your target, e.g. /macro cast #current "spirit of wolf,alt"
/echo 'Cast Macro' Usage: You must have your spells memorized prior to running this macro, it will not memorize them for you, this macro works in the new UI because of this.

/return

Sub Event_castmcr_err_oom
/if n $char(mana,pct)==100 {
	/echo 'Cast Macro' Your mana pool is too small to cast "@castmcr_spellname", ending macro
	/call castmcr_endmacro
}

/stand
/sit

:castmcr_medloop
/if n $char(mana,pct)==100 {
	/stand
	/return
}

/delay 10
/goto :castmcr_medloop

/return

Sub Event_castmcr_err_range
/echo 'Cast Macro' no target in range, ending macro.
/call castmcr_endmacro

/return

Sub Event_castmcr_err_fizzle
/return 1

Sub Event_castmcr_err_interrupt
/return 1

Sub Event_castmcr_err_recovered
/return 1

Sub Event_castmcr_err_target
/target @castmcr_parameter0
/return 1

Sub Event_castmcr_err_standing
/stand
/return 1

Sub Event_castmcr_err_powerful
/echo 'Cast Macro' Your target is too low level, please select a new target, preferably level 42+, ending macro.
/call castmcr_endmacro
/return 1

Sub Event_castmcr_err_cannotsee
/echo 'Cast Macro' You are unable to see your target, please select a new target, ending macro.
/call castmcr_endmacro
/return 1

Sub Event_castmcr_err_memorized
/echo 'Cast Macro' "@castmcr_spellname" has become unavailable, please check your spell list and restart the macro, ending macro.
/call castmcr_endmacro
/return 1

Sub Event_castmcr_err_recovery
/return 1

Sub castmcr_resetreturn
/return 0

Sub castmcr_spelltype
/if "@castmcr_spelltype"=="alt" {
	/varset castmcr_spelltype Alteration
	/return
}

/if "@castmcr_spelltype"=="abj" {
	/varset castmcr_spelltype Abjuration
	/return
}

/if "@castmcr_spelltype"=="con" {
	/varset castmcr_spelltype Conjuration
	/return
}

/if "@castmcr_spelltype"=="div" {
	/varset castmcr_spelltype Divination
	/return
}

/if "@castmcr_spelltype"=="evo" {
	/varset castmcr_spelltype Evocation
	/return
}

/echo 'Cast Macro' invalid skill type entered, please check the macro parameters, type "/macro cast" for help, ending macro.
/call castmcr_endmacro

/return 1

Sub castmcr_spellidset
/if "@Param0"~~UNDEFINED {
	/varset castmcr_spellnull 1
	/return
}

/varset castmcr_spellidno "@Param0"

/return

Sub castmcr_castingcheck
:castmcr_castingloop
/varset castmcr_castingchecktimer @castmcr_spellcycle
/call castmcr_resetreturn
/cast "@castmcr_spellname"
:castmcr_castingcheckloop
/doevents
/if n $return>=1 /goto :castmcr_castingloop
/if @castmcr_castingchecktimer!=0 /goto :castmcr_castingcheckloop

/return

Sub castmcr_spellmemorized
/call castmcr_resetreturn
/if n @castmcr_spellnull==1 /return
/if n $char(gem,"@castmcr_spellname")==0 {
	/echo 'Cast Macro' Spell "@castmcr_spellname" not memorized, please check the macro parameters, type "/macro cast" for help, moving to next in list.
	/return 1
}

/return

Sub castmcr_endmacro
/alert clear alertlistno_
/stand
/sit
/endmacro
/return
Last edited by serberus on Mon Jan 12, 2004 12:39 pm, edited 4 times in total.

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sun Oct 12, 2003 2:49 am

I typed /macro cast myself 'Lesser Shielding, abj" ( and I tried other spells and got the same message)..and got the following error: ( I deleted my name though..

[Sun Oct 12 00:45:58 2003] Alert list 9 cleared.
[Sun Oct 12 00:45:58 2003] Added alert for: (0-100) player a Radius:250.00
[Sun Oct 12 00:45:58 2003] Added alert for: (0-100) player e Radius:250.00
[Sun Oct 12 00:45:58 2003] Added alert for: (0-100) player i Radius:250.00
[Sun Oct 12 00:45:58 2003] Added alert for: (0-100) player o Radius:250.00
[Sun Oct 12 00:45:58 2003] Added alert for: (0-100) player u Radius:250.00
[Sun Oct 12 00:45:58 2003] Selected 'Mynamehere'...
[Sun Oct 12 00:45:58 2003] Ending macro: Subroutine castmcr_spellidset wasn't found
[Sun Oct 12 00:45:58 2003] cast.mac@92 (castmcr_spellset): /if n $int(@castmcr_parametercur)==1 /call castmcr_spellidset "@castmcr_parameter1"
[Sun Oct 12 00:45:58 2003] cast.mac@74 (castmcr_casting): /call castmcr_spellset
[Sun Oct 12 00:45:58 2003] cast.mac@51 (Main): /call castmcr_casting
[Sun Oct 12 00:45:58 2003] Cleared the following: Timers Vars Arrays
[Sun Oct 12 00:45:58 2003] The current macro has ended.

serberus
a lesser mummy
a lesser mummy
Posts: 58
Joined: Tue Nov 19, 2002 5:04 am

Untested

Post by serberus » Sun Oct 12, 2003 8:52 am

Sorry, I hadn't tested this macro, I edited it quickly to match the new specification when I posted my other macro, i'll test it and get it updated within a few hours from now.

Serberus

lost_man
orc pawn
orc pawn
Posts: 11
Joined: Sat Oct 11, 2003 5:52 pm

Post by lost_man » Sun Oct 12, 2003 7:58 pm

Tested this one and it works fine. Now all I would like is a way to get the PC nearby function to work. Thanks for all the work on this one.

User avatar
Undies
a ghoul
a ghoul
Posts: 94
Joined: Mon Oct 20, 2003 9:12 pm

Post by Undies » Mon Oct 20, 2003 9:23 pm

OK I am a complete newbie and this was my first macro I have tested!
Seemed to work OK with just one minor problem.

My Cleric can only conjure items (like summon water) and it would be nice if I could destroy the item immediately after casting rather than having them collect in my hand. I would think this would be trivial but I cannot see a command to destroy an item you are holding in the command list.

Also a minor preference would be to have it run through the list of spells before trying the spells again rather than continually trying the first until skill maxed then going on to the next spell etc. for 2 reasons:
- increases all casting skills at same rate (if you do not want to leave unattented until finished)
- some spells (eg. yaulp) have a long recast timer on themselves but could be casting something else in the meantime waiting for refresh.

These are just very minor points and maybe if I had a clue what I was doing could look into it myself (good spot to start learning I guess). Great job otherwise!

User avatar
Undies
a ghoul
a ghoul
Posts: 94
Joined: Mon Oct 20, 2003 9:12 pm

Post by Undies » Tue Oct 21, 2003 6:25 am

OK I made a few changes to get the PC and GM alarms working correctly. I also made it so that any summoned items are deleted. I'll edit any problems I find...

Code: Select all

#event castmcr_err_oom "Insufficient Mana to cast this spell!" 
#event castmcr_err_range "Your target is out of range, get closer!" 
#event castmcr_err_fizzle "Your spell fizzles!" 
#event castmcr_err_interrupt "Your spell is interrupted." 
#event castmcr_err_recovered "You haven't recovered yet..." 
#event castmcr_err_standing "You must be standing to cast a spell." 
#event castmcr_err_target "You must first select a target for this spell!" 
#event castmcr_err_cannotsee "You cannot see your target." 
#event castmcr_err_recovery "Spell recovery time not yet met." 
#event castmcr_err_memorized "You do not seem to have that spell memorized." 
#define spellmaxskill_ 235 
#define alertlistno_ 9 
#define alertpcradius_ 100

Sub Main 

/declare castmcr_parametercur global 
/declare castmcr_spellidno global 
/declare castmcr_spellname global 
/declare castmcr_spelltype global 
/declare castmcr_spellcycle global 
/declare castmcr_spellmaxskill global 
/declare castmcr_spellskillabj global 
/declare castmcr_spellskillalt global 
/declare castmcr_spellskillcon global 
/declare castmcr_spellskillevo global 
/declare castmcr_spellskilldiv global 
/declare castmcr_spellnull global 
/declare castmcr_parameter0 global 
/declare castmcr_parameter1 global 
/declare castmcr_parameter2 global 
/declare castmcr_parameter3 global 
/declare castmcr_parameter4 global 
/declare castmcr_parameter5 global 
/declare castmcr_parameter6 global 
/declare castmcr_parameter7 global 
/declare castmcr_parameter8 global 
/declare castmcr_parameter9 global 
/declare castmcr_castingchecktimer timer 

/if "@Param0"!~"Param0" /varset castmcr_parameter0 "@Param0" 
/if "@Param1"!~"Param1" /varset castmcr_parameter1 "@Param1" 
/if "@Param2"!~"Param2" /varset castmcr_parameter2 "@Param2" 
/if "@Param3"!~"Param3" /varset castmcr_parameter3 "@Param3" 
/if "@Param4"!~"Param4" /varset castmcr_parameter4 "@Param4" 
/if "@Param5"!~"Param5" /varset castmcr_parameter5 "@Param5" 
/if "@Param6"!~"Param6" /varset castmcr_parameter6 "@Param6" 
/if "@Param7"!~"Param7" /varset castmcr_parameter7 "@Param7" 
/if "@Param8"!~"Param8" /varset castmcr_parameter8 "@Param8" 
/if "@Param9"!~"Param9" /varset castmcr_parameter9 "@Param9" 
/call castmcr_casting 
|/alert clear alertlistno_ 

/return 

Sub castmcr_casting 
/if n $strlen("@castmcr_parameter1")==0 { 
   /call castmcr_instructions 
   /return 
} 

/varset castmcr_parametercur 0 
|/alert clear alertlistno_ 
/alert add alertlistno_ pc radius alertpcradius_ a 
/alert add alertlistno_ pc radius alertpcradius_ e 
/alert add alertlistno_ pc radius alertpcradius_ i 
/alert add alertlistno_ pc radius alertpcradius_ o 
/alert add alertlistno_ pc radius alertpcradius_ u 

/if "@castmcr_parameter0"==#current /goto :castmcr_loop 
/target "@castmcr_parameter0" 
:castmcr_loop 

/if $target()==FALSE { 
   /echo 'Cast Macro' No valid target, ending macro 
   /call castmcr_endmacro 
} 

/call castmcr_spellset 
/call castmcr_spellskills 
/call castmcr_spellmemorized 

/if n $return==1 /goto :castmcr_loop 

/if n @castmcr_spellnull==1 { 
   /echo 'Cast Macro' Macro Ended - Skills: 
   /echo 'Cast Macro' Alteration ($char(skill,alteration)/@castmcr_spellmaxskill) 
   /echo 'Cast Macro' Abjuration ($char(skill,abjuration)/@castmcr_spellmaxskill) 
   /echo 'Cast Macro' Conjuration ($char(skill,conjuration)/@castmcr_spellmaxskill) 
   /echo 'Cast Macro' Divination ($char(skill,divination)/@castmcr_spellmaxskill) 
   /echo 'Cast Macro' Evocation ($char(skill,evocation)/@castmcr_spellmaxskill) 
   /return 
} 

/call castmcr_spellcast 
/goto :castmcr_loop 

/return 

Sub castmcr_spellset 
/varadd castmcr_parametercur 1 
/if n $int(@castmcr_parametercur)==1 /call castmcr_spellidset "@castmcr_parameter1" 
/if n $int(@castmcr_parametercur)==2 /call castmcr_spellidset "@castmcr_parameter2" 
/if n $int(@castmcr_parametercur)==3 /call castmcr_spellidset "@castmcr_parameter3" 
/if n $int(@castmcr_parametercur)==4 /call castmcr_spellidset "@castmcr_parameter4" 
/if n $int(@castmcr_parametercur)==5 /call castmcr_spellidset "@castmcr_parameter5" 
/if n $int(@castmcr_parametercur)==6 /call castmcr_spellidset "@castmcr_parameter6" 
/if n $int(@castmcr_parametercur)==7 /call castmcr_spellidset "@castmcr_parameter7" 
/if n $int(@castmcr_parametercur)==8 /call castmcr_spellidset "@castmcr_parameter8" 
/if n $int(@castmcr_parametercur)==9 /call castmcr_spellidset "@castmcr_parameter9" 
/if n $int(@castmcr_parametercur)>=10 /varset castmcr_spellnull 1 
/varset castmcr_spellname "$left($calc($strlen("@castmcr_spellidno")-4),"@castmcr_spellidno")" 
/varset castmcr_spelltype $right(3,"@castmcr_spellidno") 
/varset castmcr_spellcycle $calc($calc($calc($calc($spell("@castmcr_spellname",casttime)+$spell("@castmcr_spellname",recasttime))+$if(n,$spell("

@castmcr_spellname",recasttime)<$spell("@castmcr_spellname",recoverytime),$spell("@castmcr_spellname",recoverytime),0))*10)+5) 
/if n $int($calc($char(level)*5+5))<=spellmaxskill_ /varset castmcr_spellmaxskill $int($calc($char(level)*5+5)) 
/if n $int($calc($char(level)*5+5))>=spellmaxskill_ /varset castmcr_spellmaxskill spellmaxskill_ 
/call castmcr_spelltype 
/return 

Sub castmcr_spellcast 

/stand 
/echo 'Cast Macro' Casting: "@castmcr_spellname" to raise "@castmcr_spelltype" from skill level "$char(skill,"@castmcr_spelltype")" to "

@castmcr_spellmaxskill" (level cap) 

:castmcr_spellcastloop 
/if n $char(skill,@castmcr_spelltype)>=@castmcr_spellmaxskill { 
   /echo 'Cast Macro' "@castmcr_spelltype" cap reached. 
   /return 
   } 


|check if player near
      /if $alert(alertlistno_)==TRUE { 
         /sit
         /echo 'Cast Macro' Player detected nearby 
         /who PC radius alertpcradius_
         } /else {
            /goto :no_player
         }
:test_player
      /if $alert(alertlistno_)==TRUE { 
         /beep
         /delay 50
         /goto :test_player
      }
:no_player
/stand

/if $gm==TRUE { 
   /echo 'Cast Macro' A GM or Guide has been detected in the zone, the macro will be paused and the screen filled with '/who all' information, the macro will 

resume  when the zone is clear of GM/Guides 
   /who all 
   /sit
} /else {
  /goto :no_gm
}
:test_gm
/if $gm==TRUE { 
   /beep
   /delay 50
   /goto :test_gm
}
:no_gm
/stand 

/call castmcr_castingcheck 
/goto :castmcr_spellcastloop 

/return 

Sub castmcr_spellskills 
/varset castmcr_spellskillabj $char(skill,abjuration) 
/varset castmcr_spellskillalt $char(skill,alteration) 
/varset castmcr_spellskillcon $char(skill,conjuration) 
/varset castmcr_spellskillevo $char(skill,evocation) 
/varset castmcr_spellskilldiv $char(skill,divination) 

/return 

Sub castmcr_instructions 
/echo 'Cast Macro' Usage: /macro cast <target> <spell one,skill type> <spell two,skill type> <spell three,skill type> <spell four,skill type> <spell 

five,skill type> 
/echo 'Cast Macro' Usage: skill types: Abjuration (abj); Alteration (alt); Conjuration (con); Divination (div); Evocation (evo) 
/echo 'Cast Macro' Usage: example: /macro cast "player's corpse" "spirit of wolf,alt" "blessing of aegolism,abj" "invisibility versus undead,div" "summon 

drink,con" "burst of flame,evo" 
/echo 'Cast Macro' Usage: The best target's for casting skill ups are player corpses with plenty of time left on their expiration timer, alternatively use 

'myself' to target yourself. 
/echo 'Cast Macro' Usage: You can have the macro use your current target by entering "#current" for your target, e.g. /macro cast #current "spirit of 

wolf,alt" 
/echo 'Cast Macro' Usage: You must have your spells memorized prior to running this macro, it will not memorize them for you, this macro works in the new UI 

because of this. 

/return 

Sub Event_castmcr_err_oom 
/if n $char(mana,pct)==100 { 
   /echo 'Cast Macro' Your mana pool is too small to cast "@castmcr_spellname", ending macro 
   /call castmcr_endmacro 
} 

/sit 

:castmcr_medloop 
/if n $char(mana,pct)==100 { 
   /stand 
   /return 
} 

/delay 10 
/goto :castmcr_medloop 

/return 

Sub Event_castmcr_err_range 
/echo 'Cast Macro' no target in range, ending macro. 
/call castmcr_endmacro 

/return 

Sub Event_castmcr_err_fizzle 
/return 1 

Sub Event_castmcr_err_interrupt 
/return 1 

Sub Event_castmcr_err_recovered 
/return 1 

Sub Event_castmcr_err_target 
/target @castmcr_parameter0 
/return 1 

Sub Event_castmcr_err_standing 
/stand 
/return 1 

Sub Event_castmcr_err_powerful 
/echo 'Cast Macro' Your target is too low level, please select a new target, preferably level 42+, ending macro. 
/call castmcr_endmacro 
/return 1 

Sub Event_castmcr_err_cannotsee 
/echo 'Cast Macro' You are unable to see your target, please select a new target, ending macro. 
/call castmcr_endmacro 
/return 1 

Sub Event_castmcr_err_memorized 
/echo 'Cast Macro' "@castmcr_spellname" has become unavailable, please check your spell list and restart the macro, ending macro. 
/call castmcr_endmacro 
/return 1 

Sub Event_castmcr_err_recovery 
/return 1 

Sub castmcr_resetreturn 
/return 0 

Sub castmcr_spelltype 
/if "@castmcr_spelltype"=="alt" { 
   /varset castmcr_spelltype Alteration 
   /return 
} 

/if "@castmcr_spelltype"=="abj" { 
   /varset castmcr_spelltype Abjuration 
   /return 
} 

/if "@castmcr_spelltype"=="con" { 
   /varset castmcr_spelltype Conjuration 
   /return 
} 

/if "@castmcr_spelltype"=="div" { 
   /varset castmcr_spelltype Divination 
   /return 
} 

/if "@castmcr_spelltype"=="evo" { 
   /varset castmcr_spelltype Evocation 
   /return 
} 

/echo 'Cast Macro' invalid skill type entered, please check the macro parameters, type "/macro cast" for help, ending macro. 
/call castmcr_endmacro 

/return 1 

Sub castmcr_spellidset 
/if "@Param0"~~UNDEFINED { 
   /varset castmcr_spellnull 1 
   /return 
} 

/varset castmcr_spellidno "@Param0" 

/return 

Sub castmcr_castingcheck 
:castmcr_castingloop 
/varset castmcr_castingchecktimer @castmcr_spellcycle 
/call castmcr_resetreturn 
/cast "@castmcr_spellname" 
:castmcr_castingcheckloop 
/doevents 
/if n $return>=1 /goto :castmcr_castingloop 
/if @castmcr_castingchecktimer!=0 /goto :castmcr_castingcheckloop 

| any summoned items get destroyed
/if "$cursor(name)"~~"Summoned" { 
   /click left destroy 
|   /delay 1s 
} 

/return 

Sub castmcr_spellmemorized 
/call castmcr_resetreturn 
/if n @castmcr_spellnull==1 /return 
/if n $char(gem,"@castmcr_spellname")==0 { 
   /echo 'Cast Macro' Spell "@castmcr_spellname" not memorized, please check the macro parameters, type "/macro cast" for help, moving to next in list. 
   /return 1 
} 

/return 

Sub castmcr_endmacro 
|/alert clear alertlistno_ 
|/stand 
/sit 
/endmacro 
/return

ShMallow

Post by ShMallow » Tue Nov 04, 2003 1:40 pm

Cant seen to get it to work, im sort of a newbie so i didint try to tweak whit it.

But i keep getting the 3 reasons why it wont work

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Tue Nov 04, 2003 3:04 pm

What exactly do you type, and what does it respond with?

User avatar
N0ne
decaying skeleton
decaying skeleton
Posts: 4
Joined: Tue Nov 04, 2003 6:36 pm

Post by N0ne » Tue Nov 04, 2003 8:46 pm

HEllo all,
that macro works fine for me.

except I can pratique only 1 spellz at the time.

/macro cast myself "Deadeye,div" "Minor Shielding,abj"

it's always cast the first spellz in the line.
Thanks for the help

ShMallow

Post by ShMallow » Tue Nov 04, 2003 10:17 pm

exacly what it says to type.

/macro cast myself "Light Healing,alt"

Guest

Post by Guest » Wed Nov 05, 2003 7:28 pm

and what happens when you try to run it? hard to help you when we don't know what the problem is. saying "it doesn't work" isn't much help ;)

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Wed Nov 05, 2003 7:38 pm

Stupid cookies....

That was me above.

morgar
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sun Nov 09, 2003 4:01 am

Post by morgar » Sun Nov 09, 2003 4:05 am

Hi I'm trying to use the macro from above. It kinda works until I am oom, but I am not sure I understand why I get the following errors:

Couldn't Parse '@castmcr_spellname",recasttime)<$spell("@castmcr_spellname",recoverytime),$spell("@castmcr_spellname",recoverytime),0))*10)+5)'

Casting "Spirit Of Wolf" to raise "alteration" from skill level "109" t0 "

Couldn't Parse '@castmcr_spellmaxskill" (level cap)'

Any help would be appreciated :) Thanks.

Guest

Post by Guest » Sun Nov 09, 2003 4:32 pm

i had the same problem too. it's a problem with cutting and pasting the code. there is a end line at those spots in your code. take a look where the errors occured and backspace so the @castmcr.... is just after the " mark

hope this helps. i know it's not the clearest explanation

llama
orc pawn
orc pawn
Posts: 20
Joined: Mon Dec 29, 2003 8:13 am

Post by llama » Mon Dec 29, 2003 8:33 am

Maybe I'm missing something, but Player alert dont work for me, I copied the above macro text and edited the extra spaces and line breaks....

When someone comes within radius i get these:

-------------------------
[MQ2) "Cast Macro" Player detected neraby

list of player nearby
there are 2 players in.....

Ending macro: } and { seen on the same line without an else present.
Cast.mac @ 136 (castmcr_spellcast): } /else {
Cast.mac @ 95 (castmcr_casting): /call castmcr_spellcast
Cast.mac @ 51 (main): /call castmcr_casting
Cleared the following: Timers Vars Array
Current macro has ended
-------------------------

I looked through it lots of times, but I cannot find the error...