ComputerCraft Forums

ComputerCraft => Programs => Turtle Programs => Topic started by: Inksaver on Dec 17, 2020, 11:18 AM

Title: Survival Toolkit
Post by: Inksaver on Dec 17, 2020, 11:18 AM
I have written a toolkit for use in survival mode, once you have your first Crafty Mining Turtle. The code began in 2014 when I solved the self-replicating challenge on the old forums, and has now been adapted to run on ccTweaked with MC 1.16.3, but this time with player supervision

(https://camo.tmpim.com/5580599f19f0025660cfa540fffda8610a3f03ab/68747470733a2f2f692e696d6775722e636f6d2f62444d6f6566762e706e67)

It is designed to allow you to use just one program to farm crops and trees, mine diamonds and ancient debris, create dungeon mob spawner farms, build canals across land and water. (Canal on water? - parallel lines of cobble 2 blocks apart over the ocean), bridges and pathways in overworld and End, land shaping, ocean monument draining and much more.

I have uploaded 10 videos to youtube so far, with more to follow: Playlist for Toolkit (https://www.youtube.com/playlist?list=PLE8GQEkUWuwFNLS9cdTCr_1qalC4eGBOr)


The toolkit consists of a main file and 2 library files:
main file: https://pastebin.com/UFvjc1bw which will automatically download the library files into a folder called 'lib'

You can get this and a bunch of other utilities by using the command: pastebin run 8qbeZevX

This is still in active development, and I am happy to answer any questions and deal with bugs and improvements
Title: Survival Toolkit
Post by: QuickMuffin8782 on Dec 24, 2020, 04:32 AM
One question, does the turtle itself use the direct pathfinding?
Title: Survival Toolkit
Post by: Inksaver on Jan 04, 2021, 06:57 PM
Not sure what direct pathfinding is...
There is nothing that uses any coordinates, with the exception of asking the player for the current Y value on a couple of the utilities.
Title: Survival Toolkit
Post by: QuickMuffin8782 on Jan 05, 2021, 11:04 AM
Well direct pathfinding is actually finding a path with any ability to tackle any obstacles that may be in the way.
Title: Survival Toolkit
Post by: Earther on Jan 13, 2021, 11:56 PM
(https://camo.tmpim.com/03e61eb2f18e698a824e5d86011181b745956cfa/68747470733a2f2f692e696d6775722e636f6d2f77744d78566f692e706e67)

I just get this error when trying to use pastebin run on it, I'm using 1.16.4(/1.95), but I would think that this would be the same?
Title: Survival Toolkit
Post by: Inksaver on Jan 15, 2021, 10:16 AM
@QuickMuffin8782
As this toolkit is designed to be under direct player control, there is no need for direct pathfinding.
The self-replicating scripts had this ability, as they were designed to be started and left to their own devices:
2014 original https://pastebin.com/JVD1RPfg
2018 update using .inspect() and .getItemDetail() https://pastebin.com/2Zf5an8H


@Earther
I uploaded a script after debugging and missed the ]] used to end a multi-line comment. There is a new version added just now with this corrected, or you can delete the ]] on line 2018 and save. The current version is 20210107.1047.

The getTools.lua script has been modified so it will check versions of all the files and update as required. pastebin run 8qbeZevX or view at https://pastebin.com/8qbeZevX
Title: Survival Toolkit
Post by: hdbuon on Dec 15, 2021, 01:40 AM
does it work in 1.12.2?
since i prefer to play in that version
Title: Survival Toolkit
Post by: Inksaver on Dec 15, 2021, 06:16 AM
It works in all versions from 1.7.2 onwards. I am currently using it in 1.16.5

There is a youtube series on this utility at: https://www.youtube.com/playlist?list=PLE8GQEkUWuwFNLS9cdTCr_1qalC4eGBOr
Title: Survival Toolkit
Post by: QuickMuffin8782 on Dec 26, 2021, 10:09 PM
Quote from: Inksaver on Jan 15, 2021, 10:16 AM-snip-

That explains everything on the toolkit.
Suggestion: So users can navigate better, have a menu that they can interact in. https://devbin.dev/mxRBjyCT
Title: Survival Toolkit
Post by: Shadow3641 on May 19, 2023, 04:33 PM
Hey Inksaver Love your program I use it all the time just wondering if you're still actively working on it.
Title: Survival Toolkit
Post by: Inksaver on May 19, 2023, 05:06 PM
Yes

The files on pastebin have a version embedded in them: eg version = 20230515.1500 which gives the YYYY/MM/DD:HHMM date.

I am making major updates at the moment, and that is introducing errors, so keep updating your copy with
"pastebin run 8qbeZevX". Report any errors with the version no and the error message.

Will be updated again later today.
Title: Survival Toolkit
Post by: Shadow3641 on May 19, 2023, 05:56 PM
version = 20230515.1500
if you run tk.lua and try hit q on the second option you get this error

/tk.lua:9381: attempt to compare number with nill

you just need to flip the if statements and it seems to work just fine

if modifier == "q" then
 R.choice = 0
 return R -- quit task system so it re-starts first menu
 elseif modifier == "h" then -- get help on main menu items
 R = lib.getHelp(R, itemsRequired) -- if R.choice reset to 0 then will continue
 end
 if subChoice > 9 then -- need more than 9 sub-options
 R.choice = subChoice + (mainChoice * 100) -- 10 = 10 + 1000 = 1100
 else -- eg main option 1 (mining), sub-option 1 (create mine) = 1 + 10 = 11
 R.choice = subChoice + (mainChoice * 10) -- 9 = 9 + 9 * 10 = 99, 1 + 10*10 = 101
 end
Title: Survival Toolkit
Post by: Inksaver on May 20, 2023, 07:09 AM
Thanks for pointing this out.

The menu system returns 2 values, where the first is nil if the user chooses "q" or 'h'
There are a number of ways to fix it, but all I did was to check for nil first.

I wanted 'q' on the second menu to return to the root menu, rather than quit entirely, so R.choice is set to 0. Change this to -1 for total exit.
if subChoice ~= nil then
if subChoice > 9 then -- need more than 9 sub-options
R.choice = subChoice + (mainChoice * 100) -- 10 = 10 + 1000 = 1100
else -- eg main option 1 (mining), sub-option 1 (create mine) = 1 + 10 = 11
R.choice = subChoice + (mainChoice * 10) -- 9 = 9 + 9 * 10 = 99, 1 + 10*10 = 101
end
end
-- eg chosen option 1 mining or option 10 measuring
if modifier == "q" then
R.choice = 0 -- return to root menu. change this to -1 if quit application preferred
return R -- quit task system so it re-starts first menu
elseif modifier == "h" then -- get help on main menu items
R = lib.getHelp(R, itemsRequired) -- if R.choice reset to 0 then will continue
end


Version 20230520.0700 now live.
Title: Survival Toolkit
Post by: Shadow3641 on May 20, 2023, 02:04 PM
Awesome I will go check it out!
Title: Survival Toolkit
Post by: Maestro on Nov 14, 2023, 04:16 PM
Hey Inksaver, apologies if the necro comes unappreciated, but is this still in active development?