Main Menu

Mining Programm [1.16.5]

Started by iJinxIt, Apr 23, 2021, 09:12 PM

Previous topic - Next topic

iJinxIt

Heres a program that excavates a 64 by 32 area, returns the loot except for soapstone cobblestone etc. to a chest and places torches that light up most of the area.
You have to fill the first slot with a stack of coal and the second with a stack of torches.

Heres the program:
https://pastebin.com/CDCpDiS1

Keep in mind that you have to place the turtle on top of a chest and on hight level 11 or above (idk if it is lava proof yet)

PS: I learned LUA in like 20 min so if my code could be improved pls tell me.
PPS: Also tell me about more features I could implement and bugs that occur if you do use it :)

Kaikaku

Looks pretty nice and I like the use of % :)

Here're a few suggestions:
  • Readability: You could add comments after '--' e.g., -- put coal in slot 1 and torches in slot 2
  • Order of functions: You're using in minenGehen() the function zweige(), which is declared after minenGehen(). This could through an error, as at the beginning lua is not aware of which functions come later in the code.
  • Table: I'd probably put the long if-statement in dropWaste() in a table/array. This way you could loop through all items. Cleaner and easier to maintain.

Fun fact: In my first programs (not CC) I mixed also German function names with English commands. It got confusing fairly quickly.
Hi there!
I make YouTube videos about my turtle programs (incl. pastebin). Visit me if you like :)

iJinxIt

Quote from: Kaikaku on Apr 24, 2021, 09:38 PMLooks pretty nice and I like the use of % :)

Here're a few suggestions:
  • Readability: You could add comments after '--' e.g., -- put coal in slot 1 and torches in slot 2
  • Order of functions: You're using in minenGehen() the function zweige(), which is declared after minenGehen(). This could through an error, as at the beginning lua is not aware of which functions come later in the code.
  • Table: I'd probably put the long if-statement in dropWaste() in a table/array. This way you could loop through all items. Cleaner and easier to maintain.

Fun fact: In my first programs (not CC) I mixed also German function names with English commands. It got confusing fairly quickly.

Thanks, will work on that asap (after I've done my school stuff xd)

QuickMuffin8782

Quote from: Kaikaku on Apr 24, 2021, 09:38 PMLooks pretty nice and I like the use of % :)

Here're a few suggestions:
  • Readability: You could add comments after '--' e.g., -- put coal in slot 1 and torches in slot 2
  • Order of functions: You're using in minenGehen() the function zweige(), which is declared after minenGehen(). This could through an error, as at the beginning lua is not aware of which functions come later in the code.
  • Table: I'd probably put the long if-statement in dropWaste() in a table/array. This way you could loop through all items. Cleaner and easier to maintain.

Fun fact: In my first programs (not CC) I mixed also German function names with English commands. It got confusing fairly quickly.

Good advice for the programmer yourself! I've seen your YT videos and they are fantastic. If I need help, it's that channel. XD!
GOTTA GO FAST!!!! - Sunrise Studios now calling testers! Check the post!
Gitlab - Join my official discord! - SS Discord