294 posts
Posted 05 October 2012 - 12:55 PM
Let's say turtle digs sand now. It can't go into selected slot, because it's already occupied by non-sand block. So it would go into second slot. But there is already sand block in third slot. So now we have sand in second and third slot.
Why not making it like vanilla inventory? So if selected slot is full, it would first try to fill all stacks of the same item and after that, it would occupy new empty slot.
3790 posts
Location
Lincoln, Nebraska
Posted 05 October 2012 - 06:53 PM
I don't think that would be a good idea. That defeats some of the crafting programs out there, that rely on breaking a block, putting it in one slot, changing slots and continuing witht he same block.
1548 posts
Location
That dark shadow under your bed...
Posted 05 October 2012 - 07:02 PM
you could make a toggle for vanilla inventory behavior I guess…
818 posts
Posted 05 October 2012 - 07:04 PM
sounds halfway retarted, if you get a block in the first slot put it in the third slot? lol
3790 posts
Location
Lincoln, Nebraska
Posted 05 October 2012 - 07:05 PM
You could just solve this with a simple bit of smart coding:
for i = 1,16 do
turtle.select(i)
if turtle.compare() then
turtle.dig()
end
end
That should compare what's in front of it, and if it's the same as the selected slot, it digs. No special fancyness involved.
1548 posts
Location
That dark shadow under your bed...
Posted 05 October 2012 - 07:24 PM
hahaha, trust Cranium to make an idiot out of me by thinking of a solution I realy should have :(/>/> nice idea there
222 posts
Posted 05 October 2012 - 07:32 PM
That's really a bad idea, because it is so freaking slow. don't use a select function too much if you want your functions be fast…
1548 posts
Location
That dark shadow under your bed...
Posted 05 October 2012 - 07:42 PM
I dunno, in my CC turtle.select is instant. I saw your post a while back and sympathise. that must truly suck
3790 posts
Location
Lincoln, Nebraska
Posted 05 October 2012 - 07:42 PM
Who cares if it's slow? Excavate programs should just be fire and forget. I think that the turtle.select() would be a way better idea than changing the mod to do something that might cause problems for existing programs. If you have a better idea, I'm open to suggestions. :(/>/>
222 posts
Posted 05 October 2012 - 08:03 PM
I dunno, in my CC turtle.select is instant. I saw your post a while back and sympathise. that must truly suck
Well, one selection is fast. The problem is when you select a lot of them and do a lot of comparing…
Who cares if it's slow? Excavate programs should just be fire and forget. I think that the turtle.select() would be a way better idea than changing the mod to do something that might cause problems for existing programs. If you have a better idea, I'm open to suggestions. :(/>/>
I don't suggest to change the mod and break a lot of crafting programs… I think, said situation (sand in third slot) can't occur very often, if you always select first slot before digging something. An if you build something - you can make a function, which can select any slot, which has required item. Like that:
function searchItem (slot)
turtle.select (slot)
local found = 0
for i=1,16 do
if i ~= slot then
if turtle.getItemCount (i) > 0 then
if turtle.compareTo (i) then
found = i
end
end
end
end
if found == 0 then
if turtle.getItemCount (slot) > 1 then
found = slot
else
turtle.select(1)
return false
end
end
turtle.select (found)
return true
end
And it helps you to keep one item in the gived slot, so you'll never use the last piece of reference item. Also it always selects the last slot with the required item.
724 posts
Posted 06 October 2012 - 07:29 AM
Function to move items to the specified slot of inventory would fit real needs quite more. For example turtle will be able to compact it's inventory in such cases.
1111 posts
Location
Portland OR
Posted 06 October 2012 - 07:34 AM
Function to move items to the specified slot of inventory would fit real needs quite more. For example turtle will be able to compact it's inventory in such cases.
You can do that very easily using a chest, turtle.drop(), turtle.select(), and turtle.suck().
724 posts
Posted 06 October 2012 - 07:37 AM
Easily but unreliable. And you need Chest for this trick.
1111 posts
Location
Portland OR
Posted 06 October 2012 - 07:42 AM
The turtle can carry the chest and place it when it needs to "compress" the inventory to make more space available. The only thing you wouldn't be able to do is say I was dirt in slot 1, cobble in slot 2, etc… Well unless you take up some of the spaces to give it something to compare against but then thats going to contradict what you're trying to achieve.
294 posts
Posted 06 October 2012 - 09:25 AM
I don't think that would be a good idea. That defeats some of the crafting programs out there, that rely on breaking a block, putting it in one slot, changing slots and continuing witht he same block.
If you have empty slot selected, item would go into empty slot. Stacking would occur only if item cannot go into selected slot. That would not break anything.
You could just solve this with a simple bit of smart coding:
for i = 1,16 do
turtle.select(i)
if turtle.compare() then
turtle.dig()
end
end
That should compare what's in front of it, and if it's the same as the selected slot, it digs. No special fancyness involved.
1. As somebody above said - it's super slow, it takes several seconds just to mine a block. I know mining programs are set and forget, but why would you wait whole day just to dig out small room?
2. What if you are destroying blocks like redstone or lapis? That way you cannot compare.
1111 posts
Location
Portland OR
Posted 06 October 2012 - 10:03 AM
I don't think that would be a good idea. That defeats some of the crafting programs out there, that rely on breaking a block, putting it in one slot, changing slots and continuing witht he same block.
If you have empty slot selected, item would go into empty slot. Stacking would occur only if item cannot go into selected slot. That would not break anything.
Depending on how people have their codes setup it most definitely could break something. It's not a good idea to possibly break quite a few users code and complicate the crafting process to accomplish this. With a little bit of coding you can achieve this already if it is the functionality that you want in your programs. If its something you can't compare prior to digging, then compare it after. I personally have never had turtle.compare() takes seconds to compare 1 block. I've seen vidoes of mining programs that use turtle.compare() on every block to see if its something they should mine or not and it takes ~1 second to check 4 blocks around the turtle, its not going to cost you that much time.
2447 posts
Posted 06 October 2012 - 12:07 PM
To be honest, changing this behaviour would break crafting programs (and I believe that is the reason the behaviour is like this in the first place). However I will discuss this with dan.
294 posts
Posted 06 October 2012 - 12:43 PM
Sure you can compare it after, but you can't do anything about it (you cannot move stuff around turtle's inventory).
If I have chest nearby then I can just dump stuff into the chest. Point of this is that turtle could carry more stuff.
Can anyone give me example program that would break? I don't really get this.
1111 posts
Location
Portland OR
Posted 06 October 2012 - 01:12 PM
As I said above you can have the turtle carry a chest, and if you use an Ender Chest you don't have to take the items out of the chest. Just have the turtle pick it back up and you're good to go. 8 obsid and 1 eoe is not a bad investment for that luxury.
724 posts
Posted 06 October 2012 - 02:47 PM
Have you tried to pick Ender Chest back up?
It will break FYI.
2447 posts
Posted 06 October 2012 - 03:43 PM
Can anyone give me example program that would break? I don't really get this.
Seems like I misread. I will speak to dan about it, and see if we can't change it to combine if it can, unless the slot you're putting in is empty or contains one of the item already.