Page 1 of 1
logout on low inventry item
Posted: Wed Nov 10, 2010 10:15 pm
by lisa
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.
Re: logout on low inventry item
Posted: Wed Nov 10, 2010 11:50 pm
by rock5
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
Re: logout on low inventry item
Posted: Thu Nov 11, 2010 7:18 am
by lisa
Works perfectly, I am glad I was close, I am still learning =)
Thank you very much
Re: logout on low inventry item
Posted: Fri Nov 12, 2010 11:12 am
by fred55555
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
Re: logout on low inventry item
Posted: Fri Nov 12, 2010 7:54 pm
by rock5
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.
Re: logout on low inventry item
Posted: Sat Nov 13, 2010 10:26 am
by jduartedj
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.
Re: logout on low inventry item
Posted: Sat Nov 13, 2010 10:35 pm
by lisa
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()
Re: logout on low inventry item
Posted: Mon Nov 15, 2010 7:44 am
by rock5
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,
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