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

Spiral Staircase

Started by stubob, 13 March 2015 - 07:24 PM
stubob #1
Posted 13 March 2015 - 08:24 PM
Hello!
I am new to the whole computercraft mod. I an learning LUA; and I have made my first computercraft program:

It makes a spiral staircase.

That's pretty much it.
Load it, tell it a number of iterations and it will make a staircase for you.
it will place selected blocks underneath if there is a hole.

Give me any feedback / ideas for improvement.

Thanks!

Link:
http://pastebin.com/M0Umz2KH

Cmd:
pastebin get M0Umz2KH spiral_staircase

EDIT fixed it.
Edited on 22 February 2016 - 01:58 AM
jerimo #2
Posted 14 March 2015 - 03:34 PM
Hey pretty nice for a first program, and clean too!

Just a tad of feedback, your check and place function is pretty useless right now since turtle.place will already only place if there is nothing already there.
Also, just personal taste but your step functiin could be broken up right after your place, and run twice with a turnLeft after the second run.
stubob #3
Posted 14 March 2015 - 06:40 PM
jerimo;

I did not know that about turtle.place. Thanks! Yeah, I think that the step function probably should be broken up. Thanks for checking it out and giving feedback.
jerimo #4
Posted 15 March 2015 - 02:25 AM
jerimo;

I did not know that about turtle.place. Thanks! Yeah, I think that the step function probably should be broken up. Thanks for checking it out and giving feedback.
My pleasure! Also, welcome to the great world of programming
Botas22 #5
Posted 03 April 2015 - 03:09 PM
cool

cool
Kayda #6
Posted 24 April 2015 - 10:19 PM
I've just tried this but am getting the following error: bios:367: [string "stairs"]:28: 'end' expected (to close 'function' at line 20)

Looking at the code the end is there but I'm not sure how to go forward?
stubob #7
Posted 22 February 2016 - 02:46 AM
Hrmmm not sure what is going on with that. It was working on an older version
getting back into computer craft, Ill look at the script
stubob #8
Posted 22 February 2016 - 02:58 AM
@Kayda, I just fixed it.