Hey guys, i just started writing code for LUA, and i code a little bit, but could someone either explain the best way to loop a program, or how?
And is there a way to test if it will work too?
Heres what i have
Hey guys, i just started writing code for LUA, and i code a little bit, but could someone either explain the best way to loop a program, or how?
And is there a way to test if it will work too?
Heres what i have
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
Haven't used LUA in a bit, but I'll give it a shot...
while i == 15 do turtle.up() turtle.placeDown() if turtle.detect() then turtle.forward() turtle.placeDown() end end
-ZL123
Hope I helped!
YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234
Im going to try that, now.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
sorry, i need it to detect if there is a block ahead, and if there is, mine it, if not, go forward sooo how might one do that? this?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
while i == 15 do turtle.up() turtle.placeDown() if turtle.detect() then turtle.dig() else turtle.forward() end turtle.placeDown() end
-ZL123
Hope I helped!
YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234
HA! else statements, duh. i use those with javascript. lmme try.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
Well, that didnt work. It just doesnt do anything, i type new hit enter and it doesnt do anything at all, its fueled up and everything. Do i need to tell it to select a stack of items? or..
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
You need to set i's variable before that...
Like you did originally.
-ZL123
Hope I helped!
YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234
for i=1,15 do turtle.up() turtle.placeDown() if turtle.detect() then turtle.dig() else turtle.forward() end turtle.placeDown() end
im trying to take the fuss out of creating these
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
so much slower lol
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Did i help? If so, click that like button! (And then, click Here! This is a feedback poll! Help me Help you and others!) (Stalk me here on the forums!)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bored? Watch these!(-IN THE FACE-...-DADADAOOMSDAY-...-Krieg-...-NFLBLR-...-NFLBLR2-...-Fosko-)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Speak softly and carry a diamond sword"-Me
Punching trees, falling off cliffs, punching grass... Now that i think of it, Minecraft sounds painful.
The Word of the Week is: Indefatigable!
Signature now with 89.6% more COLOR!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-DiamondDoctor
-For anyone interested, please, please, please check out my mod, AnyUtil, and post suggestions!
What are you trying to use i for anyway? If you want to execute everything 15 times, you probably want a for loop, like this:
for i=1,15 do turtle.up() turtle.placeDown() if turtle.detect() then turtle.dig() else turtle.forward() end turtle.placeDown() end
As degelessus did a great job with the syntax, thats probably not the behaviour you want. In a 1x1 shaft this code will build a vertical pillar of size 15, while clearing the neighbouring pillar. And in the open it will build a staircase. ^^
If you just want code to let the turtle move/mine through blocks, it's as easy as:
while true do turtle.dig() turtle.forward() end
0 members, 1 guests, 0 anonymous users