logout on low inventry item

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

logout on low inventry item

#1 Post by lisa » Wed Nov 10, 2010 10:15 pm

I did a search but couldn't find anything, I want the bot to log out once items get below a number.

Code: Select all

	if 5 > inventory:itemTotalCount("Barbarian Herbs") then (player:logout) 
I tried a few things but that was the best I could come up with, bot doesn't like it though.

Anyone know how to do what I'm trying to do, or maybe I'm just putting it in wrong place on the lua. Either way any help would be appreciated.
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: logout on low inventry item

#2 Post by rock5 » Wed Nov 10, 2010 11:50 pm

That's fine, you just have to write it correctly. 'logoff' is a function so has to be followed by () and you have to finish the 'if' statement with an 'end'.

Code: Select all

 if 5 > inventory:itemTotalCount("Barbarian Herbs") then player:logout() 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: logout on low inventry item

#3 Post by lisa » Thu Nov 11, 2010 7:18 am

Works perfectly, I am glad I was close, I am still learning =)

Thank you very much
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

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: logout on low inventry item

#4 Post by fred55555 » Fri Nov 12, 2010 11:12 am

Rock

Could you also create a line that would check if your first 2 bags are full 1-60 then log out ?

that would be helpful to me please

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

Re: logout on low inventry item

#5 Post by rock5 » Fri Nov 12, 2010 7:54 pm

fred55555 wrote:Rock

Could you also create a line that would check if your first 2 bags are full 1-60 then log out ?

that would be helpful to me please
If you only have the 2 bags then it's just;

Code: Select all

if inventory:itemTotalCount(0) == 0 then player:logout() end -- Counting empties
If you have rented bags but only want to count the first 2 bags, it gets more complex. Let me know if that's what you want.
  • 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
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: logout on low inventry item

#6 Post by jduartedj » Sat Nov 13, 2010 10:26 am

rock5 wrote: If you have rented bags but only want to count the first 2 bags, it gets more complex. Let me know if that's what you want.

Maybe a loop to check the bagslots 1-60, given that 60+ slots belong to other bags.
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates

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

Re: logout on low inventry item

#7 Post by lisa » Sat Nov 13, 2010 10:35 pm

I stumbled across this, might help if you have more then 2 bags

Code: Select all

 INV_MAX_SLOTS = 60,      -- maximal slots to update in the inventory:update()
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: logout on low inventry item

#8 Post by rock5 » Mon Nov 15, 2010 7:44 am

lisa wrote:I stumbled across this, might help if you have more then 2 bags

Code: Select all

 INV_MAX_SLOTS = 60,      -- maximal slots to update in the inventory:update()
I don't think that does anything anymore. Since the change to updating the inventory from memory makes it so fast, it was changed to just update the whole inventory and ignore that value.

You could try changing line 11 of inventory.lua,

Code: Select all

		self.MaxSlots = 180;
That should work.

Or create your own loop like jduartedj said. It would look something like this.

Code: Select all

local empties = 0
for i = 1, 60 do
    if inventory.BagSlot[i].Id == 0 then
        empties = empties + 1
    end
end
if empties == 0 then player:logout() 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

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests