Moderator: MacroQuest Developers

Code: Select all
|
| Bad Karma's ADVANCED SpellCast.inc
|
| This will cast a spell - and more - reliably for you...
|
|
| |=========================================|
| | USAGE: |
| | ¯¯¯¯¯¯ /call Cast "Spell Name" |
| | or: |
| | /call Cast "Item Name" Item |
| | or: |
| | /call Cast "AA#" Activate |
| |=========================================|
| | Reccomended #turbo |
| |=========================================|
|
| It will return the following values:
| CAST_ABILITYNOTREADY
| CAST_CANCELLED
| CAST_CANNOTSEE
| CAST_FAIL
| CAST_NOSPELLGIVEN
| CAST_OUTDOORS
| CAST_OUTOFMANA
| CAST_OUTOFRANGE
| CAST_RESISTED
| CAST_SILENCED
| CAST_SUCCESS
| CAST_TOOK2LONG
| CAST_TOOPOWERFUL
| CAST_UNKNOWNSPELL
| 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
| Xxx XX, 2003 - 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
| Jan 01, 2004 - timeout(5s) added to stop "dead-time" -m0nk
| Feb 09, 2004 - Further updates to include handle a few more events,
| Mount support, Face target (ml2517), Giveup timer (m0nk)
| updated MemSpell, and a few minor personalizations. - Bad Karma
| Feb 17, 2004 - added AA activate capabilities -ml2517
| Feb 18, 2004 - More tweaks. Mostly to casting routine to account for several
| character states, Spell Memorization, and added a Med sub (also
| now checks to see if you have enough mana to cast after memming),
| added more #events & corrected others, commented out the spam,
| but left it in the script in case you want it or need it for
| GenBot or whatever.... Little better organized, too. - Bad Karma
| Feb 28, 2004 - Added support to ensure the right (orginial) target is up before casting. - Frabtik
| Mar 08, 2004 - Now supports /keypress. - Bad Karma
| Mar 14, 2004 - Logic Changes: sit + med wait + fdfail + oor wait + stun + charm / most sits removed
| Changed Returns for Night Spells + Distracted / @CastGiveUpTime where it was missed. /
| format changes / face NOT default / /multiline / extra target checks /
| ver# change (mm.dd.yyx) / <stuff i forgot.> - (m0nk)
| Mar 15, 2004 - Fixed some issues with the new Stun code which was preventing it from triggering.
| Updated the FACE option. 1=normal, 2=fast, 0 or anything else (including null)= off.
| Mar 19, 2004 - Bad Karma ~ Again, many thanks to m0nk for the updates/suggestions! (Made a few bug fixes again to them *grin*)
| Added: FEARed support, CAST_CANCELLED
| To CANCEL a spell, simply DUCK out.
| I put this before /cast, and at the start of MedUp, MemSpell, :LoopWaitOFF,
| and Event_Interrupt (so it wouldn't unintentially trigger that event and force a re-cast)...
| This should cover any last-second cancel attempts. Let me know if more are needed.
| Fixed: STUN & FEAR bugs, CAST_ABILITYNOTREADY,
| Changed: StunON/OFF to WaitON/OFF to tie it in with FEAR/CHARM/STUN and possible future updates.
| Moved /call FACE to :WaitCast. Will now face while casting to help speed up the overall casting process.
| NOTE: DEFAULT changed to 1 (FACE SLOW)
| Removed version from top of file...too many places to update it!
| Mar 20, 2004 - Bad Karma ~ Will now re-mem any spell that the script had to overwrite while casting.
| Mar 26, 2004 - frabtik ~ Added check for cast success based on mana preservation item results being displayed.
| Apr 21, 2004 - Wassup ~ Initial conversion to the MQ2Data format.
|
|
| NOTE: All /echo commands are for debugging and feedback only. They can be safely removed.
| ¯¯¯¯¯ All /tell commands were left in for bot support (GenBot & BuffBot) - you can safely kill these, also.
|
|
|**
[SpellCast]
Version=04.00.00
**|
|
#event Ability "You can use the ability "
#event Collapse "Your gate is too unstable, and collapses."
#event Distracted "You are too distracted to cast a spell now!"
#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 Outdoors "You can only cast this spell in the outdoors."
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "Your target resisted the "
#event Silenced "You *CANNOT* cast spells, you have been silenced!"
#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground."
#event Success " flickers with a pale light."
#event TooPowerful "Your spell is too powerful for your intended target."
#event Unknown "You do not seem to have that spell memorized."
#event WaitON "Your mind is wracked by fear."
#event WaitON "You cannot cast while stunned"
#event WaitON "You are stunned"
#event WaitON "You lose control of yourself!"
#event WaitOFF "You are unstunned"
#event WaitOFF "You have control of yourself again."
#event WaitOFF "You are no longer afraid."
Sub Cast(SpellName,Item)
| Can't cast while we're moving, so let's make sure we're not!
/multiline ; /keypress forward;/keypress back;/keypress left;/keypress right;/keypress strafe_left;/keypress strafe_right;/delay 2
| Store the current Target ID before doing anything, just in case we loose our target before we actually cast.
/newif (!${Defined[PCTargetID]}) /declare PCTargetID local
/varset PCTargetID 0
/varset PCTargetID ${Target.ID}
/newif (!${String[@SpellName].Length}) {
/echo ERROR: Attempted to cast an undefined spell! ("@SpellName")
/return CAST_NOSPELLGIVEN
}
/newif (!${Defined[CastGiveUpTime]}) /declare CastGiveUpTime timer
/newif (!${Defined[Item]}) /declare Item local
/newif (${String[@Item].Equal[Item]} || ${String[@Item].Equal[Activate]}) /goto :StartCast
/newif (!${Me.Gem[@SpellName]}) /call MemSpell "@SpellName"
:StartCast
/newif (${Me.CurrentMana}<${Spell[@SpellName].Mana}) /call MedUp
/varset CastGiveUpTime 10s
/echo Casting "@SpellName" on ${Target.NameClean}
| /tell "@Sender" Casting "@SpellName" on ${Target.NameClean}
:CastNow
/newif (!${Me.Mount} && ${Me.State.NotEqual[STAND]}) /stand
/delay 1
/newif (!${Target.ID} && ${Target.ID}!=@PCTargetID && ${Target.ID}!=${Me.ID}) /target id @PCTargetID
/delay 1
/newif (${String[@Item].Equal[Item]}) {
/call ClearReturnValue
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/cast item "@SpellName"
} else /newif (${String[@Item].Equal[Activate]}) {
/call ClearReturnValue
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/alt activate "@SpellName"
} else {
/newif (!${Me.Gem[@SpellName]}) /return CAST_UNKNOWNSPELL
/call ClearReturnValue
/newif (!${Me.SpellReady[@SpellName]} {
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/delay 0
/goto :CastNow
}
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/cast "@SpellName"
}
:WaitCast
/newif (${Me.Casting.ID}) {
/delay 0
| This line handles IF and HOW you will face your spell target (while casting).
| 1 = FACE SLOW (NORMAL SPEED) 2 = FACE FAST Any other #, 0, or null = DO NOT FACE
| Default: FACE NORMAL (SLOW).
/call Face 1
/goto :WaitCast
}
/call ClearReturnValue
/delay 1
/doevents Ability
/doevents Collapse
/doevents Distracted
/doevents FDFail
/doevents Fizzle
/doevents Interrupt
/doevents NoLOS
/doevents NotHold
/doevents OnlyAtNight
/doevents OutOfMana
/doevents OutOfRange
/doevents Outdoors
/doevents Recover
/doevents Resisted
/doevents Silenced
/doevents Standing
/doevents WaitON
/doevents TooPowerful
/doevents Unknown
/doevents Success
/newif (${Macro.Return.Equal[CAST_ABILITYNOTREADY]}) /return ${Macro.Return}
/newif (${macro.Return.Equal[CAST_CANCELLED]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_CANNOTSEE]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_FAIL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_NOSPELLGIVEN]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_OUTDOORS]}) /goto :FixSpell
/newif (${Macro.Return[CAST_OUTOFMANA]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_OUTOFRANGE]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_RESISTED]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_RESTART]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_SILENCED]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_TOOK2LONG]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_TOOPOWERFUL]}) /goto :FixSpell
/newif (${Macro.Return[CAST_UNKNOWNSPELL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_WAITOFF]}) /goto :StartCast
/newif (${Macro.Return.Equal[FD_FAILED]}) /return ${Macro.Return}
/newif (${Macro.Return.NotEqual[CAST_SUCCESS]} && !${Macro.Return.Length}) /goto :FixSpell
:FixSpell
| /newif (${Defined[OldSpellName]}) {
| /newif (${String[@OldSpellName].NotEqual[@SpellName]} && ${String[@OldSpellName].Length}>0) {
| /memspell 7 "@OldSpellName"
| /delay 5
| /varset @OldSpellName ""
/return ${Macro.Return}
| }
| }
/return CAST_SUCCESS
Sub MemSpell(SpellName)
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/echo Memorizing: "@SpellName"...
| /tell "@Sender" Just a sec...gotta mem "@SpellName"
| Store the current Spell ID before doing anything so we can leave the way we came in.
| /if $defined(OldSpellName)!=TRUE /declare OldSpellName local
| /varset @OldSpellName ""
| /varset "@OldSpellName" "$char(gem,7)"
| Change the # below if you want to put the spell in a different slot.
/memspell 7 "@SpellName"
/delay 5
:MemWait
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/delay 0
/newif (${Me.State.Equal[STAND]} && ${Me.Mount}) /return CAST_RESTART
/newif (!${Me.SpellReady[@SpellName]}) /goto :MemWait
/return CAST_RESTART
Sub MedUp
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/echo Medding...
/newif (!${Me.Mount} && ${Me.State.NotEqual[SIT]} /sit on
/delay 1
:MedStart
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/delay 0
/newif (!${Me.Mount} && ${me.State.NotEqual[SIT]}) /return
/newif (${Me.CurrentMana} <= ${Spell[@SpellName].Mana}) /goto :MedStart
/newif (!${Me.Mount} && ${Me.State.NotEqual[STAND]}) /sit off
/return
Sub Face(UseFaceFast)
/declare Angle local
/declare TX local
/declare TY local
/declare TZ local
/declare FZ local
/varset TX ${Target.X}
/varset TY ${Target.Y}
/varset TZ $(Target.Z}
/varset FZ ${Me.Z}
/newif (${Me.FeetWet}) /varadd TZ 5
/newif (${Me.Levitating}) /varadd TZ 2
/varset Angle $abs($asin($calc($abs($calc(@FZ-@TZ))/$sqrt($calc($calc($calc($calc(@TX-$char(x))^2)+$calc($calc(@TY-$char(y))^2))+$calc($calc(@TZ-@FZ)^2))))))
/newif (@UseFaceFast==1) {
/face nolook loc @TY,@TX
} else {
/newif (@UseFaceFast==2) {
/face fast nolook loc @TY,@TX
}
} else {
/return
}
/newif (@TZ<@FZ) {
/look ${Math.Calc[@Angle*-1]}
} else /newif (@TZ>@FZ) {
/look @Angle
} else {
/look 0
}
/return
Sub ClearReturnValue
/return NULL
Sub Event_Ability
| /echo Event_Ability
| /tell "@Sender" I cannot use that ability right now!
/return CAST_ABILITYNOTREADY
Sub Event_Collapse
| /echo Event_Collapse
| /tell "@Sender" My Gate was too unstable and has collapsed!
/return CAST_RESTART
Sub Event_Distracted
| /echo Event_Distracted
| /tell "@Sender" I am too distracted to cast any spells right now!
/return CAST_SUCCESS
Sub Event_FDFail
| /echo FD_FAILED
| /tell "@Sender" They didn't buy it, boss! Feign Death has failed!
/newif (${Me.State.Equal[FEIGN]}) /stand
/return FD_FAILED
Sub Event_Fizzle
| /echo Event_Fizzle
| /tell "@Sender" Damn fizzles! Trying again...
/return CAST_RESTART
Sub Event_Interrupt
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/return CAST_RESTART
Sub Event_NoLOS
| /echo Event_NoLOS
| /tell "@Sender" I cannot see ${Target.CleanName}. Waiting 5 seconds for it to get a little closer before casting again.
/sit on
/delay 5s
/sit off
/return CAST_CANNOTSEE
Sub Event_NotHold
| /echo Event_NotHold
| /tell "@Sender" "@SpellName" did not take hold on ${Target.CleanName}.
/return CAST_SUCCESS
Sub Event_OnlyAtNight
| /echo Event_OnlyAtNight
| /tell "@Sender" It's too bright out! "@SpellName" should be cast at night!
/return CAST_SUCCESS
Sub Event_OutOfMana
| /echo Event_OutOfMana
| /tell "@Sender" Insufficient mana to cast "@SpellName"! Medding for a moment and trying again...
/call MedUp
/return CAST_OUTOFMANA
Sub Event_OutOfRange
| /echo Event_OutOfRange
| /tell "@Sender" ${Target.CleanName} is out of range. Waiting for it to get a little closer before casting again.
/sit on
:WaitRange
/delay 0
/newif (!${Me.Mount} && ${Me.State.NotEqual[SIT]}) /goto :InRange
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/newif (${Target.Distance}>200) /goto :WaitRange
:InRange
/sit off
/return CAST_OUTOFRANGE
Sub Event_Outdoors
| /echo Event_Outdoors
| /tell "@Sender" Mommy told me only to cast "@SpellName" when I am outside!
/return CAST_OUTDOORS
Sub Event_Recover
| /echo Event_Recover
| /tell "@Sender" Oops! Have't recovered yet...trying again!
/delay 5
/return CAST_RESTART
Sub Event_Resisted
| /echo Event_Resisted
| /tell "@Sender" ${Target.CleanName} resisted my "@SpellName" spell! Trying again...
/delay 1s
/return CAST_RESISTED
Sub Event_Silenced
| /echo Event_Silenced
| /tell "@Sender" Shh! I have been SILENCED!!! Trying again in 3 seconds.
/delay 3s
/return CAST_SILENCED
Sub Event_Standing
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
| /echo Event_Standing
| /tell "@Sender" You mean I have to stand up now? Oh, alright...casting "@SpellName" for you THIS time!
/stand
/return CAST_RESTART
Sub Event_Success
| /echo Event_Success
/return CAST_SUCCESS
Sub Event_TooPowerful
| /echo Event_TooPowerful
| /tell "@Sender" I am ubah! My spellz are too powaful 4 ${Target.CleanName}
/return CAST_TOOPOWERFUL
Sub Event_Unknown
| /echo Event_Unknown
| /tell "@Sender" You want me to cast WHAT!?!? I've never heard of a spell called "@SpellName" before.
/return CAST_UNKNOWNSPELL
Sub Event_WaitON
| /echo Event_Wait
| /tell "@Sender" I am STUNNED or FEARED!!! Trying again once I regain control of myself.
/doevents flush WaitOFF
:LoopWaitOFF
/newif (${Me.State.Equal[DUCK]) /return CAST_CANCELLED
/multiline ; /doevents WaitOFF;/newif (${Macro.Return.Equal[WaitOFF]}) {
/call ClearReturnValue
/return CAST_WAITOFF
}
/goto :LoopWaitOFF
Sub Event_WaitOFF
| /echo Recovered from Stun...
/return CAST_WAITOFFI'd be interested in the line numbers if you could post them. I don't think I made any typo's.javelinl wrote:Replacing
|**
[SpellCast]
Version=04.00.00
**|
with
||**
[SpellCast]
Version=04.00.00
**|
will let you find the functions. However, any reference to Me. seems to fail in this and in any macro. Is Me implemented?
Code: Select all
at the top of the code and Code: Select all
/newif (${Macro.Return.Equal[CAST_ABILITYNOTREADY]}) /return ${Macro.Return}
/newif (${macro.Return.Equal[CAST_CANCELLED]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_CANNOTSEE]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_FAIL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_NOSPELLGIVEN]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_OUTDOORS]}) /goto :FixSpell
/newif (${Macro.Return[CAST_OUTOFMANA]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_OUTOFRANGE]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_RESISTED]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_RESTART]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_SILENCED]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_TOOK2LONG]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_TOOPOWERFUL]}) /goto :FixSpell
/newif (${Macro.Return[CAST_UNKNOWNSPELL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_WAITOFF]}) /goto :StartCast
/newif (${Macro.Return.Equal[FD_FAILED]}) /return ${Macro.Return}
/newif (${Macro.Return.NotEqual[CAST_SUCCESS]} && !${Macro.Return.Length}) /goto :FixSpell Code: Select all
/if (${Macro.Return.Equal[CAST_ABILITYNOTREADY]}) /return ${Macro.Return}
/if (${macro.Return.Equal[CAST_CANCELLED]}) /goto :FixSpell
/if (${Macro.Return.Equal[CAST_CANNOTSEE]}) /goto :StartCast
/if (${Macro.Return.Equal[CAST_FAIL]}) /goto :FixSpell
/if (${Macro.Return.Equal[CAST_NOSPELLGIVEN]}) /goto :FixSpell
/if (${Macro.Return.Equal[CAST_OUTDOORS]}) /goto :FixSpell
/if (${Macro.Return.[CAST_OUTOFMANA]}) /goto :StartCast
/if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) /goto :StartCast
/if (${Macro.Return.Equal[CAST_RESISTED]}) /goto :StartCast
/if (${Macro.Return.Equal[CAST_RESTART]}) /goto :StartCast
/if (${Macro.Return.Equal[CAST_SILENCED]}) /goto :StartCast
/if (${Macro.Return.Equal[CAST_TOOK2LONG]}) /goto :FixSpell
/if (${Macro.Return.Equal[CAST_TOOPOWERFUL]}) /goto :FixSpell
/if (${Macro.Return.[CAST_UNKNOWNSPELL]}) /goto :FixSpell
/if (${Macro.Return.Equal[CAST_WAITOFF]}) /goto :StartCast
/if (${Macro.Return.Equal[FD_FAILED]}) /return ${Macro.Return}
/if (${Macro.Return.NotEqual[CAST_SUCCESS]} && !${Macro.Return.Length}) /goto :FixSpell
Code: Select all
|
| Bad Karma's ADVANCED SpellCast.inc
|
| This will cast a spell - and more - reliably for you...
|
|
| |=========================================|
| | USAGE: |
| | ¯¯¯¯¯¯ /call Cast "Spell Name" |
| | or: |
| | /call Cast "Item Name" Item |
| | or: |
| | /call Cast "AA#" Activate |
| |=========================================|
| | Reccomended #turbo |
| |=========================================|
|
| It will return the following values:
| CAST_ABILITYNOTREADY
| CAST_CANCELLED
| CAST_CANNOTSEE
| CAST_FAIL
| CAST_NOSPELLGIVEN
| CAST_OUTDOORS
| CAST_OUTOFMANA
| CAST_OUTOFRANGE
| CAST_RESISTED
| CAST_SILENCED
| CAST_SUCCESS
| CAST_TOOK2LONG
| CAST_TOOPOWERFUL
| CAST_UNKNOWNSPELL
| 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
| Xxx XX, 2003 - 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
| Jan 01, 2004 - timeout(5s) added to stop "dead-time" -m0nk
| Feb 09, 2004 - Further updates to include handle a few more events,
| Mount support, Face target (ml2517), Giveup timer (m0nk)
| updated MemSpell, and a few minor personalizations. - Bad Karma
| Feb 17, 2004 - added AA activate capabilities -ml2517
| Feb 18, 2004 - More tweaks. Mostly to casting routine to account for several
| character states, Spell Memorization, and added a Med sub (also
| now checks to see if you have enough mana to cast after memming),
| added more #events & corrected others, commented out the spam,
| but left it in the script in case you want it or need it for
| GenBot or whatever.... Little better organized, too. - Bad Karma
| Feb 28, 2004 - Added support to ensure the right (orginial) target is up before casting. - Frabtik
| Mar 08, 2004 - Now supports /keypress. - Bad Karma
| Mar 14, 2004 - Logic Changes: sit + med wait + fdfail + oor wait + stun + charm / most sits removed
| Changed Returns for Night Spells + Distracted / @CastGiveUpTime where it was missed. /
| format changes / face NOT default / /multiline / extra target checks /
| ver# change (mm.dd.yyx) / <stuff i forgot.> - (m0nk)
| Mar 15, 2004 - Fixed some issues with the new Stun code which was preventing it from triggering.
| Updated the FACE option. 1=normal, 2=fast, 0 or anything else (including null)= off.
| Mar 19, 2004 - Bad Karma ~ Again, many thanks to m0nk for the updates/suggestions! (Made a few bug fixes again to them *grin*)
| Added: FEARed support, CAST_CANCELLED
| To CANCEL a spell, simply DUCK out.
| I put this before /cast, and at the start of MedUp, MemSpell, :LoopWaitOFF,
| and Event_Interrupt (so it wouldn't unintentially trigger that event and force a re-cast)...
| This should cover any last-second cancel attempts. Let me know if more are needed.
| Fixed: STUN & FEAR bugs, CAST_ABILITYNOTREADY,
| Changed: StunON/OFF to WaitON/OFF to tie it in with FEAR/CHARM/STUN and possible future updates.
| Moved /call FACE to :WaitCast. Will now face while casting to help speed up the overall casting process.
| NOTE: DEFAULT changed to 1 (FACE SLOW)
| Removed version from top of file...too many places to update it!
| Mar 20, 2004 - Bad Karma ~ Will now re-mem any spell that the script had to overwrite while casting.
| Mar 26, 2004 - frabtik ~ Added check for cast success based on mana preservation item results being displayed.
| Apr 21, 2004 - Wassup ~ Initial conversion to the MQ2Data format.
|
|
| NOTE: All /echo commands are for debugging and feedback only. They can be safely removed.
| ¯¯¯¯¯ All /tell commands were left in for bot support (GenBot & BuffBot) - you can safely kill these, also.
|
|
||**
|[SpellCast]
|Version=04.00.00
**|
|
#event Ability "You can use the ability "
#event Collapse "Your gate is too unstable, and collapses."
#event Distracted "You are too distracted to cast a spell now!"
#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 Outdoors "You can only cast this spell in the outdoors."
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "Your target resisted the "
#event Silenced "You *CANNOT* cast spells, you have been silenced!"
#event Standing "You must be standing to cast a spell"
#event Standing "has fallen to the ground."
#event Success " flickers with a pale light."
#event TooPowerful "Your spell is too powerful for your intended target."
#event Unknown "You do not seem to have that spell memorized."
#event WaitON "Your mind is wracked by fear."
#event WaitON "You cannot cast while stunned"
#event WaitON "You are stunned"
#event WaitON "You lose control of yourself!"
#event WaitOFF "You are unstunned"
#event WaitOFF "You have control of yourself again."
#event WaitOFF "You are no longer afraid."
Sub Cast(SpellName,Item)
| Can't cast while we're moving, so let's make sure we're not!
/multiline ; /keypress forward;/keypress back;/keypress left;/keypress right;/keypress strafe_left;/keypress strafe_right;/delay 2
| Store the current Target ID before doing anything, just in case we loose our target before we actually cast.
/newif (!${Defined[PCTargetID]}) /declare PCTargetID local
/varset PCTargetID 0
/varset PCTargetID ${Target.ID}
/newif (!${String[@SpellName].Length}) {
/echo ERROR: Attempted to cast an undefined spell! ("@SpellName")
/return CAST_NOSPELLGIVEN
}
/newif (!${Defined[CastGiveUpTime]}) /declare CastGiveUpTime timer
/newif (!${Defined[Item]}) /declare Item local
/newif (${String[@Item].Equal[Item]} || ${String[@Item].Equal[Activate]}) /goto :StartCast
/newif (!${Me.Gem[@SpellName]}) /call MemSpell "@SpellName"
:StartCast
/newif (${Me.CurrentMana}<${Spell[@SpellName].Mana}) /call MedUp
/varset CastGiveUpTime 12s
/echo Casting "@SpellName" on ${Target.NameClean}
| /tell "@Sender" Casting "@SpellName" on ${Target.NameClean}
:CastNow
/newif (!${Me.Mount} && ${Me.State.NotEqual[STAND]}) /stand
/delay 1
/newif (!${Target.ID} && ${Target.ID}!=@PCTargetID && ${Target.ID}!=${Me.ID}) /target id @PCTargetID
/delay 1
/newif (${String[@Item].Equal[Item]}) {
/call ClearReturnValue
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/cast item "@SpellName"
} else /newif (${String[@Item].Equal[Activate]}) {
/call ClearReturnValue
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/alt activate "@SpellName"
} else {
/newif (!${Me.Gem[@SpellName]}) /return CAST_UNKNOWNSPELL
/call ClearReturnValue
/newif (!${Me.SpellReady[@SpellName]}) {
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/delay 0
/goto :CastNow
}
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/cast "@SpellName"
}
:WaitCast
/newif (${Me.Casting.ID}) {
/delay 0
| This line handles IF and HOW you will face your spell target (while casting).
| 1 = FACE SLOW (NORMAL SPEED) 2 = FACE FAST Any other #, 0, or null = DO NOT FACE
| Default: FACE NORMAL (SLOW).
/call Face 1
/goto :WaitCast
}
/call ClearReturnValue
/delay 1
/doevents Ability
/doevents Collapse
/doevents Distracted
/doevents FDFail
/doevents Fizzle
/doevents Interrupt
/doevents NoLOS
/doevents NotHold
/doevents OnlyAtNight
/doevents OutOfMana
/doevents OutOfRange
/doevents Outdoors
/doevents Recover
/doevents Resisted
/doevents Silenced
/doevents Standing
/doevents WaitON
/doevents TooPowerful
/doevents Unknown
/doevents Success
/newif (${Macro.Return.Equal[CAST_ABILITYNOTREADY]}) /return ${Macro.Return}
/newif (${macro.Return.Equal[CAST_CANCELLED]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_CANNOTSEE]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_FAIL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_NOSPELLGIVEN]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_OUTDOORS]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_OUTOFMANA]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_OUTOFRANGE]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_RESISTED]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_RESTART]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_SILENCED]}) /goto :StartCast
/newif (${Macro.Return.Equal[CAST_TOOK2LONG]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_TOOPOWERFUL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_UNKNOWNSPELL]}) /goto :FixSpell
/newif (${Macro.Return.Equal[CAST_WAITOFF]}) /goto :StartCast
/newif (${Macro.Return.Equal[FD_FAILED]}) /return ${Macro.Return}
/newif (${Macro.Return.NotEqual[CAST_SUCCESS]} && !${Macro.Return.Length}) /goto :FixSpell
:FixSpell
| /newif (${Defined[OldSpellName]}) {
| /newif (${String[@OldSpellName].NotEqual[@SpellName]} && ${String[@OldSpellName].Length}>0) {
| /memspell 7 "@OldSpellName"
| /delay 5
| /varset @OldSpellName ""
/return ${Macro.Return}
| }
| }
/return CAST_SUCCESS
Sub MemSpell(SpellName)
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/echo Memorizing: "@SpellName"...
| /tell "@Sender" Just a sec...gotta mem "@SpellName"
| Store the current Spell ID before doing anything so we can leave the way we came in.
| /if $defined(OldSpellName)!=TRUE /declare OldSpellName local
| /varset @OldSpellName ""
| /varset "@OldSpellName" "$char(gem,7)"
| Change the # below if you want to put the spell in a different slot.
/memspell 7 "@SpellName"
/delay 5
:MemWait
|/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/delay 0
/newif (${Me.State.Equal[STAND]} && ${Me.Mount}) /return CAST_RESTART
/newif (!${Me.SpellReady[@SpellName]}) /goto :MemWait
/return CAST_RESTART
Sub MedUp
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/echo Medding...
/newif (!${Me.Mount} && ${Me.State.NotEqual[SIT]} /sit on
/delay 1
:MedStart
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/delay 0
/newif (!${Me.Mount} && ${me.State.NotEqual[SIT]}) /return
/newif (${Me.CurrentMana} <= ${Spell[@SpellName].Mana}) /goto :MedStart
/newif (!${Me.Mount} && ${Me.State.NotEqual[STAND]}) /sit off
/return
Sub Face(UseFaceFast)
/declare Angle local
/declare TX local
/declare TY local
/declare TZ local
/declare FZ local
/varset TX ${Target.X}
/varset TY ${Target.Y}
/varset TZ ${Target.Z}
/varset FZ ${Me.Z}
/newif (${Me.FeetWet}) /varadd TZ 5
/newif (${Me.Levitating}) /varadd TZ 2
/varset Angle $abs($asin($calc($abs($calc(@FZ-@TZ))/$sqrt($calc($calc($calc($calc(@TX-$char(x))^2)+$calc($calc(@TY-$char(y))^2))+$calc($calc(@TZ-@FZ)^2))))))
/newif (@UseFaceFast==1) {
/face nolook loc @TY,@TX
} else {
/newif (@UseFaceFast==2) {
/face fast nolook loc @TY,@TX
}
} else {
/return
}
/newif (@TZ<@FZ) {
/look ${Math.Calc[@Angle*-1]}
} else /newif (@TZ>@FZ) {
/look @Angle
} else {
/look 0
}
/return
Sub ClearReturnValue
/return NULL
Sub Event_Ability
| /echo Event_Ability
| /tell "@Sender" I cannot use that ability right now!
/return CAST_ABILITYNOTREADY
Sub Event_Collapse
| /echo Event_Collapse
| /tell "@Sender" My Gate was too unstable and has collapsed!
/return CAST_RESTART
Sub Event_Distracted
| /echo Event_Distracted
| /tell "@Sender" I am too distracted to cast any spells right now!
/return CAST_SUCCESS
Sub Event_FDFail
| /echo FD_FAILED
| /tell "@Sender" They didn't buy it, boss! Feign Death has failed!
/newif (${Me.State.Equal[FEIGN]}) /stand
/return FD_FAILED
Sub Event_Fizzle
| /echo Event_Fizzle
| /tell "@Sender" Damn fizzles! Trying again...
/return CAST_RESTART
Sub Event_Interrupt
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/return CAST_RESTART
Sub Event_NoLOS
| /echo Event_NoLOS
| /tell "@Sender" I cannot see ${Target.CleanName}. Waiting 5 seconds for it to get a little closer before casting again.
/sit on
/delay 5s
/sit off
/return CAST_CANNOTSEE
Sub Event_NotHold
| /echo Event_NotHold
| /tell "@Sender" "@SpellName" did not take hold on ${Target.CleanName}.
/return CAST_SUCCESS
Sub Event_OnlyAtNight
| /echo Event_OnlyAtNight
| /tell "@Sender" It's too bright out! "@SpellName" should be cast at night!
/return CAST_SUCCESS
Sub Event_OutOfMana
| /echo Event_OutOfMana
| /tell "@Sender" Insufficient mana to cast "@SpellName"! Medding for a moment and trying again...
/call MedUp
/return CAST_OUTOFMANA
Sub Event_OutOfRange
| /echo Event_OutOfRange
| /tell "@Sender" ${Target.CleanName} is out of range. Waiting for it to get a little closer before casting again.
/sit on
:WaitRange
/delay 0
/newif (!${Me.Mount} && ${Me.State.NotEqual[SIT]}) /goto :InRange
/newif (@CastGiveUpTime==0) /return CAST_TOOK2LONG
/newif (${Target.Distance}>200) /goto :WaitRange
:InRange
/sit off
/return CAST_OUTOFRANGE
Sub Event_Outdoors
| /echo Event_Outdoors
| /tell "@Sender" Mommy told me only to cast "@SpellName" when I am outside!
/return CAST_OUTDOORS
Sub Event_Recover
| /echo Event_Recover
| /tell "@Sender" Oops! Have't recovered yet...trying again!
/delay 5
/return CAST_RESTART
Sub Event_Resisted
| /echo Event_Resisted
| /tell "@Sender" ${Target.CleanName} resisted my "@SpellName" spell! Trying again...
/delay 1s
/return CAST_RESISTED
Sub Event_Silenced
| /echo Event_Silenced
| /tell "@Sender" Shh! I have been SILENCED!!! Trying again in 3 seconds.
/delay 3s
/return CAST_SILENCED
Sub Event_Standing
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
| /echo Event_Standing
| /tell "@Sender" You mean I have to stand up now? Oh, alright...casting "@SpellName" for you THIS time!
/stand
/return CAST_RESTART
Sub Event_Success
| /echo Event_Success
/return CAST_SUCCESS
Sub Event_TooPowerful
| /echo Event_TooPowerful
| /tell "@Sender" I am ubah! My spellz are too powaful 4 ${Target.CleanName}
/return CAST_TOOPOWERFUL
Sub Event_Unknown
| /echo Event_Unknown
| /tell "@Sender" You want me to cast WHAT!?!? I've never heard of a spell called "@SpellName" before.
/return CAST_UNKNOWNSPELL
Sub Event_WaitON
| /echo Event_Wait
| /tell "@Sender" I am STUNNED or FEARED!!! Trying again once I regain control of myself.
/doevents flush WaitOFF
:LoopWaitOFF
/newif (${Me.State.Equal[DUCK]}) /return CAST_CANCELLED
/multiline ; /doevents WaitOFF;/newif (${Macro.Return.Equal[WaitOFF]}) {
/call ClearReturnValue
/return CAST_WAITOFF
}
/goto :LoopWaitOFF
Sub Event_WaitOFF
| /echo Recovered from Stun...
/return CAST_WAITOFF