Get Skill cooldown to use in profile
Get Skill cooldown to use in profile
Hi all;
I want to chek the skills cooldown to make a good decision on "onPreskillCast" section fo the profile.
Return the boolean value depending on some skill cooldown, example:
if arg1.Name == "ROGUE_SHODOWSTAB" then
if (X)Skill.cooldown > 3 then
return false
end
How o which function can give this information? I want to compare the cooldown to a number to take the decision.
I found other information in forum, but nothing concrete.
Thanks
I want to chek the skills cooldown to make a good decision on "onPreskillCast" section fo the profile.
Return the boolean value depending on some skill cooldown, example:
if arg1.Name == "ROGUE_SHODOWSTAB" then
if (X)Skill.cooldown > 3 then
return false
end
How o which function can give this information? I want to compare the cooldown to a number to take the decision.
I found other information in forum, but nothing concrete.
Thanks
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: Get Skill cooldown to use in profile
You'd likely have to do something like this. It scans each tab of your skills looking for a match to the name you specify. Then it should get the max cooldown and remaining cooldown of the skill for you.
Code: Select all
skillToCheck = "Shadowstab"
for tab = 2 to 4
numskills = RoMScript("GetNumSkill("..tab..")")
if numskills then
for slot = 1, numskills do
skillname = RoMScript("GetSkillDetail("..tab..","..slot..")")
if skillname == skillToCheck then
skillMaxCD, remainingCD = RoMScript("GetSkillCooldown("..tab..","..slot..")")
end
end
end
end
Re: Get Skill cooldown to use in profile
Super
But, I need to use this code as a function? Where I can declare it in profile?
Thanks for your support!
But, I need to use this code as a function? Where I can declare it in profile?
Thanks for your support!
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: Get Skill cooldown to use in profile
You can have an onLoad section in your profile and declare the function in there:
Then in your onPreskillCast event, call the function.
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
-- startGMDetect()
-- loadPaths("FAmainclass");
-- function doWhatever()
-- do something
-- do something else
-- end
]]></onLoad>
Re: Get Skill cooldown to use in profile
This is what I use on rogue
Code: Select all
<onPreSkillCast><![CDATA[
local target = player:getTarget();
if arg1.Name == "ROGUE_WOUND_ATTACK" then
if target:hasBuff(620313) and target:hasBuff(620314) then
return true
else
return false
end
elseif arg1.Name == "ROGUE_LOW_BLOW" then
if target:hasBuff(620313) then -- Bleed
LBBuff = target:getBuff(620314) -- Grevious Wound
if LBBuff and LBBuff.TimeLeft >= 3 then
if player.Energy >= 60 then
return true
else
return false
end
end
end
elseif arg1.Name == "ROGUE_SHADOWSTAB" then
SSBuff = target:getBuff(620313)
if SSBuff and SSBuff.TimeLeft >= 3 then
return false
end
end
]]></onPreSkillCast>
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Get Skill cooldown to use in profile
Thanks to all;
I will take your advices!
I will take your advices!
- ThulsaDoom
- Posts: 128
- Joined: Mon Oct 19, 2015 2:46 pm
Re: Get Skill cooldown to use in profile
I define the code for tab read in Onload section.
But I don't know how I can call these information (skillMaxCD, remainingCD) on "OnPreSkillcast", I do it in the traditional form: "if remainingCD > 4", but it doesn't work.
I'm missing something about variable declaration or calling.
But I don't know how I can call these information (skillMaxCD, remainingCD) on "OnPreSkillcast", I do it in the traditional form: "if remainingCD > 4", but it doesn't work.
I'm missing something about variable declaration or calling.
Re: Get Skill cooldown to use in profile
The table of skill info is arg1 so you would need something like
untested and to be honest not sure if it will work or not.
to test just do
--=== Added ===--
Ahh I see you are talking about the code posted by Bill D Cat, when in doubt use prints, that is what I say.
Code: Select all
if arg1:getRemainingCooldown() > 4 then
end
to test just do
Code: Select all
print(arg1:getRemainingCooldown())
Ahh I see you are talking about the code posted by Bill D Cat, when in doubt use prints, that is what I say.
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
- ThulsaDoom
- Posts: 128
- Joined: Mon Oct 19, 2015 2:46 pm
Re: Get Skill cooldown to use in profile
Yes (referring to Bill D Cat), I don't know how to link the code in onLoad section to onPresSkillCast.
But I will test what you propose.
Thanks
But I will test what you propose.
Thanks
Re: Get Skill cooldown to use in profile
Can you explain me what is actually happening. I understand that it checks for bleed for casting further attacks, but don't exactly know what's going on wherelisa wrote:This is what I use on rogue
Code: Select all
<onPreSkillCast><![CDATA[ local target = player:getTarget(); if arg1.Name == "ROGUE_WOUND_ATTACK" then if target:hasBuff(620313) and target:hasBuff(620314) then return true else return false end elseif arg1.Name == "ROGUE_LOW_BLOW" then if target:hasBuff(620313) then -- Bleed LBBuff = target:getBuff(620314) -- Grevious Wound if LBBuff and LBBuff.TimeLeft >= 3 then if player.Energy >= 60 then return true else return false end end end elseif arg1.Name == "ROGUE_SHADOWSTAB" then SSBuff = target:getBuff(620313) if SSBuff and SSBuff.TimeLeft >= 3 then return false end end ]]></onPreSkillCast>
Satisfaction is the end of desire!!
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: Get Skill cooldown to use in profile
Here's an explanation of what's going on during that sequence (in the comments):
So, the bot is taking it's turns attempting to use it's applicable skills. The onPreSkillCast section is what ensures that it only uses those skills at the right times. For instance, If the bot is trying to use a Low Blow, it will see if there is already a bleed on the target, because it's best to always use Shadowstab before the low blow.
Code: Select all
<onPreSkillCast><![CDATA[
local target = player:getTarget();
if arg1.Name == "ROGUE_WOUND_ATTACK" then -- if the skill getting ready to be used is Wound Attack:
if target:hasBuff(620313) and target:hasBuff(620314) then -- if target has bleed and Grevious wound...
return true -- if has both, then yes, use Wound Attack...
else
return false -- if does not have both, don't use wound attack.
end
elseif arg1.Name == "ROGUE_LOW_BLOW" then -- if skill getting ready to be used is Low Blow:
if target:hasBuff(620313) then -- Only use Low Blow if target has a bleed on...
LBBuff = target:getBuff(620314) -- Let's see how much time is left on the Grevious Wound:
if LBBuff and LBBuff.TimeLeft >= 3 then -- if 3 or more seconds of Greivous Wound remain...
if player.Energy >= 60 then -- and we have 60 or more energy...
return true -- then yes, use the Low Blow
else
return false -- otherwise, don't Low Blow yet.
end
end
end
elseif arg1.Name == "ROGUE_SHADOWSTAB" then -- If getting ready to do a Shadowstab...
SSBuff = target:getBuff(620313) -- Does target already have a bleed effect?
if SSBuff and SSBuff.TimeLeft >= 3 then -- how much time is reamaining on the bleed? If 3 or more seconds remaining on it...
return false -- then don't use Shadowstab.
end -- (otherwise it will use the shadowstab)
end
]]></onPreSkillCast>
Re: Get Skill cooldown to use in profile
Ok what I posted won't do what you want because you aren't after the cooldown of the skill trying to be used, I am making a few assumptions here because you haven't actually said what you are really trying to do.ThulsaDoom wrote:Yes (referring to Bill D Cat), I don't know how to link the code in onLoad section to onPresSkillCast.
But I will test what you propose.
Thanks
Code: Select all
<onLoad><![CDATA[
function getcooldown(skillname)
for k,v in pairs(settings.profile.skills) do -- go through skills you have in profile
if v.Name == skillname then -- look for the skill name you want, as it is listed in profile
local tmp = CSkill(v) -- this gets the skill info from memory
print(tmp:getRemainingCooldown()) -- this uses a function to get the cooldown of that skill, in this case it prints it.
return tmp:getRemainingCooldown()
end
end
end
]]></onLoad>
Code: Select all
<onPreSkillCast><![CDATA[
if getcooldown("ROGUE_ASSASSINS_RAGE") > 4 then
print("assasins rage has longer than 4 seconds as cooldown")
end
]]></onPreSkillCast>
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
- ThulsaDoom
- Posts: 128
- Joined: Mon Oct 19, 2015 2:46 pm
Re: Get Skill cooldown to use in profile
great, it works! Thanks
- ThulsaDoom
- Posts: 128
- Joined: Mon Oct 19, 2015 2:46 pm
Re: Get Skill cooldown to use in profile
Now I can select between "Keen Attack" or "Splitting Chop" depending on its availability. This allow to be efficient on rage use.
Here the options on <skills_warrior> and <OnPreSkillCast> for Warrior / Rogue.
Here the options on <skills_warrior> and <OnPreSkillCast> for Warrior / Rogue.
Code: Select all
<skill name="WARRIOR_SPLITTING_CHOP" hotkey="MACRO" priority="100"/>
<skill name="WARRIOR_OPEN_FLANK" hotkey="MACRO" priority="95" />
<skill name="WARRIOR_KEEN_ATTACK" hotkey="MACRO" priority="90" />
<skill name="WARRIOR_PROBING_ATTACK" hotkey="MACRO" priority="85" />
<skill name="ROGUE_THROW" hotkey="MACRO" priority="80" />
<skill name="WARRIOR_BLOOD_DANCE" hotkey="MACRO" priority="75" />
<skill name="WARRIOR_SLASH" hotkey="MACRO" priority="70" />
<skill name="ROGUE_SHADOWSTAB" hotkey="MACRO" priority="65" />
<skill name="WARRIOR_FRENZY" hotkey="MACRO" priority="50" autouse="false" />
<skill name="WARRIOR_FRENZIED_ATTACK" hotkey="MACRO" priority="50" autouse="false" />
<skill name="WARRIOR_COMPOSURE" hotkey="MACRO" priority="50" autouse="false" />
Code: Select all
<OnPreSkillCast><![CDATA[
if arg1.Name == "ROGUE_SHADOWSTAB" then
if player.Energy >= 40 then
if (target:hasBuff("Vulnerable")) or (target:hasBuff("Weakened")) then
return false
else
return true
end
else
return false
end
elseif arg1.Name == "WARRIOR_BLOOD_DANCE" then
if player.HP/player.MaxHP*100 > 90 then
if player.Energy <= 20 then
return true
else
return false
end
else
return false
end
elseif arg1.Name == "WARRIOR_PROBING_ATTACK" then
if player.Rage >= 45 then
return true
else
return false
end
elseif arg1.Name == "WARRIOR_OPEN_FLANK" then
if getcooldown("WARRIOR_SPLITTING_CHOP") < 3 then
return true
else
return false
end
elseif arg1.Name == "WARRIOR_SLASH" then
if player.Rage >= 60 then
return true
else
return false
end
end
]]></OnPreSkillCast>
Who is online
Users browsing this forum: Bing [Bot] and 3 guests