This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AquatikJustice's profile picture

Yet Another Beginner's Lumberjack Program

Started by AquatikJustice, 04 December 2014 - 04:41 AM
AquatikJustice #1
Posted 04 December 2014 - 05:41 AM
First, here's the pastebin: http://pastebin.com/jjHTa85Z

The pertinent details:
Fairly straightforward program. Turtle checks to see if a log is in front of him. If so, he starts chopping, comes back down and tries to replant a sapling from his inventory. However, when he cycles through his inventory slots in the replantSapling function, he breaks once he hits an empty slot. If I have anything in slot 1, everything runs smoothly, but once I get to an empty slot I get an error saying it's trying to index ? (a nil value). I have a feeling that I am missing something fairly basic but I can't seem to nail it down. Any ideas team?
jaredallard #2
Posted 04 December 2014 - 05:45 AM
Check if item is a nil value or not before checking if it has a name.
AquatikJustice #3
Posted 04 December 2014 - 05:51 AM
I knew it was something simple. Thanks Rainbow!
jaredallard #4
Posted 04 December 2014 - 06:54 PM
I knew it was something simple. Thanks Rainbow!

No problem! It happens too me alot! xD
SpencerBeige #5
Posted 04 December 2014 - 09:46 PM
first off, ur using too much indent xD, sry, my ocd ;p
AquatikJustice #6
Posted 04 December 2014 - 10:06 PM
first off, ur using too much indent xD, sry, my ocd ;p

It set off mine too, but apparently that's how Notepad++ and Pastebin ended up deciding it should be formatted between the two of them. I thought about changing it, but it was late and I was lazy.
Edited on 04 December 2014 - 09:06 PM