Jump to content




Spiral Staircase

turtle lua

7 replies to this topic

#1 stubob

  • Members
  • 10 posts

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 by stubob, 22 February 2016 - 02:58 AM.


#2 jerimo

  • Members
  • 74 posts

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.

#3 stubob

  • Members
  • 10 posts

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.

#4 jerimo

  • Members
  • 74 posts

Posted 15 March 2015 - 02:25 AM

View Poststubob, on 14 March 2015 - 06:40 PM, said:

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

#5 Botas22

  • New Members
  • 1 posts

Posted 03 April 2015 - 02:09 PM

cool

cool

#6 Kayda

  • New Members
  • 1 posts

Posted 24 April 2015 - 09: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?

#7 stubob

  • Members
  • 10 posts

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

#8 stubob

  • Members
  • 10 posts

Posted 22 February 2016 - 02:58 AM

@Kayda, I just fixed it.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users