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

Help plz

Started by mjhasdied1, 07 April 2014 - 03:03 PM
mjhasdied1 #1
Posted 07 April 2014 - 05:03 PM
I spent all morning trying to make a program to place and break gravel to make flint, when i was finally done fixing all the errors the program does nothing….. what am i doing wrong?

http://pastebin.com/ws3Kbbv6
Agoldfish #2
Posted 07 April 2014 - 05:07 PM
It may help to know the error… We can better help you that way.
mjhasdied1 #3
Posted 07 April 2014 - 05:08 PM
It may help to know the error… We can better help you that way.

there is none… it just does nothing… like when i enter the code no error message pops up but the turtle just does nothing
CometWolf #4
Posted 07 April 2014 - 05:09 PM
You defined 3 functions but you never call them, ofcourse it won't do anything :P/>
mjhasdied1 #5
Posted 07 April 2014 - 05:20 PM
You defined 3 functions but you never call them, ofcourse it won't do anything :P/>

right, now how do i call them? lol sorry im extremely new to lua, like its the first language that i learned other than html/css…
CometWolf #6
Posted 07 April 2014 - 05:30 PM
Im guessing the actual program is the flint function, personally i would just remove the function definition of that altogether. Anyways, you're already calling functions in your function definitions, like turtle.dig or turtle.place. Your own functions are no different.

flint() --calls the function flint
mjhasdied1 #7
Posted 07 April 2014 - 05:38 PM
Im guessing the actual program is the flint function, personally i would just remove the function definition of that altogether. Anyways, you're already calling functions in your function definitions, like turtle.dig or turtle.place. Your own functions are no different.

flint() --calls the function flint

so do i just say in the program after all the code "flint() end"?
CometWolf #8
Posted 07 April 2014 - 06:05 PM
No end, like i said this isn't any different from calling turtle.place or turtle.dig.
blipman17 #9
Posted 07 April 2014 - 08:09 PM
function my_function_name()
"do a lot of complicated stuff"
end

Functions make a somwhat shortcut to generalise something. However, it DOES NOT execute it. this can be usefull if you want to do something a lot in your code, and don't want to have to write it all down again.

to use your beautiful function you would just write it down, like:

my_function_name()

do you see the simularity's with:

turtle.dig()

which you probably know? I hope this helped.