mistahmikey
Active Member
Hi,
I have written a number of scripts that I have attached to MCP buttons that cast spells. Problem is, I am having trouble getting the spells to cast reliably, and after a lot of playing around with it, I am unable to figure out why. So I was hoping someone might be able to shed some light on why this might be.
For fun, I decided to write a script that would manage casting combinations for my monk. Here is the script:
And here is the include:
So what I am seeing in this (and other) scripts is that often, even when a spell is ready, it will not cast. Sometimes the spell "dims" just a touch on the hot bar, like it wanted to cast, but then it goes back on. I have tried using many different recovery times (including trying to use the actual ones provided by the Ability type, but I was unable to get values that consistently reflected what they appear to be from examining the spell).
So if someone could take a look at how I am doing the spell casts and advise me about how to do it more reliably I would certainly appreciate it. And believe me, I have spent a LOT of time looking at other code, reading the wikis, and playing around with my code, but I just can't seem to come up with the magic combination.
Thanks very much.
I have written a number of scripts that I have attached to MCP buttons that cast spells. Problem is, I am having trouble getting the spells to cast reliably, and after a lot of playing around with it, I am unable to figure out why. So I was hoping someone might be able to shed some light on why this might be.
For fun, I decided to write a script that would manage casting combinations for my monk. Here is the script:
Code:
#include OgrePauseResume.inc
function main()
{
declare Jab1 string local "Five Rings VI"
declare Jab2 string local "Silent Palm IV"
declare Jab3 string local "Waking Dragon VII"
declare Punch1 string local "Striking Cobra VII"
declare Punch2 string local "Frozen Palm VII"
declare Punch3 string local "Arctic Talon V"
declare Kick1 string local "Rising Dragon VI"
declare Kick2 string local "Rising Phoenix VII"
declare Kick3 string local "Roundhouse Kick VII"
declare MyTargetName string local ""
declare MyTargetId int local 0
declare MyTargetType string local ""
declare Jab string local ""
declare Punch string local ""
declare Kick string local ""
declare SpellCount int local 0
echo Executing AutoCombination for ${Me.Name}
while TRUE
{
while !${Target(exists)}
{
wait 5
}
MyTargetId:Set[${Target.ID}]
MyTargetName:Set[${Target.Name}]
MyTargetType:Set[${Target.Type}]
echo Targetted actor \"${MyTargetName}\" type \"${MyTargetType}\"
if !${MyTargetType.Equal[NPC]} && !${MyTargetType.Equal[NamedNPC]}
{
wait 5
continue
}
echo Now targetting mob \"${MyTargetName}\"
while TRUE
{
if !${Actor[${MyTargetId}](exists)}
{
break
}
if ${Me.ToActor.InCombatMode}
{
call PauseOgre
if ${SpellCount} == 0
{
if ${Me.Ability[${Jab1}].IsReady} && !${Me.Ability[${Jab1}].IsQueued}
{
Jab:Set[${Jab1}]
SpellCount:Inc
}
elseif ${Me.Ability[${Jab2}].IsReady} && !${Me.Ability[${Jab2}].IsQueued}
{
Jab:Set[${Jab2}]
SpellCount:Inc
}
elseif ${Me.Ability[${Jab3}].IsReady} && !${Me.Ability[${Jab3}].IsQueued}
{
Jab:Set[${Jab3}]
SpellCount:Inc
}
}
if ${SpellCount} == 1
{
if ${Me.Ability[${Punch1}].IsReady} && !${Me.Ability[${Punch1}].IsQueued}
{
Punch:Set[${Punch1}]
SpellCount:Inc
}
elseif ${Me.Ability[${Punch2}].IsReady} && !${Me.Ability[${Punch2}].IsQueued}
{
Punch:Set[${Punch2}]
SpellCount:Inc
}
elseif ${Me.Ability[${Punch3}].IsReady} && !${Me.Ability[${Punch3}].IsQueued}
{
Punch:Set[${Punch3}]
SpellCount:Inc
}
}
if ${SpellCount} == 2
{
if ${Me.Ability[${Kick1}].IsReady} && !${Me.Ability[${Kick1}].IsQueued}
{
Kick:Set[${Kick1}]
SpellCount:Inc
}
elseif ${Me.Ability[${Kick2}].IsReady} && !${Me.Ability[${Kick2}].IsQueued}
{
Kick:Set[${Kick2}]
SpellCount:Inc
}
elseif ${Me.Ability[${Kick3}].IsReady} && !${Me.Ability[${Kick3}].IsQueued}
{
Kick:Set[${Kick3}]
SpellCount:Inc
}
}
if ${SpellCount} == 3
{
echo Executing Combination \"${Jab}\" \"${Punch}\" \"${Kick}\"
wait 100 !${Me.CastingSpell}
wait 7
echo Casting \"${Jab}\"
Me.Ability[${Jab}]:Use
;echo Waiting up to 100 for \"${Jab}\" to not be queued
wait 100 !${Me.Ability[${Jab}].IsQueued}
;echo Waiting up to 100 for \"${Jab}\" to cast
wait 100 !${Me.CastingSpell}
;echo Waiting 5 for \"${Jab}\" to recover
wait 7
echo Casting \"${Punch}\"
Me.Ability[${Punch}]:Use
;echo Waiting up to 100 for \"${Punch}\" to not be queued
wait 100 !${Me.Ability[${Punch}].IsQueued}
;echo Waiting up to 100 for \"${Punch}\" to cast
wait 100 !${Me.CastingSpell}
;echo Waiting 5 for \"${Punch}\" to recover
wait 7
echo Casting \"${Kick}\"
Me.Ability[${Kick}]:Use
;echo Waiting up to 100 for \"${Kick}\" to not be queued
wait 100 !${Me.Ability[${Kick}].IsQueued}
;echo Waiting up to 100 for \"${Kick}\" to cast
wait 100 !${Me.CastingSpell}
;echo Waiting 5 for \"${Kick}\" to recover
wait 7
}
elseif ${SpellCount} > 0 && ${Jab.Equal[${Jab1}]}
{
wait 100 !${Me.CastingSpell}
wait 7
echo Casting \"${Jab}\" when Combination is not ready
Me.Ability[${Jab}]:Use
;echo Waiting up to 100 for \"${Jab}\" to not be queued
wait 100 !${Me.Ability[${Jab}].IsQueued}
;echo Waiting up to 100 for \"${Jab}\" to cast
wait 100 !${Me.CastingSpell}
;echo Waiting 5 for \"${Jab}\" to recover
wait 7
}
SpellCount:Set[0]
call ResumeOgre
}
if !${Target(exists)}
{
break
}
if ${Target.ID} != ${MyTargetId}
{
break
}
wait 5
}
}
echo Leaving AutoCombination
}
Code:
function PauseOgre()
{
if ${Script[${OgreBotScriptName}](exists)} && !${b_OB_Paused}
{
Script[${OgreBotScriptName}]:ExecuteAtom[TogglePause]
}
}
function ResumeOgre()
{
if ${Script[${OgreBotScriptName}](exists)} && ${b_OB_Paused}
{
Script[${OgreBotScriptName}]:ExecuteAtom[TogglePause]
}
}
So if someone could take a look at how I am doing the spell casts and advise me about how to do it more reliably I would certainly appreciate it. And believe me, I have spent a LOT of time looking at other code, reading the wikis, and playing around with my code, but I just can't seem to come up with the magic combination.
Thanks very much.
Last edited: