Moderator: MacroQuest Developers
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" {
/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
/returnCode: Select all
|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
Code: Select all
#event castmcr_err_cursor "Warning, you have many items waiting on your cursor."
Sub Event_castmcr_err_cursor
:cursorloop
/if "$cursor(name)"~~"Summoned:" /destroy
/if "$cursor(name)"~~"Summoned:" /goto :cursorloop
/return
Code: Select all
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
[color=cyan]| any summoned items get destroyed
/if "$cursor(name)"~~"Summoned" {
/destroy
/delay 1s
}[/color]
/return 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($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
}
|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
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($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
}
|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


The '/' in front of the else is an error. I briefly searched through the above file and saw it in at least two palces... / starts a command; else a qualifier not a command in and of itself. Removing the '/' should correct the issue.llama wrote: 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...

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
