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

Can anyone tell me what is wrong with this program?

Started by Sneaky4296, 22 March 2013 - 02:10 AM
Sneaky4296 #1
Posted 22 March 2013 - 03:10 AM
Topic: Can anyone tell me what is wrong with this program?
Body: I'm attempting to make a turtle program that digs out a 1 chunk plot, then placing blocks to make a path. That part worked, until I tried to make it so you could tell it how many chunks to mark out. If anyone could tell me what is wrong with the code, it would be much appreciated.
http://pastebin.com/FqhXRVha
ikke009 #2
Posted 22 March 2013 - 05:43 AM
As far as I can see the error lies in the fact that your plots variable is a string (read() returns as a string)
So make that plots = tonumber(read()) and it will probably work
Engineer #3
Posted 22 March 2013 - 09:14 AM
If you could tell us where it is giving unexpected behaviour, we can help alot more.
Or maybe I just dont quite understand your problem
Sneaky4296 #4
Posted 22 March 2013 - 01:47 PM
If you could tell us where it is giving unexpected behaviour, we can help alot more.
Or maybe I just dont quite understand your problem

What happens is that it digs out the block below it, then stops.

edit: It doesn't do anything after asking how many plots.
Engineer #5
Posted 22 March 2013 - 08:34 PM
You never end your first function, but at the bottom. Now you have on function wich you never call. Add an end between line 12 and 13 and you should be fine.