Moderator: MacroQuest Developers
Code: Select all
| SpellCast.inc
| This will cast a spell reliably for you...
|
| Usage:
| /call Cast "spellname"
| or
| /call Cast "itemname" [item]
|
| It will return the following values:
| CAST_SUCCESS
| CAST_UNKNOWNSPELL
| CAST_OUTOFMANA
| CAST_OUTOFRANGE
| CAST_CANNOTSEE
| CAST_STUNNED
| CAST_RESISTED
| FD_FAILED
|
| New Vars Modification
| Plazmic's no globals needed version
|
| Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf
| Oct 11, 2003 - switched some logic, removed defines - gf
| Oct 15, 2003 - Item support added by EqMule
| Modified to add automeming of spells. Goofmester1
| Dec 26, 2003 fd fail 1 added by m0nk
| Dec 28, 2003 Modded for functionality in a variety of macs for multiple classes - Bad Karma
|
| NOTE: All /echo commands are for debugging and feedback only. They can be safely removed.
|
#event Collapse "Your gate is too unstable, and collapses."
#event FDFail "You are no longer feigning death"
#event Fizzle "Your spell fizzles"
#event Interrupt "Your casting has been interrupted"
#event Interrupt "Your spell is interrupted."
#event NoLOS "You cannot see your target."
#event NotHold "Your spell would not have taken hold on your target."
#event OnlyAtNight "Spell can only be cast during the night."
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "You target resisted the "
#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground."
#event Stunned "You cannot cast while stunned"
#event TooPowerful "You spell is too powerful for your intended target."
Sub Cast(SpellName,Item)
| /sendkey up up
| /sendkey up down
/if n $char(gem,"@SpellName")==0 {
/memspell 8 "@SpellName"
/delay 5s
}
:StartCast
| /if $char(state)!="STAND" /stand
| /face
| /look 0 Temporary fix to the "stare at the sky" issue.
| /delay 2s
| /echo Incoming @SpellName to %T
/if "@Item"=="Item" {
/call ClearReturnValue
/cast item "@SpellName"
} else {
/if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL
/call ClearReturnValue
/if n $char(gem,"@SpellName")<0 {
/delay 0
/goto :StartCast
}
/cast "@SpellName"
}
:WaitCast
/if "$char(casting)"=="TRUE" {
/delay 1
/goto :WaitCast
}
/doevents Fizzle
/doevents Interrupt
/doevents Recover
/doevents Resisted
/doevents OutOfMana
/doevents OutOfRange
/doevents NoLOS
/doevents Stunned
/doevents Standing
/doevents Collapse
/doevents OnlyAtNight
/doevents NotHold
/doevents TooPowerful
/doevents FDFail
/if "$return"=="CAST_RESTART" /goto :StartCast
/if "$return"!="CAST_SUCCESS" /return "$return"
/if "$return"=="CAST_OUTOFMANA" /goto :StartCast
/if "$return"=="CAST_STUNNED" /goto :StartCast
/if "$return"=="CAST_RESISTED" /goto :StartCast
/if "$return"=="CAST_OUTOFRANGE" /goto :StartCast
/if "$return"=="CAST_CANNOTSEE" /goto :StartCast
/if "$return"=="FD_FAILED" /return "$return"
/return CAST_SUCCESS
Sub ClearReturnValue
/return CAST_SUCCESS
Sub Event_Fizzle
/echo Event_Fizzle
/return CAST_RESTART
Sub Event_Interrupt
/echo Event_Interrupt
/return CAST_RESTART
Sub Event_Recover
/echo Waiting for recovery...
/delay 5
/return CAST_RESTART
Sub Event_Standing
/echo Event_Standing
/stand
/return CAST_RESTART
Sub Event_Collapse
/echo Event_Collapse
/return CAST_RESTART
Sub Event_OutOfMana
/echo Event_OutOfMana
/tell "@Sender" "I'm out of mana at the moment. Let me med for 10 seconds and I'll try again!"
/sit
/delay 10s
/stand
/return CAST_OUTOFMANA
Sub Event_OutOfRange
/echo Event_OutOfRange
/tell "@Sender" "%T is out of range. Waiting for it to get a little closer before casting again."
/sit
/delay 10s
/stand
/return CAST_OUTOFRANGE
Sub Event_NoLOS
/echo Event_NoLOS
/tell "@Sender" "I cannot see %T. Waiting for it to get a little closer before casting again."
/sit
/delay 10s
/stand
/return CAST_CANNOTSEE
Sub Event_Stunned
/echo Event_Stunned
/tell "@Sender" "I am STUNNED at the moment! I will try again in 5 seconds."
/sit
/delay 5s
/stand
/return CAST_STUNNED
Sub Event_Resisted
/echo Event_Resisted
/tell "@Sender" "%T resisted my spell. Trying again..."
/sit
/delay 5s
/stand
/return CAST_RESISTED
Sub Event_OnlyAtNight
/echo Event_OnlyAtNight
/return CAST_SUCCESS
Sub Event_NotHold
/echo Event_NotHold
/return CAST_SUCCESS
Sub Event_TooPowerful
/echo Event_TooPowerful
/return CAST_SUCCESS
Sub Event_FDFail
/echo FD_FAILED
/stand
/return FD_FAILEDCode: Select all
| Canni.mac
| Autocanni and heal for a 65 with Q and C4
| Usage: /macro canni.mac
| Parameters...
| help - Display this information
| noheal - Canni and dont stop. Good for slow groups with a cleric healing you.
| nostop - Do not end the canni loop when you are done. It will continue to
| loop and canni as necissary to keep you up on mana.
| nosit - Perform basic, but do not sit between casts.
| Note: Noheal will still heal if you hit 35%, there is some sanity to it.
|
| Brought to you by MoonRaverX
| Used for all my spell macros.
#include SpellCast.inc
/declare Canni_nosit global
/declare Canni_noheal global
/declare Canni_nostop global
/declare SpellName global
/declare Item global
/varset Canni_nosit 0
/varset Canni_noheal 0
/varset Canni_nostop 0
|Main Loop
Sub Main
| Lets check out paramters.
/if "@Param0"=="help" /call Canni_Syntax
/if "@Param0 @Param1 @Param2"~~"nosit" /varset Canni_nosit 1
/if "@Param0 @Param1 @Param2"~~"noheal" /varset Canni_noheal 1
/if "@Param0 @Param1 @Param2"~~"nostop" /varset Canni_nostop 1
:loopstart
| If your hp are less than 35% start a heal first.
/if n $char(hp,pct)<35 /call Canni_CastHeal
| If your mana is more than 5%, and hp are between 25 and 50%, heal.
/if (n $char(mana,pct)>5 && n $char(hp,pct)>25 && n $char(hp,pct)<50) /call Canni_CastHeal
| If hp are more than 40% and mana is under 90%, canni.
/if (n $char(hp,pct)>40 && n $char(mana,pct)<90) /call Canni_CastCanni
| If your done canni'ing stop the macro.
/if (n $char(mana,pct)>90 && Canni_nostop==0) /call Canni_AllDone
/doevents
/delay 1
/goto :loopstart
/return
Sub Canni_CastCanni
:tryagain
/delay 1
/if n $char(gem,"Cannibalize III")<1 /goto :tryagain
/sit off
| /varset "@SpellName"="Cannibalize III" FOR TESTING
/call Cast "Cannibalize III"
/if $return==CAST_RESTART /call CastCanni
/if $return==CAST_OUTOFMANA /call ErrorTrap
/if $return==CAST_OUTOFRANGE /call ErrorTrap
/if $return==CAST_CANNOTSEE /call ErrorTrap
/if $return==CAST_STUNNED /call ErrorTrap
/if $return==CAST_RESISTED /call ErrorTrap
/if Canni_nosit==0 /sit on
/delay 1
/call Main
Sub Canni_CastHeal
| Noheal catch, with stupidity checking
/if (Canni_noheal==1 && n $char(hp,pct)>35) /call Canni_CastCanni
:tryagain
/delay 1
/if n $char(gem,"Superior Healing")<1 /goto :tryagain
/sit off
/target myself
| /varset "@SpellName"="Superior Healing" FOR TESTING
/call Cast "Superior Healing"
/if $return==CAST_RESTART /call CastHeal
/if $return==CAST_OUTOFMANA /call ErrorTrap
/if $return==CAST_OUTOFRANGE /call ErrorTrap
/if $return==CAST_CANNOTSEE /call ErrorTrap
/if $return==CAST_STUNNED /call ErrorTrap
/if $return==CAST_RESISTED /call ErrorTrap
/delay 1
/if Canni_nosit==0 /sit on
/delay 90
/call Main
Sub Canni_Syntax
/echo Canni..Syntax (Brought to you by MoonRaverX)
/echo help - Display this information
/echo noheal - Canni and dont stop. Good for slow groups with a cleric healing you.
/echo nostop - Do not end the canni loop when you are done. It will continue to
/echo . loop and canni as necissary to keep you up on mana.
/echo nosit - Perform basic, but do not sit between casts.
/echo Note: Noheal will still heal if you hit 35%, there is some sanity to it.
/endmacro
/call Main
Sub Canni_ErrorTrap
/echo Something went wrong with the macro. Killing now.
/endmacro
/call Main
Sub Canni_AllDone
/delay 1
/sit off
/echo Cannidance done.
/endmacro
/return
Code: Select all
#include spellcastTEST.inc
sub main
/call cast "Cannibalize III"
/echo Canni was Cast
/target myself
/delay 1s
/call cast "Black Fur Boots" item
/echo Black Fur Boots item was cast
/end
Code: Select all
| SpellCast.inc
| This will cast a spell reliably for you...
| Usage:
| /call Cast "spellname"
| or
| /call Cast "itemname" [item]
| It will return the following values:
| CAST_SUCCESS
| CAST_UNKNOWNSPELL
| CAST_OUTOFMANA
| CAST_OUTOFRANGE
| CAST_CANNOTSEE
| CAST_STUNNED
| CAST_RESISTED
|
| New Vars Modification
| Plazmic's no globals needed version
|
| Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf
| Oct 11, 2003 - switched some logic, removed defines - gf
| Oct 15, 2003 - Item support added by EqMule
| Modified to add automeming of spells. Goofmester1
| Dec 26, 2003 fd fail 1 added by m0nk
#event Fizzle "Your spell fizzles"
#event Interrupt "Your casting has been interrupted"
#event Interrupt "Your spell is interrupted."
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "You target resisted the "
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
#event Stunned "You cannot cast while stunned"
#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground."
#event Collapse "Your gate is too unstable, and collapses."
Sub Cast(SpellName,Item)
/echo Cast @SpellName
/sendkey up up
/sendkey up down
/delay 5
/if "@Item"=="Item" /goto :StartCast
/if n $char(gem,"@SpellName")==0 {
/memspell 5 "@SpellName"
/delay 5s
}
:StartCast
/if "@Item"=="Item" {
/call ClearReturnValue
/cast item "@SpellName"
} else {
/if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL
/call ClearReturnValue
/if n $char(gem,"@SpellName")<0 {
/delay 0
/goto :StartCast
}
/cast "@SpellName"
}
:WaitCast
/if "$char(casting)"=="TRUE" {
/delay 1
/goto :WaitCast
}
/delay 1
/doevents Fizzle
/doevents Interrupt
/doevents Interrupt
/doevents Recover
/doevents Standing
/doevents OutOfRange
/doevents OutOfMana
/doevents NoLOS
/doevents Resisted
/if "$return"=="CAST_RESTART" /goto :StartCast
/if "$return"!="CAST_SUCCESS" /return "$return"
/return CAST_SUCCESS
Sub ClearReturnValue
/return NULL
Sub Event_Fizzle
/return CAST_RESTART
Sub Event_Interrupt
/return CAST_RESTART
Sub Event_Recover
/delay 5
/return CAST_RESTART
Sub Event_Standing
/stand
/return CAST_RESTART
Sub Event_Collapse
/return CAST_RESTART
Sub Event_OutOfMana
/return CAST_OUTOFMANA
Sub Event_OutOfRange
/return CAST_OUTOFRANGE
Sub Event_NoLOS
/return CAST_CANNOTSEE
Sub Event_Stunned
/delay 1s
/return CAST_RESTART
Sub Event_Resisted
/return CAST_RESISTED
Code: Select all
Sub UseItem
/echo UseItem @Param0
/sendkey up up
/sendkey up down
/delay 5
:StartCast
/cast item "@Param0"
:WaitCast
/if "$char(casting)"=="TRUE" {
/delay 1
/goto :WaitCast
}
/delay 1
/doevents Interrupt
/doevents Recover
/doevents Standing
/doevents OutOfRange
/doevents NoLOS
/doevents Resisted
/if "$return"=="CAST_RESTART" /goto :StartCast
/if "$return"!="CAST_SUCCESS" /return "$return"
/return CAST_SUCCESS
Code: Select all
#event Fizzle "Your spell fizzles"
[color=cyan]
#event Interrupt "Your casting has been interrupted"
#event Interrupt "Your spell is interrupted."
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
[/color]
#event Resisted "You target resisted the "
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
#event Stunned "You cannot cast while stunned"
[color=cyan]
#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground."
[/color]
#event Collapse "Your gate is too unstable, and collapses."
Ehmm... FYI "casting" an item effect is not done by rightclicking... actually Im using the same function "Cast" as casting a spell uses... just that it needs other parameters... dont know if that makes sence... but triggering a effect on an item does not involve a click at all...Wassup wrote:Combining Casting and right clicking in one sub sounds great, but seems to be causing you a problem.
and that... doesnt make sense...Combining Casting and Casting in one sub sounds great, but seems to be causing you a problem
donations for this month's patches.Code: Select all
[color=cyan]#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground." [/color]I know EQMule, I just meant for the purpose of casting using a right click item. I just meant that as a reference to right click items.EqMule wrote:Ehmm... FYI "casting" an item effect is not done by rightclicking... actually Im using the same function "Cast" as casting a spell uses... just that it needs other parameters... dont know if that makes sence... but triggering a effect on an item does not involve a click at all...Wassup wrote:Combining Casting and right clicking in one sub sounds great, but seems to be causing you a problem.
so I could change your quote and it would readand that... doesnt make sense...Combining Casting and Casting in one sub sounds great, but seems to be causing you a problem
You would have to add /echo's or /mqlog <text> in the code to track it. That is the only way I know of to find out while the macro is running.Bad Karma wrote: One last question, though...aside from using /echo messages to inform me of what's happening, is there any way to trace what the macro is doing? Any way to display what line of a macro is currently being executed? It'd be nice to see exactly where the thing is getting stuck.