Page 1 of 1

Wait for cooldown

Posted: Mon Apr 25, 2011 10:06 pm
by kanta
I've been searching around but haven't been able to find anything in reference to an idea I would like to try in my waypoint file.

Right now, in my KS farming waypoint, I have it waiting for a random amount of time (player:restrnd) before entering combat with a boss so that my Arrow of Essence (5 minute cooldown) is ready before I continue. The time varies greatly due to how quickly the previous boss was killed and how long it takes to get to the next boss. Is there a command I can use that will make my character wait at a specific waypoint until a cooldown has ended?

Such as

if skill_cooldown == 0 then
player:findTarget("Goddess of Art's Disciple");

thanks in advance

Re: Wait for cooldown

Posted: Mon Apr 25, 2011 10:20 pm
by rock5
Probably the easiest way would be to use the ingame function GetSkillCooldown.

Code: Select all

local cooldown, remaining = RoMScript("GetSkillCooldown(4,1)")
And then rest the remaining time.

Re: Wait for cooldown

Posted: Mon Apr 25, 2011 10:24 pm
by kanta
Wow, ok, didn't expect such a quick reply. I'll have to try this tomorrow, getting ready to sleep for work tomorrow. Thanks Rock :)

Re: Wait for cooldown

Posted: Tue Apr 26, 2011 5:30 pm
by kanta
Well, I couldn't figure out how to make it rest the remaining time so this is what I did:

Code: Select all

	<!-- #125 --><waypoint x="2365" z="4909" y="340">
			local cooldown, remaining = RoMScript("GetSkillCooldown(4,1);")
				if remaining > 1 then
					__WPL:setWaypointIndex(125);
				else
					__WPL:setWaypointIndex(126);
               end;
	</waypoint>
**EDIT**
changed code to:

Code: Select all

			local cooldown, remaining = RoMScript("GetSkillCooldown(4,1);")
				while remaining > 1 do
					player:restrnd(101, 5, 10);
        end;
**EDIT #2**
Scratch that last code change.... It doesn't come out of the loop.

Re: Wait for cooldown

Posted: Tue Apr 26, 2011 9:21 pm
by rock5
I would have just done

Code: Select all

player:rest(remaining)

Re: Wait for cooldown

Posted: Wed Apr 27, 2011 4:56 am
by kanta
Once again, you have my gratitude Rock.

See, I didn't know that was even possible. I'm completely new to this scripting. All I know is the information I can find floating around and much of what can be done is not documented, or at least not easily searchable. The examples given for most commands are pretty vague and rely on people knowing how to script in the first place. I rely mainly on scripts I can find and reverse engineer. But since most people do not share any scripts of worth, even that avenue of learning is severely lacking.