Here is a little bit of my Vanguard SKills Object (class) and how i do skills
This first snippit is how I loaded each skill. NOTE: Since this is a timer forum thread, I have set GIft of ardor to a time a long time ago.. so its immediately ready. the first time i need it, after that the PERFORMSKILL FUnction handles resetting the timer.
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
'=========================================================================================
' VG SKILLS OBJECT .VBS
'=========================================================================================
' Currently there are 25 Skills on file
Dim objVGSkill
Set objVGSkill = New VGSkill
' One skill
objVGSkill.SkillName(0) = "Gift of Ardor III"
objVGSkill.SkillRefresh(0) = 60
objVGSkill.SkillRange(0) = 25
objVGSkill.SkillEnergy(0) = 54 f
objVGSkill.SkillEndurance(0) = 0
objVGSkill.SkillCastTime(0) = 0
objVGSkill.KeyMapping(0) = ""
objVGSkill.SkillLastUsedTime(0) = "2/25/2007 11:01:42 PM" ' since its refresh is so damn long
' two skill
objVGSkill.SkillName(1) = "Power of the Grave I"
objVGSkill.SkillRefresh(1) = 0
objVGSkill.SkillRange(1) = 25
objVGSkill.SkillEnergy(1) = 19
objVGSkill.SkillEndurance(1) = 0
objVGSkill.SkillCastTime(1) = 0
objVGSkill.KeyMapping(1) = ""
objVGSkill.SkillLastUsedTime(1) = Now
' 3 skill
objVGSkill.SkillName(2) = "Power of the Grave II"
objVGSkill.SkillRefresh(2) = 0
objVGSkill.SkillRange(2) = 25
objVGSkill.SkillEnergy(2) = 30 ' not sure
objVGSkill.SkillEndurance(2) = 0
objVGSkill.SkillCastTime(2) = 0
objVGSkill.KeyMapping(2) = ""
objVGSkill.SkillLastUsedTime(2) = Now
This little bit is the class define itselt
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
Class VGSkill
' Set theseindexes to +1 of the last known index (example VGSKills(1) then set it to 2
' declare private class variable
Dim m_SkillName(3)
Dim m_Refresh(3)
Dim m_Range(3)
Dim m_Energy(3)
Dim m_Endurance(3)
Dim m_CastTime(3)
Dim m_KeyMapping(3)
Dim m_LastUsedTime(3)
' declare the property
Public Property Get SkillName(i)
SkillName = m_SkillName(i)
End Property
Public Property Let SkillName (i,strSkillName)
m_SkillName(i) = strSkillName
End Property
' declare the property
Public Property Get SkillRefresh(i)
SkillRefresh = m_Refresh(i)
End Property
Public Property Let SkillRefresh (i,strSkillRefresh)
m_Refresh(i) = strSkillRefresh
End Property
' declare the property
Public Property Get SkillRange(i)
SkillRange = m_Range(i)
End Property
Public Property Let SkillRange (i,strSkillRange)
m_Range(i) = strSkillRange
End Property
' declare the property
Public Property Get SkillEnergy(i)
SkillEnergy = m_Energy(i)
End Property
Public Property Let SkillEnergy (i,strSkillEnergy)
m_Energy(i) = strSkillEnergy
End Property
' declare the property
Public Property Get SkillEndurance(i)
SkillEndurance = m_Endurance(i)
End Property
Public Property Let SkillEndurance (i,strSkillEndurance)
m_Endurance(i) = strSkillEndurance
End Property
' declare the property
Public Property Get SkillCastTime(i)
SkillCastTime = m_CastTime(i)
End Property
Public Property Let SkillCastTime (i,strSkillCastTime)
m_CastTime(i) = strSkillCastTime
End Property
' declare the property
Public Property Get KeyMapping(i)
KeyMapping = m_KeyMapping(i)
End Property
Public Property Let KeyMapping (i,strSkillKeyMapping)
m_KeyMapping(i) = strSkillKeyMapping
End Property
' declare the property
Public Property Get SkillLastUsedTime(i)
SkillLastUsedTime = m_LastUsedTime(i)
End Property
Public Property Let SkillLastUsedTime(i,strSkillLastUsedTime)
m_LastUsedTime(i) = strSkillLastUsedTime
End Property
End Class
And this is my perform skill function
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
'=========================================================
' HELPER FUNCTIONS
'=========================================================
' Here down is the original,
Function PerformSkill(SkillName) 'Casts a spell or performs a skill
PerformSkill = false ' initialize
Dim CurrentTime ' holds the time at the attempt to cast
Dim TimeSinceLastCast ' holds the seconds since last cast
'loop through and find the skill in the object
for i = 0 to 3 ' set this to however many objects are in your VGSKills Object in
' Find the Skill
if objVGSkill.SkillName(i) = SkillName then
UpdateDebugInfo "Found Skill" & SkillName
' Now check to see if the skill can be cast (skill timer)
CurrentTime = Now ' get the now time.
UpdateDebugInfo "Current time is " & CurrentTime
TimeSinceLastCast = DateDiff("s", objVGSkill.SkillLastUsedTime(i), CurrentTime) 'Calcualte the seconds since last cast
if (TimeSinceLastCast => objVGSkill.SkillRefresh(i) ) then
UpdateDebugInfo "Time since last cast good"
' check for Energy
if (getPlayerPower => objVGSkill.SkillEnergy(i) ) then
UpdateDebugInfo "Energy good"
' check for Endurance
if (getPlayerEndurance => objVGSkill.SkillEndurance(i) ) then
UpdateDebugInfo "Endurance good"
' Check if Range is good
if (getTargetDistance() <= objVGSkill.SkillRange(i) ) then
UpdateDebugInfo "Mob Is within Range "
' GO ahead and send the hot key
VGSendText( objVGSkill.KeyMapping(i) )
PerformSkill = true
' Reset the skills last used timer
objVGSkill.SkillLastUsedTime(i) = Now
' Must wait 2 seconds for skill Manditory timer to refresh.
' check the skills cast time, and subtract 2 from it if its longer
' if the SKill cast time is over 2 seconds, do nothing, other wise wait itout
if ( objVGSkill.SkillCastTime(i) > 2 ) then
' DO nothing its already time to cast
else
WIN32.SLEEP(StandardCombatSkillRefresh)
end if
if (PerformSkill = true ) then
UpdateDebugInfo SkillName & " Performed Sucessfully "
else
UpdateDebugInfo SkillName & " Failed "
end if
end if
end if
end if
end if
end if
next
end function
Thats how i did it for handling timers in the casting and performing of skills, Hopwfully it answeres your question,One of these days i will post my bots, the problem is my code is Very hard to read and Setup...