Jump to content




Computercraft bug - or am I just missing the obvious?


  • You cannot reply to this topic
15 replies to this topic

#1 gronkdamage

  • Members
  • 115 posts

Posted 02 April 2013 - 04: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?

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 02 April 2013 - 06:05 PM

...It wouldn't?

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 April 2013 - 06:14 PM

Is there more to your script than this? It could be happening somewhere else...

#4 gronkdamage

  • Members
  • 115 posts

Posted 02 April 2013 - 06: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


#5 gronkdamage

  • Members
  • 115 posts

Posted 02 April 2013 - 07: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?)

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 April 2013 - 07: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...

#7 gronkdamage

  • Members
  • 115 posts

Posted 02 April 2013 - 07: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.

#8 gronkdamage

  • Members
  • 115 posts

Posted 02 April 2013 - 07: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.

#9 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 April 2013 - 07:23 PM

oops there it is...

line 98 — 101

for y = 1,16 do
  turtle.select(y)
  turtle.drop()
end


#10 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 April 2013 - 07:25 PM

View Postgronkdamage, on 02 April 2013 - 07:23 PM, said:

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.

#11 gronkdamage

  • Members
  • 115 posts

Posted 03 April 2013 - 10: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?

#12 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 03 April 2013 - 02:58 PM

the absolute latest

#13 gronkdamage

  • Members
  • 115 posts

Posted 03 April 2013 - 04: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)...

#14 gronkdamage

  • Members
  • 115 posts

Posted 03 April 2013 - 07: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.

#15 PonyKuu

  • Members
  • 215 posts

Posted 04 April 2013 - 03: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 by PonyKuu, 04 April 2013 - 03:48 AM.


#16 gronkdamage

  • Members
  • 115 posts

Posted 04 April 2013 - 09:54 AM

Thanks PonyKuu - Cloudy confirmed the bug; but I'll give this a try :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users