103 posts
Posted 02 April 2013 - 05:47 PM
for z = 2,16 do
turtle.select(z)
if turtle.compareTo(1) == false then
turtle.drop()
end
end
Why on earth would that drop anything from slot 1?
1688 posts
Location
'MURICA
Posted 02 April 2013 - 07:05 PM
…It wouldn't?
7508 posts
Location
Australia
Posted 02 April 2013 - 07:14 PM
Is there more to your script than this? It could be happening somewhere else…
103 posts
Posted 02 April 2013 - 07:57 PM
There is more code - but it's blocked fine. And it worked fine in 1.4.7; like it should have. That's what's weird; it started this behavior (not working) with 1.52.
Here's the full program - it's still being worked on; and sorry it's not blocked properly - but ….
Spoiler
local loops = 2
– functions
local function tryDown()
while not turtle.down() do
if turtle.detectDown() then
turtle.digDown()
else
turtle.attackDown()
sleep( 0.75 )
end
end
end
local function tryUp()
while not turtle.up() do
if turtle.detectUp() then
turtle.digUp()
else
turtle.attackUp()
sleep( 0.5 )
end
end
end
local function tryForward()
while not turtle.forward() do
if turtle.detect() then
turtle.dig()
else
turtle.attack()
sleep( 0.5 )
end
end
end
–start getting oak
turtle.select(1)
for i = 1,loops do
– get sapling and plant…
turtle.turnLeft()
turtle.suck()
turtle.turnRight()
turtle.place()
– put the rest back
turtle.turnLeft()
turtle.drop()
turtle.turnRight()
– get bone
turtle.turnRight()
turtle.suck()
turtle.turnLeft()
for zz = 1,20 do
turtle.place()
sleep(0.5)
end
– put the rest back
turtle.turnRight()
turtle.drop()
turtle.turnLeft()
– cutdown tree
tryForward()
for y = 1,7 do
tryUp()
for x = 1,2 do
tryForward()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.dig()
turtle.turnRight()
turtle.dig()
turtle.turnRight()
tryForward()
end
end
for z = 2,16 do
turtle.select(z)
if turtle.compareTo(1) == false then
turtle.drop()
end
end
for y = 1,7 do
tryDown()
end
turtle.back()
– put wood in box
turtle.turnLeft()
turtle.turnLeft()
for y = 1,16 do
turtle.select(y)
turtle.drop()
end
turtle.select(1)
turtle.turnLeft()
turtle.turnLeft()
print ("Pausing for 45 seconds…")
print ("Working on loop # ",i," of ",loops,".")
sleep(45)
end
103 posts
Posted 02 April 2013 - 08:05 PM
Try putting that code by itself in a turtle; it's gotta be a computercraft bug. I'll go report it. It's acting REALLY strangely. (It looks like drop might now drop everything? Not just the slot?)
7508 posts
Location
Australia
Posted 02 April 2013 - 08:08 PM
its your code right here
--start getting oak
turtle.select(1)
for i = 1,loops do
-- get sapling and plant...
turtle.turnLeft()
turtle.suck()
turtle.turnRight()
turtle.place()
-- put the rest back
turtle.turnLeft()
turtle.drop()
that drops the first slot…
103 posts
Posted 02 April 2013 - 08:18 PM
Read the rest of the program :)/> - that part is correct :)/> - it is supposed to pick up from the box to the left; plants trees, puts the rest back. Goes to the box to the right; picks up bonemeal - places it on the tree; then puts it back… (ie. it's putting a sapling down and fertalizing it…)
The bug is at the top of the tree, after it's cut the wood - it's supposed to look at the first slot (which will be wood) then drop anything that isn't matching what's in slot 1; that's the problem - it's dropping everything (including slot 1)…
Try putting the first piece of code in a turtle (the lines I have above) - and put something in slot 1, slot 10 that match; then something in slot 16 (put 20 things) - and make it drop(1) - watch what happens… It bugs out.
103 posts
Posted 02 April 2013 - 08:23 PM
Actually don't even bother with a program - load 1 item in each slot; then go to lua
type in this:
turtle.select(1)
turtle.drop()
turtle.drop()
watch what happens… It starts dropping stuff from slot 2, then 3, then 4 - even tho slot 1 is still selected.
7508 posts
Location
Australia
Posted 02 April 2013 - 08:23 PM
oops there it is…
line 98 — 101
for y = 1,16 do
turtle.select(y)
turtle.drop()
end
7508 posts
Location
Australia
Posted 02 April 2013 - 08:25 PM
Actually don't even bother with a program - load 1 item in each slot; then go to lua
type in this:
turtle.select(1)
turtle.drop()
turtle.drop()
watch what happens… It starts dropping stuff from slot 2, then 3, then 4 - even tho slot 1 is still selected.
doesn't do that for me… rename startups, reboot your turtle and try it right away.
103 posts
Posted 03 April 2013 - 11:56 AM
So using default configuration; removed all mods but CC and Forge 611 - it's still doing it :(/>
What version of forge do you use?
2217 posts
Location
3232235883
Posted 03 April 2013 - 03:58 PM
103 posts
Posted 03 April 2013 - 05:28 PM
Strange - I tried it with the latest (and CC only); and with the recomended. Everytime, it would drop from slots that weren't selected… :/ I'll report it as a bug; but we did a fresh install - and it still does it (both on my server - and in single player)…
103 posts
Posted 03 April 2013 - 08:02 PM
Just an update; when I fill every slot - the code works exactly as it should. When 1 slot is empty; it bugs out.
222 posts
Posted 04 April 2013 - 04:41 AM
You can make a workaround. If it drops things from other slots only if you try to drop something from an empty slot, do this:
for i = 2,16 do
if turtle.getItemCount(i) > 0 then
turtle.select(i)
if not turtle.compareTo(1) then
turtle.drop()
end
end
end
Edit: And it will run a bit faster, since turtle.select requires about a tick to be done, when turtle.getItemCount performed almost instantly
Edited on 04 April 2013 - 02:48 AM
103 posts
Posted 04 April 2013 - 10:54 AM
Thanks PonyKuu - Cloudy confirmed the bug; but I'll give this a try :)/>