Page 1 of 1

musical instrument onload

Posted: Sun May 13, 2012 4:05 am
by kuripot

Code: Select all

	function Boss_buff()

	if Magic_Tambourine == true then
		if inventory:itemTotalCount(204463) >= 1 then
			inventory:useItem(204463) -- 3 days
			yrest(5500)
		elseif inventory:itemTotalCount(204571) >= 1 then
			inventory:useItem(204571) -- 7 days
			yrest(5500)
		elseif inventory:itemTotalCount(206420) >= 1 then
			inventory:useItem(206420) -- 30 days
			yrest(5500)
		end
		elseif Magic_Tambourine == party_true then
			yrest(5500)
		end
	if Magic_Guitar == true then
		if inventory:itemTotalCount(204461) >= 1 then
			inventory:useItem(204461) -- 3 days
			yrest(5500)
		elseif inventory:itemTotalCount(206418) >= 1 then
			inventory:useItem(206418) -- 7 days
			yrest(5500)
		elseif inventory:itemTotalCount(204569) >= 1 then
			inventory:useItem(204569) -- 30 days
			yrest(5500)
		end
		elseif Magic_Tambourine == party_true then
			yrest(5500)
		end
		changeProfileSkill("MAGE_FLAME", "AutoUse", true);
		changeProfileSkill("MAGE_FIREBALL", "AutoUse", true);
		changeProfileSkill("MAGE_FLAME", "Priority", 90);
		changeProfileSkill("MAGE_FIREBALL", "Priority", 100);
		player:cast("MAGE_ESSENCE_OF_MAGIC");
		player:cast("PRIEST_MAGIC_BARRIER");
		player:cast("MAGE_ENERGY_INFLUX");
		player:cast("MAGE_ELECTROSTATIC_CHARGE");
		player:cast("MAGE_INTENSIFICATION");
		player:cast("MAGE_ELEMENTAL_CATALYSIS");
		player:cast("PRIEST_REGENERATE");
	end
this onload for mage/priest are working... but my question is how to ignore the instrument if instrument are in cooldown stage?? because time consuming when he try to cast instrument even this is in cooldown stage

Re: musical instrument onload

Posted: Sun May 13, 2012 4:33 am
by rock5
You could use GetBagItemCooldown
http://www.theromwiki.com/API:GetBagItemCooldown
In the bot it would look something like this

Code: Select all

local maxCD, CurrentCD = RoMScript("GetBagItemCooldown(".. (item.SlotNumber - 60) ..")")
That's after you've found the item you want to check the cooldown of.

Re: musical instrument onload

Posted: Tue Aug 11, 2015 11:24 am
by srknszgn
where will be written. Please details. my English is bad

Re: musical instrument onload

Posted: Tue Aug 11, 2015 11:24 pm
by lisa
instead of a yrest(5500) do a small yrest(500) and then do a loop waiting for cast bar to finish.

Code: Select all

yrest(500)
while (player.Casting) do
player:updateCasting()
yrest(500)
end
If the cast bar hasn't started yet then it won't wait, so you might need to increase the first yrest(500) until it works 100%

Code: Select all

yrest(800)
while (player.Casting) do
player:updateCasting()
yrest(500)
end
Since you will use the code a few times make a local function for it, so it's easier to use and edit =)

Re: musical instrument onload

Posted: Fri Aug 14, 2015 9:02 pm
by lisa
I use this in one of my profiles for bossbuff

Code: Select all

	function BossBuff()
		local starttime = getTime()
		yrest(5000)
		
		-- use instrument 206420 30 day tambo
		inventory:useItem(206420)
		yrest(800)
		while (player.Casting) do
			player:updateCasting()
			yrest(500)
		end
		
		-- rest until fight starts or 15 seconds after timer started, I use 20 second timer
		repeat
			player:updateBattling()
			yrest(500)
		until deltaTime(getTime(),starttime) >= 15000 or player.Battling
		
		player:cast("WARDEN_SAVAGE_POWER");
		player:cast("SCOUT_ARROW_OF_ESSENCE");
		player:cast("SCOUT_BLOOD_ARROW");	
	end
Just to give you an example of timing and such.