Jump to content




Issue that I can't figure out with .drop


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

#1 gronkdamage

  • Members
  • 115 posts

Posted 03 April 2013 - 04:38 PM

So this is the extent of my program (there's more - but I've tested it using JUST this code (nothign else) and it does the same thing that the full program does...)

for z = 2,16 do
turtle.select(z)
if turtle.compareTo(1) == false then
turtle.drop()
end
end

I'll put stuff in slot 1, 3, 5, 7, 9, 11. (some items are identical to slot 1; but most are not) -- after I run that block of code; the turtle drops everything (including the stuff in slot 1). I asked in "Ask a Pro" and theoriginalbit says it's working for him.

I then deleted Minecraft and reinstalled from scratch (redownloaded everything) and tried it again; got the same behavior. So I downloaded the latest forge (I was using the recomended) and the behavior still persisted. I can't figure it out. I've tried it in single player AND on my multiplayer server.

It's driving me nuts (it was working in 1.5 (for MC 1.4.7)) - can you verify everything is working fine (or maybe let me know how I can fix it?) :)

#2 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 03 April 2013 - 05:33 PM

Double check for any typos, that code should work.

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 03 April 2013 - 05:37 PM

here is the "Ask a Pro" thread, for anyone interested in what has been suggested

http://www.computerc...ng-the-obvious/

#4 gronkdamage

  • Members
  • 115 posts

Posted 03 April 2013 - 06:49 PM

View PostDlcruz129, on 03 April 2013 - 05:33 PM, said:

Double check for any typos, that code should work.
That's the entire block of code that I've been testing. When I run that, with stuff in most slots; everything (including slot 1 and duplicates) - drops. It's driving me nuts why it would work with 1.5 (MC 1.4.7) and not 1.52 (MC 1.5.1) :( Interestingly, when I fill EVERY slot; it works fine...

#5 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 03 April 2013 - 10:36 PM

Do you have any peripherals installed.

#6 gronkdamage

  • Members
  • 115 posts

Posted 03 April 2013 - 10:50 PM

All of them have a tool (diamond pick, or diamond axe) - one of them has a wireless modem attached to it. (And just in case you mean peripherals for ComputerCraft - then no; using default CC - the only thing we did was disable use fuel)

#7 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 04 April 2013 - 05:27 AM

Confirmed as a bug, and fixed in the next version.

Testers, Y U NO TEST!?

#8 gronkdamage

  • Members
  • 115 posts

Posted 04 April 2013 - 09:52 AM

Phew! I was going nuts! Thanks Cloudy! I look forward to the next update :)

#9 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 04 April 2013 - 10:08 AM

View Postgronkdamage, on 04 April 2013 - 09:52 AM, said:

Phew! I was going nuts! Thanks Cloudy! I look forward to the next update :)

For a quick fix, check there is something in the slot before dropping it!

#10 Pho3niX90

  • Members
  • 7 posts

Posted 08 April 2013 - 07:50 AM

A Better temp fix is to check if there is something in the slot, for example:

instead of just
turtle.select(2)
turtle.drop()

rather do

turtle.select(2)

if turtle.getItemCount(2) > 1 then
turtle.drop()
end

#11 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 08 April 2013 - 08:10 AM

Uh... I said exactly that?

#12 Pho3niX90

  • Members
  • 7 posts

Posted 08 April 2013 - 09:06 AM

Sorry, was just giving an example to show exactly what you were saying.

#13 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 02 May 2013 - 07:42 PM

View PostPho3niX90, on 08 April 2013 - 07:50 AM, said:

A Better temp fix is to check if there is something in the slot, for example:

instead of just
turtle.select(2)
turtle.drop()

rather do

turtle.select(2)

if turtle.getItemCount(2) > 1 then
turtle.drop()
end
It would actually be:

if turtle.getItemCount(slot) > 0 then
turtle.drop()
end
With your code:
If I place something in slot number 1, it won't drop since the item count is not greater than one. Greater than or equal to would also be acceptable.

#14 PrinceTommen

  • New Members
  • 1 posts

Posted 04 May 2013 - 02:50 AM

For some reason I cannot create a new topic in the bug section, so I will just post it there since the bug I am about to report is pretty similar to this one, and appeared at the same time:

Using the turtle.transferTo() function to transfer from an empty slot to an other empty slot will move the items from the next slot that is not empty (generally looping and taking the first one). The issues in the programs are easily corrected by a condition, but it is obviousely something worth fixing.
I think the problem behind this bug is the same than the one behind the bug this topic was dedicated to (which I had also noticed), since the "looping" behaviour to try and reach the next non-empty slot is exactly the same.

An other bug that I have noticed is pretty different:

Executing this loop:

for i=1, 100, do
handle = fs.open("m", "w")
handle.write(i)
handle.close()
print(i)
end

Generates a surprising glitch: sometimes, it is executed 100 times without any problem, but sometimes it returns "attempt to index ? (a nil value)" about the "handle.write(i)", and that after a totally unpredictable number of execution (it goes from 2 to 99, according to my tests).
Using a while loop results in the same bug.

Thank you very much for your attention.

#15 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 04 May 2013 - 03:29 AM

First bug already fixed. Second one looks like the file didn't open for some reason. You should always check it opened before writing.

#16 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 04 May 2013 - 03:36 AM

View PostCloudy, on 04 May 2013 - 03:29 AM, said:

First bug already fixed. Second one looks like the file didn't open for some reason. You should always check it opened before writing.
Why wouldn't it open?

#17 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 04 May 2013 - 04:11 AM

View Postsuperaxander, on 04 May 2013 - 03:36 AM, said:

View PostCloudy, on 04 May 2013 - 03:29 AM, said:

First bug already fixed. Second one looks like the file didn't open for some reason. You should always check it opened before writing.
Why wouldn't it open?

Do I look like I know reasons why another persons file isn't opening?

#18 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 04 May 2013 - 09:23 AM

View PostCloudy, on 04 May 2013 - 04:11 AM, said:

View Postsuperaxander, on 04 May 2013 - 03:36 AM, said:

View PostCloudy, on 04 May 2013 - 03:29 AM, said:

First bug already fixed. Second one looks like the file didn't open for some reason. You should always check it opened before writing.
Why wouldn't it open?

Do I look like I know reasons why another persons file isn't opening?

To be fair, you are the developer.

#19 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 04 May 2013 - 09:43 AM

View PostDlcruz129, on 04 May 2013 - 09:23 AM, said:

View PostCloudy, on 04 May 2013 - 04:11 AM, said:

View Postsuperaxander, on 04 May 2013 - 03:36 AM, said:

View PostCloudy, on 04 May 2013 - 03:29 AM, said:

First bug already fixed. Second one looks like the file didn't open for some reason. You should always check it opened before writing.
Why wouldn't it open?

Do I look like I know reasons why another persons file isn't opening?

To be fair, you are the developer.

Yep, and being a developer means I can have access to his filesystem?

#20 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 04 May 2013 - 02:40 PM

View PostCloudy, on 04 May 2013 - 09:43 AM, said:

View PostDlcruz129, on 04 May 2013 - 09:23 AM, said:

View PostCloudy, on 04 May 2013 - 04:11 AM, said:

View Postsuperaxander, on 04 May 2013 - 03:36 AM, said:

View PostCloudy, on 04 May 2013 - 03:29 AM, said:

First bug already fixed. Second one looks like the file didn't open for some reason. You should always check it opened before writing.
Why wouldn't it open?

Do I look like I know reasons why another persons file isn't opening?

To be fair, you are the developer.

Yep, and being a developer means I can have access to his filesystem?

No, I'm just saying that if file handles don't open all the time, shouldn't you look into it?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users