x = 0 function noTree turtle.dig() turtle.forward() turtle.dig() turtle.forward() end function harvest turtle.dig() turtle.forward() repeat turtle.digUp() turtle.up() x = x + 1 until turtle.compareUp() == false repeat turtle.down() x = x - 1 until x == 0 turtle.digDown() turtle.forward() end function harvestStone turtle.select(13) if turtle.compare() then harvest else noTree end end function harvestDirt turtle.select(14) if turtle.compare() then harvest else noTree end end function harvestCobble turtle.select(15) if turtle.compare() then harvest else noTree end end function harvestWood turtle.select(16) if turtle.compare() then harvest else noTree end end harvestStone harvestDirt harvestCobble harvestWood
Error: bios:338: [string "Harvest"]:4: '(' expected
Started by GareBear, Dec 06 2012 04:16 PM
2 replies to this topic
#1
Posted 06 December 2012 - 04:16 PM
This is my first time using functions and, for the life of me, I can not figure out what is wrong with my code. Unless I'm going crazy, the 4 means the 4th line of code, and I most certainly have a ( there.
#2
Posted 06 December 2012 - 04:20 PM
When writing a function, the function name (after "function") needs to have a list of parameters in () like when your calling a function. If the function doesn't use any arguments, just use () like when you're calling a function without arguments (such as "turtle.forward()").
For example:
For example:
function example() -- Do stuff end
#3
Posted 06 December 2012 - 04:23 PM
Wow. Well, I'm not too bright then. It works now. Thank you very much, faubiguy.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











