-
Notifications
You must be signed in to change notification settings - Fork 1
Program Development
First of all, you need to create executable file (program, regular program for CC:Tweaked). It would be better to put all program files in folder (especially if you have more files than one). Than create file install.lua
, here you need to write welcome message, terms of use, and installation process. This type of program is better to use, if it doesn’t touch any file in /os
folder.
The easiest type of installation. Here you need startup.lua
, to let system know that it should run program on disk. Also you should do same things that was written before.
If you found moment, when user may corrupt any file (connected to program or os), you may execute file in this path /os/.runFiles/BSOD
, this file will execute “Blue Screen Of Die”. So, user can understand that there is mistake, and will try to find problem. In execution, you should write error (example: shell.run(“/os/.runFiles/BSOD”, “\"[DO:00001] No or corrupted file\"”
, to let user know where exactly is a problem. REMEMBER: Message shouldn’t be long, because it may not fit on the screen.
- [DO:0000] Fatal error while running os (default)
- [DO:0001] No or corrupted file
- [DO:0002] Memory corrupted
- [DO:0003] Critical file corrupted
- [DO:0004] Executed non defined device (executed devise which is not connected to pc)
- [DO:0005] Unsupported device (execute if pc is not advanced one)
- [DO:0006] Unsupported version of OS (executed by developer, if program doesn’t support old OS)
Welcome to Program Development tutorial! Here is info for diamond OS 2, as old version based on text GUI, so it is very easy to write it.
To load APIs, you need to copy then in work directory. To get API use settings.get(“apiDir”)
and API name with .lua
.
Here is list with stored name, and directories.
- “apiDir” = “/diamondOS.beta/bin/.System/apis”
- "temp" = "diamondOS.beta/bin/.System/tmp"
- "sysDir" = "diamondOS.beta/bin/.System"
- "bootDir" = "diamondOS.beta/bin/.boot"
I made this system, to make your life easier. These directories are set up while installing.
To create an installer, you may use GUI through gui.lua
API, or text installer (trow shell). To init program in system, you should do few things.
First of all, you should preload diamondAPI (because next methods are using require()
). Then load API. Now, you can use
dAPI.appInit(appName, author, version, path, isPatebin)
Path here means full path to .lua
app. This method will register the app in the app folder. Version is used for updates. (thow pastebin or github. You may choose what to use by using True
or False