2 posts
Posted 27 June 2012 - 10:30 AM
Ok am done lol i have been working on this all day.To me i thought this would be really easy but anyway.
I can use the in game lua to make a mining thing.But when i try to do api and i have watched a million videos and i put the file in
C:\Users\user\AppData\Roaming\.techniclauncher\tekkit\mods\ComputerCraft\lua\rom\apis
and here is my code
function Mine ()
while turtle.detect do
turtle.dig()
turtle.digUp()
turtle.forward()
end
end
1548 posts
Location
That dark shadow under your bed...
Posted 27 June 2012 - 11:13 AM
what is the filename of the api and how do you call it in the turtle interface?
1548 posts
Location
That dark shadow under your bed...
Posted 27 June 2012 - 11:15 AM
you see if you put a file called const into the api directory and put in it:
local function me()
print("yup, it's working")
end
in order to call it you must open your turtle, type in 'lua', this will open the lua console. then type in const.me() and it will work but you must call it from the lua interface and prefix it with the api fileame
1548 posts
Location
That dark shadow under your bed...
Posted 27 June 2012 - 11:17 AM
I think a program would be better for what you want. just save the file as /name/ and put your code in it (don't put the code in a function) so:
/name/:
while turtle.detect do
turtle.dig()
turtle.digUp()
turtle.forward()
end
then you don't even open lua, you just type into the turtle: '/name/' and it will run
2 posts
Posted 27 June 2012 - 11:27 AM
wow works great thanks so much
1548 posts
Location
That dark shadow under your bed...
Posted 27 June 2012 - 01:28 PM
no problem. if you need help feel free to ask me, I'm a n00b so far but I'd love to try help, I learn too
1604 posts
Posted 27 June 2012 - 02:41 PM
Make sure to add brackets to the function call in the loop:
while turtle.detect do
It should look like this:
function Mine ()
while turtle.detect() do -- added brackets
turtle.dig()
turtle.digUp()
turtle.forward()
end
end
1548 posts
Location
That dark shadow under your bed...
Posted 27 June 2012 - 03:05 PM
yes you are right, my apologies. as I said. n00b :P/>/>