Jump to content




xdig - 3x3, 2x2, and 1x2 "tunnel" program

turtle lua utility

6 replies to this topic

#1 Sir.Mongoose

  • Members
  • 26 posts

Posted 05 January 2014 - 10:45 PM

"xdig" is a simple and my first REAL program for CC. It has three modes to "tunnel" in 1x2, 2x2, and 3x3. The program lets you pick a mode and tell it how far to tunnel. Along the way it resists to get stuck on things like sand or gravel. It can also place torches every 10 or so blocks, auto refuel itself, an optional automated chest system, and place blocks under it where there is none. I'm not the best at making my code look very clean but it works. I hope you can give it a try and tell me how it can be improved and if you like it! Thanks!

v1.0 (old)
Pastebin
pastebin get BfQ0BBje xdig

v1.1 (old)
Pastebin
pastebin get v681DfPe xdig

Changes:
*Added an optional system to return to chest when inventory has at least 1 block in every slot.

v1.2 New!
Pastebin
pastebin get r73hYcFk xdig

Changes:
*Added a 4x4 vertical mode (y4x4) that has the same functions as the other modes except for placing blocks down. Also It requires a stack of ladders in the fourth slot and will place them on every layer when using y4x4.

Edited by Sir.Mongoose, 13 January 2014 - 09:16 PM.


#2 gollark8

  • Members
  • 207 posts

Posted 06 January 2014 - 03:00 AM

I just checked your code,you need to put the function mode() bit BEFORE the area where it's used.

#3 Sir.Mongoose

  • Members
  • 26 posts

Posted 07 January 2014 - 09:31 AM

Programed a new chest system. And gollark8 I may make time to fix that and also make my code shorter than 10 kbs.

Edited by Sir.Mongoose, 07 January 2014 - 09:58 AM.


#4 Jim

  • Members
  • 33 posts
  • Locationtekkit.craftersland.net:25567

Posted 10 January 2014 - 07:46 AM

Advice for you!

I see you got all these turtle.select(1) then turtle.drop(64) then all these again selecting one slot per line of code. You can do it much easier.

for i = 3, 16 do
  turtle.select(i)
  turtle.drop()
end

Other than that, really nice work :)

Edited by Jim, 10 January 2014 - 08:47 AM.


#5 Sir.Mongoose

  • Members
  • 26 posts

Posted 10 January 2014 - 05:30 PM

Thanks, Jim. That will definitely save me some time coding! :)

I would also love some suggestions on what to add to this program to make it better. Because I can't come up with any new ideas so far...

Edited by Sir.Mongoose, 10 January 2014 - 05:53 PM.


#6 Jim

  • Members
  • 33 posts
  • Locationtekkit.craftersland.net:25567

Posted 11 January 2014 - 04:10 AM

A little off topic.

Could you go to pastebin and edit then put code highlighting/syntax on 'Lua' ? That would help a bit. Plus the code looks nicer and easier to read.

Edited by Jim, 11 January 2014 - 04:11 AM.


#7 Sir.Mongoose

  • Members
  • 26 posts

Posted 13 January 2014 - 09:17 PM

"xdig" has been updated to v1.2. Just a little forum bump.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users