-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#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.
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#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.”
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#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
-
fred55555
- Posts: 101
- Joined: Sat Aug 07, 2010 7:57 pm
#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
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#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.”
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#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.
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#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()
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#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,
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.”
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests