SkyTurtle [ComputerCraft framework and scripts]

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

MrSwisstobi

New Member
Jul 29, 2019
46
0
0
i know its nearly nothing, but thats how the start of the room function could look like

btw, check if you're using "Quarry" or "Quary" .. its not always the same ;)

Code:
function room(quarryArgs, quaryX, quaryY, quaryZ, side, isUsingEnderchests)
    -- Digging the room with the advQuarry function
        advancedQuary(quarryArgs, quaryX, quaryY, quaryZ, side, isUsingEnderchests)
 
    -- once finished digging, check if there are holes in the walls, if yes fill em
     
      ...
 
end
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
Take your time, and don't hesitate if you have any questions on it.
I tried to make it easy to understand, but my bad habit of not putting comments when working for myself can make things a bit harder to understand.
 

MrSwisstobi

New Member
Jul 29, 2019
46
0
0
Take your time, and don't hesitate if you have any questions on it.
I tried to make it easy to understand, but my bad habit of not putting comments when working for myself can make things a bit harder to understand.

same here, i nearly never write comments, .. i've read trough it, doesnt look too bad :)

but one thing i was wondering, why do you have a height limit?
I mean a tree usually has an end, if you check if the block above is the same as the log-template in the inventory, it should auto. detect when it has to go down again, so it can variate how tall the tree can be.
I think that setting is pretty useless in my eyes, but it doesnt hurt if you have it built in :)
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
I had a problem early on with my turtle going to the top of the world, and I put the limit to be able to test solutions.

It was quite easy (forgot to put parenthesis on a function, so it was always considered as "true").
After that, I found out that having something like that permitted me to have a better calculation on fuel consumption, to refrain from having the turtle going if it doesn't have enough fuel.

The default is 10, so you would have to work with tall trees to go past the limit anyway, but as it is easy to edit, I lert it there.
 

MrSwisstobi

New Member
Jul 29, 2019
46
0
0
I had a problem early on with my turtle going to the top of the world, and I put the limit to be able to test solutions.

It was quite easy (forgot to put parenthesis on a function, so it was always considered as "true").
After that, I found out that having something like that permitted me to have a better calculation on fuel consumption, to refrain from having the turtle going if it doesn't have enough fuel.

The default is 10, so you would have to work with tall trees to go past the limit anyway, but as it is easy to edit, I lert it there.

ok :)
 

IBurn36360

Member
Jul 29, 2019
57
0
16
UPDATE: Code is now fully compartmentalized into modules. Main now loads all of these modules and starts the coroutines for start (calls the function). This, and the changelog, is the only piece of non-loading code that will exist in main from now on. The project is now being dubbed "SkyTurtle" after a joke one of my friends made about it taking over the Minecraft world as we know it. Hopefully this makes getting into the framework and working within it much easier and less intensive on the learning curve.

From now on, functions and methods for specific operations will be named as follows:

Code:
function foo()
 
end
 
function foo_inventory()
 
end

In short, functions will carry the prefix for all of its sub functions to allow for better compartmentalization and separation of non-globalized functions.

Now for the fun bit. The separate functions, such as the Advance Quarry script, are designed to be stand-alone and highly specialized. As such, we should be less concerned with writing functions to work with other specialized functions and more concerned with the most effective and efficient way of getting the functions and capabilities coded. Using the quarry script as a shortcut to making a room-builder is not what this framework is about. This framework is about providing some base scripts to show just how powerful this framework is, and how easily this framework can be added to for the future coders.

As always, make any suggestions that you don't see in the OP in the replies and I will try to get them coded as I have time. I have been working a lot lately on a way of converting a language system to a more familiar one, as well as my own personal website (Don't ask, I have absolutely no intention of letting that be on here out of respect for FTB, and for my own personal honor). Due to this, my work has lessened on this project, but it in no way out of the daily routine in terms of ideas or actual coding.

Have fun everyone

