Get Skill cooldown to use in profile

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Karkant
Posts: 3
Joined: Thu Aug 20, 2015 6:55 am

Get Skill cooldown to use in profile

#1 Post by Karkant » Thu Aug 20, 2015 7:10 am

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

User avatar
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

#2 Post by Bill D Cat » Thu Aug 20, 2015 1:06 pm

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

Karkant
Posts: 3
Joined: Thu Aug 20, 2015 6:55 am

Re: Get Skill cooldown to use in profile

#3 Post by Karkant » Thu Aug 20, 2015 1:30 pm

Super :)

But, I need to use this code as a function? Where I can declare it in profile?

Thanks for your support!

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Get Skill cooldown to use in profile

#4 Post by noobbotter » Thu Aug 20, 2015 2:29 pm

You can have an onLoad section in your profile and declare the function in there:

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>
Then in your onPreskillCast event, call the function.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Get Skill cooldown to use in profile

#5 Post by lisa » Thu Aug 20, 2015 9:28 pm

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

Karkant
Posts: 3
Joined: Thu Aug 20, 2015 6:55 am

Re: Get Skill cooldown to use in profile

#6 Post by Karkant » Fri Aug 21, 2015 2:14 am

Thanks to all;

I will take your advices!

User avatar
ThulsaDoom
Posts: 125
Joined: Mon Oct 19, 2015 2:46 pm

Re: Get Skill cooldown to use in profile

#7 Post by ThulsaDoom » Tue Nov 03, 2015 3:01 am

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.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Get Skill cooldown to use in profile

#8 Post by lisa » Tue Nov 03, 2015 3:45 am

The table of skill info is arg1 so you would need something like

Code: Select all

if arg1:getRemainingCooldown() > 4 then


end
untested and to be honest not sure if it will work or not.

to test just do

Code: Select all

print(arg1:getRemainingCooldown())
--=== 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.
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

User avatar
ThulsaDoom
Posts: 125
Joined: Mon Oct 19, 2015 2:46 pm

Re: Get Skill cooldown to use in profile

#9 Post by ThulsaDoom » Tue Nov 03, 2015 4:49 am

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

User avatar
sauhard
Posts: 130
Joined: Wed Mar 05, 2014 10:30 am

Re: Get Skill cooldown to use in profile

#10 Post by sauhard » Tue Nov 03, 2015 7:32 am

lisa 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>
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 where :P
Satisfaction is the end of desire!!

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Get Skill cooldown to use in profile

#11 Post by noobbotter » Tue Nov 03, 2015 11:19 am

Here's an explanation of what's going on during that sequence (in the comments):

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>
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.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Get Skill cooldown to use in profile

#12 Post by lisa » Tue Nov 03, 2015 11:49 pm

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
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.

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>
Hopefully this will at least get you started in what you are really trying to do.
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

User avatar
ThulsaDoom
Posts: 125
Joined: Mon Oct 19, 2015 2:46 pm

Re: Get Skill cooldown to use in profile

#13 Post by ThulsaDoom » Fri Nov 06, 2015 4:22 pm

great, it works! Thanks

User avatar
ThulsaDoom
Posts: 125
Joined: Mon Oct 19, 2015 2:46 pm

Re: Get Skill cooldown to use in profile

#14 Post by ThulsaDoom » Sat Nov 07, 2015 4:47 am

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.

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>

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests