Cooldown of Items - Possible?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
sfrattini
Posts: 35
Joined: Wed Jun 03, 2009 3:45 pm

Cooldown of Items - Possible?

#1 Post by sfrattini » Tue Nov 22, 2011 7:15 am

Hello guys,

being looking for this in the forum but could not find anything except the skill cooldown function.
I am trying to check instruments (lute, tamb) cooldown for a meme bot.

Is there any way to do this?

Thanks in advance.

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

Re: Cooldown of Items - Possible?

#2 Post by lisa » Tue Nov 22, 2011 9:06 am

This is actually more complicated then you might imagine.

Item info doesn't show a cooldown for the item, so can't just go to the spot where the item info is kept.

Instead what frogster decided to do was create a cooldown for the instruments but also a cooldown for the buff at the same time.
As you may know you can't stack some instruments and also some instruments share the same cooldown.
So what they did was have 3 spots in memory that track the cooldown before the buff can be used.

I'll try to explain better with an example.
address1
address2
address3

If you use tambo address1 starts counting down from 3 mins, at the same time address2 starts counting down from 30, thats the buff time.
if you then use lute, address3 starts counting down from 3 mins

When address2 reaches 0 it then starts counting down from what ever address3 was at, address3 then stops counting down and stays with that value.

So at this stage address1 is cooldown of tambo and address2 is cooldown of lute (this example only)
When address1 reaches 1 it then starts counting down from what ever address2 was at and address2 then stays at that spot.

So once all cooldowns are finished
address1 = 0
address2 = 1-180 (what ever it was at before address1 reached 1)
address3 = 1-180 (what ever it was at before address2 reached 1)


Incase you wish to have a look in CE the addresses are as follows.

Code: Select all

9CE354
9CE370
9CE38C
--=== aditional ===--
Those addresses arn't just for instruments, also include skillls/items.
More then 3 addresses aswell, I only used 3 as an example.
--=============--

Another interesting address is
9CFACC
It shows how many things are on cooldown, includes items and skills.
I guess you could check for if that address = 0 and then cast both instruments. but if you had a skill on cooldown it wouldn't show as 0.

It would be very difficult to track instrument cooldowns using memory.

I would suguest you just create a timer when using the instruments and track it that way. Aslong as the script isn't restarted it should work fine.
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

sfrattini
Posts: 35
Joined: Wed Jun 03, 2009 3:45 pm

Re: Cooldown of Items - Possible?

#3 Post by sfrattini » Tue Nov 22, 2011 10:00 am

thanks Lisa for your reply.
It seems very complicate to realize, I think I will take your suggestion and try with a timer based condition.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Cooldown of Items - Possible?

#4 Post by rock5 » Tue Nov 22, 2011 9:59 pm

Lisa, that's interresting. I assume as the timers run out and the rest move up one, the frozen leftover timers are just obsolete memory areas. I assume also that 9CFACC also reduces in number as the cooldowns expire. You should be able to itterate through the active colldowns and look for a specific type of cooldown. If not found then that type of item isn't on cooldown. I'm assuming that there is some sort of id number assocciated with each timer otherwise how would the game be able to destinguish them. I'll have a quick look into it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Cooldown of Items - Possible?

#5 Post by rock5 » Tue Nov 22, 2011 11:08 pm

Looks like those addresses are not cooldowns but duration. I tested some pots and the timer went for 30 not 15. The cooldown is 15. We don't really need duration as we can just check if a buff or effect is still on.

I wonder if there is somewhere where cooldowns are stored like that.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Cooldown of Items - Possible?

#6 Post by lisa » Wed Nov 23, 2011 1:18 am

If you haven't got any instruments try using a skill with long cooldown, like 5 mins.

address1 will be the cooldown and address2 will be the buff duration.

The 9CFACC address seems to be the number of cooldowns and not buff durations in that section of memory, I didn't test it extensively enough to say exactly what is in the area and what isn't as I decided it would just be simpler to do a timer when calling the instrument.

I did notice what appeard to be buff Id's and also item Id's in the same section so I assume you could do more work on it, what annoyed me was that when the countdowns move the info doesn't change so you could be getting information that is not only old but doesn't change.
I guess using the 9CFACC to determine how far into the memory you look would work.
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

radulfizz
Posts: 19
Joined: Thu Sep 23, 2010 7:09 am

Re: Cooldown of Items - Possible?

#7 Post by radulfizz » Sun Nov 27, 2011 6:28 am

Not sure if I understood the original question right,
but how about putting the item into an actionbar and use

Code: Select all

cooldown, remaining = GetActionCooldown(slotnumber)

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

Re: Cooldown of Items - Possible?

#8 Post by lisa » Fri Dec 02, 2011 1:42 am

If you have the instrument in your bag, not itemshop bag you can use this.

http://www.theromwiki.com/API:GetBagItemCooldown


Code: Select all

item = inventory:findItem(instrumentID)
if item then
_slot = item.SlotNumber -- might need to use BagId instead of SlotNumber, can't remember which is which off hand.
end
repeat 
local maxCD, CurrentCD = RoMScript("GetBagItemCooldown (".._slot..");")
yrest(1000) -- 1 second rest
until CurrentCD == 0
Just wrote that by hand with no testing, obviously need to change the instrumentID to the actual instrument ID.
Also make sure the instrument is in a slot in your bag, NOT item shop bag.
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Cooldown of Items - Possible?

#9 Post by rock5 » Fri Dec 02, 2011 4:50 am

It looks like it starts at slot 1 so it wouldn't be the bagid. So that means you would have to use

Code: Select all

_slot = item.SlotNumber - 60
I think you can use the shop bag. Just use

Code: Select all

item = inventory:findItem(instrumentID)
if item then
    if item.SlotNumber > 60 then
        _slot = item.SlotNumber - 60 
        func = "GetBagItemCooldown"
    elseif 51 > item.SlotNumber then
        _slot = item.SlotNumber 
        func = "GetGoodsItemCooldown"
    else
        error("There is no cooldown function for the magic box. Take the item out of the box.")
    end
end
repeat 
    local maxCD, CurrentCD = RoMScript(func.."(".._slot..");")
    yrest(1000) -- 1 second rest
until CurrentCD == 0
Yeh, I know. I always have to go complexifying things. :D
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

kuripot
Posts: 493
Joined: Mon Nov 07, 2011 9:14 pm

Re: Cooldown of Items - Possible?

#10 Post by kuripot » Tue Aug 21, 2012 4:49 am

how can i use this for cooldown??

Code: Select all

	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

kuripot
Posts: 493
Joined: Mon Nov 07, 2011 9:14 pm

Re: Cooldown of Items - Possible?

#11 Post by kuripot » Tue Aug 21, 2012 4:54 am

is this correct?? i want to use as onload function

Code: Select all

function Cooldown()
item = inventory:findItem(instrumentID)
if item then
    if item.SlotNumber > 60 then
        _slot = item.SlotNumber - 60
        func = "GetBagItemCooldown"
    elseif 51 > item.SlotNumber then
        _slot = item.SlotNumber
        func = "GetGoodsItemCooldown"
    else
        error("There is no cooldown function for the magic box. Take the item out of the box.")
    end
end
repeat
    local maxCD, CurrentCD = RoMScript(func.."(".._slot..");")
    yrest(1000) -- 1 second rest
until CurrentCD == 0
end
what id i need to use??

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Cooldown of Items - Possible?

#12 Post by grande » Mon Aug 27, 2012 7:34 pm

It's easy to find the ID number.. just punch in whatever item you are looking for at runesdatabase.com. so for a magic guitar it's 204461 or 204543 (Not sure why there's two of them...)

So anyways.. It would be really helpful if the examples were easier to follow by giving a no kidding this is what your code will look like because when I see syntax like (".._slot..") I go... WTF do I type here? Is it actually supposed to look like ("1") where 1 is the bag slot or do I actually type? (".._slot..") is a lot different looking than ("1")

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Cooldown of Items - Possible?

#13 Post by rock5 » Mon Aug 27, 2012 7:52 pm

Here is an explanation of that.

When sending a string command in game with an option using RoMScript you can use

Code: Select all

RoMScript("Function(10)")
You would use that if you are always going to use 10.

But if you are using a variable then you need to insert it into the string. And because the variable only exists in the bot, not the game, you have to insert the value the variable holds, not the variable itself. So you would do.

Code: Select all

var = 10
RoMScript("Function(" .. var .. ")")
That's actually made up of 3 strings; "Function", var and ")". Put them together and you get "Function(10)".

Hope that clears it up.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Cooldown of Items - Possible?

#14 Post by grande » Mon Aug 27, 2012 8:11 pm

Thanks Rock, that did help a lot. Slowly getting over my phobia of such odd texts in code.

But to clarify again, when the code says

Code: Select all

item = inventory:findItem(instrumentID)
We actually have to put the ###### where it says instrumentID above, right? so for a magic guitar it's one of those 204461 or 204543 numbers? but still that code then has to be linked by another if/then statement to enable bossbuff() function to work.. as in ... oh forget it lol

Just going to work on some sort of check buff scenario

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Cooldown of Items - Possible?

#15 Post by rock5 » Mon Aug 27, 2012 8:22 pm

inventory:findItem is a bot function so you don't have to do that stuff I showed you in my previous post. It returns a table variable that describes the found item or nil if it found nothing. So you could do something like

Code: Select all

item = inventory:findItem("Magic Guitar")
if item ~= nil then
    item:use()
end
Note you don't have to use the item id unless you are trying to make it multilingual or just to make sure it uses the right item.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Cooldown of Items - Possible?

#16 Post by grande » Mon Aug 27, 2012 8:22 pm

Okay, here's a thought... Why can't I just use the get bag slot cooldown function (http://www.theromwiki.com/API:GetBagItemCooldown) similarly to this useitem function?

Code: Select all

		if inventory:itemTotalCount(204544) > 0 then
			inventory:useItem(204544);
So...

Code: Select all

if local maxCD, CurrentCD = GetBagItemCooldown(1); < 0 then
         inventory:useItem(204544);
errr maybe I'm missing something here LOL

Maybe this is closer?

Code: Select all

item = inventory:findItem("Magic Guitar")
if item ~= nil and local maxCD, CurrentCD = RoMScript("GetBagItemCooldown(".. (item.SlotNumber - 60) ..")") then
    item:use()
end
That's a lot of cut/paste stuff you already posted somewhere

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Cooldown of Items - Possible?

#17 Post by rock5 » Mon Aug 27, 2012 8:54 pm

That last one was close but you can't assign values to variable in the if statement.

This is how I would do it.

Code: Select all

local item = inventory:findItem("Magic Guitar")
if item ~= nil then
    local maxCD, CurrentCD = RoMScript("GetBagItemCooldown(".. (item.SlotNumber - 60) ..")")
    if CurrentCD == 0 then
        item:use()
    end
end
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Cooldown of Items - Possible?

#18 Post by grande » Mon Aug 27, 2012 9:55 pm

Thanks Rock

Post Reply

Who is online

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