ComputerCraft Forums

ComputerCraft => Programs => Topic started by: iJinxIt on Apr 23, 2021, 09:12 PM

Title: Mining Programm [1.16.5]
Post by: iJinxIt on Apr 23, 2021, 09:12 PM
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 :)
Title: Mining Programm [1.16.5]
Post by: Kaikaku on Apr 24, 2021, 09:38 PM
Looks pretty nice and I like the use of % :)

Here're a few suggestions:

Fun fact: In my first programs (not CC) I mixed also German function names with English commands. It got confusing fairly quickly.
Title: Mining Programm [1.16.5]
Post by: iJinxIt on Apr 25, 2021, 11:20 AM
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)
Title: Mining Programm [1.16.5]
Post by: QuickMuffin8782 on Jun 10, 2021, 07:27 AM
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!