[ComputerCraft] [1.12.2] Want to load a custom API at startup.

  • 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

Monarch_of_Gold

Well-Known Member
Jul 1, 2015
291
164
69
He Guys!

Making this post to ask if there's a way to make the lua prompt load a custom API on startup. Ive found that while a labeled turtle remembers programs saved, it does not remember loaded API. I can't find any folder in my Minecraft folder to put it in to make it global, so I'm having to manually reload this API every time I move the turtle as well as every time I change something. Being able to simply reboot the turtle to apply changes would be a lifesaver!

Is this possible? How?

Thank you for your help and advice!

Sent from my LML413DL using Tapatalk
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
What exactly do you mean with "loading a custom API on startup"? If you want your turtle/computer to start in a certain program you need to name the file startup and it should NOT be in any sub folders but instead in the main directory.

Just some things: Once a computer has been shutdown it will not remember where it was in a script. So, even having a startup script won't allow it to continue where it left off. It is also so that a player who has access to a computer/turtle (that is, able to open its gui) is able to stop a script from running. As such, if you want to use the computer to function as a password lock there are more measures you will need to actually secure it.
 

Monarch_of_Gold

Well-Known Member
Jul 1, 2015
291
164
69
That's not entirely what I mean. I'm writing an api to let me quickly tell the turtle if I want something quarried or built and how. It makes it a lot easier. I want this API loaded into the os on startup so the programs can run.

Sent from my LML413DL using Tapatalk
 

Monarch_of_Gold

Well-Known Member
Jul 1, 2015
291
164
69
From my read of that, community consensus at the time seemed to be to make a program that grabs from pastebin and installs from there. And you can install that program into the rom using resource packs.

Huh. Okay.

Thank you for your help!

(some of the consensus. though, was that it was annoying and that they'd rather stick to editing the base mod file, but this was all 5 years ago now, so it may not be relevant)
 

adamich

New Member
Jul 29, 2019
697
0
0
Or U can write files to floppy and place computer/turtle on floppy driver and copy from floppy.
If U add startup file to floppy, U can automate process.
 

Monarch_of_Gold

Well-Known Member
Jul 1, 2015
291
164
69
Yeah. Im having good luck just running os.loadAPI at the start of my programs right now.

Sent from my LML413DL using Tapatalk
 

rhn

Too Much Free Time
Nov 11, 2013
5,706
4,420
333
I am not a particularly good coder, but feel free to check out this script I wrote for Railcraft ticket machines: https://pastebin.com/cR2G1Fuu
It downloads an API(list of stations) from Pastebin and loads it. It also has an example of simply creating, writing to and reading from a simple file(saving which station it is).
 
Last edited:

Monarch_of_Gold

Well-Known Member
Jul 1, 2015
291
164
69
Ah. Nice. As I've said I'm doing well loading the API for each program. Once I get it ironed out I may make a script and install it in rom that copies my API to each computer's root so my programs can run.

Sent from my LML413DL using Tapatalk