8 posts
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
571 posts
Location
Some Fish Bowl in Ohio.
Posted 07 April 2014 - 05:07 PM
It may help to know the error… We can better help you that way.
8 posts
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
1281 posts
Posted 07 April 2014 - 05:09 PM
You defined 3 functions but you never call them, ofcourse it won't do anything :P/>
8 posts
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…
1281 posts
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
8 posts
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"?
1281 posts
Posted 07 April 2014 - 06:05 PM
No end, like i said this isn't any different from calling turtle.place or turtle.dig.
92 posts
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.