EDIT: Main updated to add modules batter and freeze if anything goes wrong. Sets up for startup to be able to recover if anything is missing or invalid.
 
  • Like
Reactions: un worry

MrSwisstobi

New Member
Jul 29, 2019
46
0
0
UPDATE: Code is now fully compartmentalized into modules. Main now loads all of these modules and starts the coroutines for start (calls the function). This, and the changelog, is the only piece of non-loading code that will exist in main from now on. The project is now being dubbed "SkyTurtle" after a joke one of my friends made about it taking over the Minecraft world as we know it. Hopefully this makes getting into the framework and working within it much easier and less intensive on the learning curve.

From now on, functions and methods for specific operations will be named as follows:

Code:
function foo()
 
end
 
function foo_inventory()
 
end

In short, functions will carry the prefix for all of its sub functions to allow for better compartmentalization and separation of non-globalized functions.

Now for the fun bit. The separate functions, such as the Advance Quarry script, are designed to be stand-alone and highly specialized. As such, we should be less concerned with writing functions to work with other specialized functions and more concerned with the most effective and efficient way of getting the functions and capabilities coded. Using the quarry script as a shortcut to making a room-builder is not what this framework is about. This framework is about providing some base scripts to show just how powerful this framework is, and how easily this framework can be added to for the future coders.

As always, make any suggestions that you don't see in the OP in the replies and I will try to get them coded as I have time. I have been working a lot lately on a way of converting a language system to a more familiar one, as well as my own personal website (Don't ask, I have absolutely no intention of letting that be on here out of respect for FTB, and for my own personal honor). Due to this, my work has lessened on this project, but it in no way out of the daily routine in terms of ideas or actual coding.

Have fun everyone

EDIT: Main updated to add modules batter and freeze if anything goes wrong. Sets up for startup to be able to recover if anything is missing or invalid.
ok
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
If you do not intend to use a function outside of the program (API), do note that putting "local" before every function and variable declarations is a great thing, as it will make slightly less lag.
 

IBurn36360

Member
Jul 29, 2019
57
0
16
If you do not intend to use a function outside of the program (API), do note that putting "local" before every function and variable declarations is a great thing, as it will make slightly less lag.

The problem with declaring a function local is that putting it local throws an "unexpected local at" error. In other words, you can not make a function local. As for variables, many of the variable names are specific to the function, or are variables that are reset for new specialized functions. I am not a newbie at this =P
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
I make all my functions local, so you might not place the keywords at the right place.
Code:
local function test(a, b)
  if (b ~= a) then
    print(a)
  end
end
 
test(1, 2)
It's the same for the variables, you only put the "local" before the variable name, and only the first time it appears in the program (usually at the top of the program or top of the function). Note that you don't need that for the variable created in for loops. (for i=0, 5 do ... end)
 

MrSwisstobi

New Member
Jul 29, 2019
46
0
0
I make all my functions local, so you might not place the keywords at the right place.
Code:
local function test(a, b)
  if (b ~= a) then
    print(a)
  end
end
 
test(1, 2)
It's the same for the variables, you only put the "local" before the variable name, and only the first time it appears in the program (usually at the top of the program or top of the function). Note that you don't need that for the variable created in for loops. (for i=0, 5 do ... end)

i know, but thanks.
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
Yeah, you do, but IBurn seemed to have troubles with it.

Which is strange, if he really is IBurn, because he should know quite a lot of Java, and "local" is exactlt the same as "private"...
 

IBurn36360

Member
Jul 29, 2019
57
0
16
UPDATE: Turtle net handling done, quarry functions renamed correctly, A backward function added to move. Rednet has a new command input.

Working on the quarry script now and will be finishing that. Once that is done, I will consider this ready for a beta release.

EDIT: thanks to some sleep and an idea, I have come up with a way of guaranteeing the contents of the files that make up the modules. Should take me only an hour or so to code and test, than I will push an update to the main and config to account for it. Quarry now has my full attention and will be the next ting done and tested.