This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Exerro's profile picture

Advanced file executor, run files with background processes and auto load API's and more

Started by Exerro, 31 May 2013 - 03:59 PM
Exerro #1
Posted 31 May 2013 - 05:59 PM
Hi, everyone!

The name is a bit of a lie…this program doesn't run files, it runs folders. First of all, this doesn't change anything you would normally use, so you don't have to worry about changing too much of the internals of your program. What is does is organise and deal with all the files in the folder, by using their extensions.
The extensions:
.lua : This will load a function into the environment that you can call like [programname]( )
.prc : This returns a function that resumes the coroutine of the file with the args input i.e [programname]( event, p1, p2, p3…. )
.bgp : This adds a process that will constantly run in the background, you can disable it from drawing to the screen, and stop it and of course vice versa
.txt : This will give a table called [filename] containing all the lines inside of the file
.img : This returns a function that will draw the image at the coords given i.e [programname]( 1, 1 ) would draw [programname] at 1, 1
.api : This loads the API like os.loadAPI( ) but only into the programs environment
.info : This will make a screen that draws the author name, program name, and program description ( not added yet )
.dwl : This will auto download from pastebin, and delete itself
.tmp : This will load like a lua file but delete itself, for example a firstrun program for a login system
.odr : This will change the order files are loaded in of a certain extension, for example you have 3 .api files, you would edit api.odr to rearange the order the API's are loaded in

The main code is in the file "code" and the program that runs it all can be called anything, although giving it an extension might mess some things up
Just call [foldername]/start if you download it as [foldername]/start and it will run "code" with all the things above done too.

This is useful because it means you don't have to clog up the start of your code with loading variables, because this does it for you, and more. I have made some more programs to go with this as well, one being a self extracting package maker and the other, a simple GUI for this that may help you create your programs.
It definitely helps organising your code and splitting it into multiple files

Screenshots will come if anyone makes a program with this, it isn't anything graphical apart from the GUI which is below:



The folder runner: http://pastebin.com/9r6gugyA
The package maker: http://pastebin.com/VDbNNz8V
The GUI: http://pastebin.com/BYxynS16
If you need any help with this, just ask, and I will make some sort of tutorial
ElvishJerricco #2
Posted 31 May 2013 - 09:18 PM
This is actually pretty cool. The specialized file types is a good idea.
Exerro #3
Posted 01 June 2013 - 08:11 AM
Thanks! I plan to add more in the future, and the ability to create your own extensions. Apart from that I will probably improve the process extension with more uses and include a redirect buffer and it's own environment, which will hopefully make it easy to make OS's.
ElvishJerricco #4
Posted 01 June 2013 - 03:48 PM
Thanks! I plan to add more in the future, and the ability to create your own extensions. Apart from that I will probably improve the process extension with more uses and include a redirect buffer and it's own environment, which will hopefully make it easy to make OS's.

Edit: sorry nevermind…
jesusthekiller #5
Posted 01 June 2013 - 05:27 PM
Nice idea! Just make an installer for those 3 files


Elvish, please, it makes no one to click into your project… It only makes you look desperate.
Exerro #6
Posted 06 June 2013 - 02:23 PM
New update! You can now create your own extensions, change the extension order, and use .info files to display info about the program before you run it
Usage for extension maker:
SpoilerTo have access to the background process table, use BackgroundProcesses – Only use this if you know what you're doing
Use "local name, path = …" if you want info about the file ( name is just the name ( no extensions or folder paths ) and path is the whole name ( i.e for loadfile ) )
Usage for extension order:
It is just 1 line for each extension ( It will fill in inbuilt ones at the end automatically ) that will load top to bottom
Usage for .info extension
<program name>
<author name>
<program description>
<background colour>

Please remember this is in its early stages, it is likely to crash if you make a mistake, for example in an extension creator. Always keep a backup of programs incase the worst happens: even though I have coded it for this to be impossible, "better safe that sorry".
An installer will be coming soon, as well as a whole load of extensions including a programming language ( type thing ( like html but more basic ) ), be patient :P/>

Edit: forgot to say but the display program isn't updated, and may never be. I mainly made that so I could upload a photo of what it would look like but updating it would be tedious and a waste of time in my opinion. Of course if you disagree either pm me or comment so I know
The main program ( intended to be run from within the folder ) is updated on pastebin and the compressor never changed