Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {...}
- local w, h = term.getSize()
- --Page Contents: title, text, images, links
- local Pages = {{"UI","The UI is made up of 3 sections; Desktop, Dropdown, and Application screen. Desktop allows you to open apps and has its background as the users selected desktop background, which can be changed in settings. Dropdown allows the user to see past notifications, and messages. Background of Dropdown can be changed in settings as well. Application screen is where the running application can display information to the user and receive inputs.",-1,-1},{"System_Organization","the folders for the system are organized based off use. \n APIs: 'os/System/Tools'\n UI assets: 'os/UI' \n Desktop Icon Images: 'os/UI/DesktopIcons' \n files that run on startup: 'startup' \n os files: 'os/Files' \n logs: 'os/Files/Logs' \n users: 'os/System/Users'",-1,-1},{"Application_API","Application Tools",-1,{{"text","AppApi_Text"},{"Buttons","AppApi_Button"},{"Images","AppApi_Image"},{"Input box","AppApi_Input"},{"other functions","AppApi_Misc"}}},{"AppApi_Text","used to display text on screen, color can be changed using App.setTextColor(color) \n format: \n App.newText(id,text,x,y)",-1,{{"For Text Color","AppApi_Misc"}}},{"AppApi_Button","used for creating new buttons \n format: \n App.newButton(id,text,action,x,y) \n Other Details \n Buttons can either call a app event when pressed or call a file event. these are as follows: \n tsk.(appEventName) AppEvent \n lnk.(path) file to be ran",-1,-1},{"AppApi_Image","Display Image \n App.newImage(id,path,x,y)",-1,-1},{"AppApi_Input","allows user input (wip)",-1,-1},{"AppApi_Misc","other functions \n change background color: \n App.setBackground(color) \n change text color: \n App.setTextColor(color) \n run Application: \n App.setApplication(path) \n toggle scrollability: \n App.setScroll(true/false) \n See Also",-1,{{"colors","Misc_colors"},{"Shortcuts","System_Shortcuts"}}},{"System_Shortcuts","the desktop shows programs based off if they have a shortcut, and if they have a image attached to that shortcut. shortcuts for desktop are stored at 'os/Desktop_Shortcuts' but its not recommended to directly add a file to that folder, instead i recommend using the shortcut function of the file system advance api. \n simply run 'fsAdv.CreateShortcut(path of program, name to display on desktop, image shortcut uses)'",-1,{{"file formats","System_FileFormats"}}},{"System_FileFormats","Supported Formats: \n text document: .txt \n video: .vid \n image: .nfp \n program: .lua \n shortcut/link: .lnk",-1,{{"Folders","System_Organization"}}},{"Misc_colors","this system uses the base craftos color system, so you just need to do color.(color) or the single character repersentation of the color"}}
- function Menu()
- App.Clear()
- App.newText("MenuText","==Help Menu==",w/2 - 6, 1)
- for i = 1, #Pages do
- App.newButton("button"..i,Pages[i][1],"tsk."..Pages[i][1],w/2 - string.len(Pages[i][1])/2,(i * 2))
- end
- end
- function Page(I)
- App.Clear()
- App.newText("title",Pages[I][1],w/2 - string.len(Pages[I][1])/2,1)
- App.newButton("return","return","tsk.Menu",1,1)
- local Y = 3
- local lines = require "cc.strings".wrap(Pages[I][2], w-2)
- for i = 1, #lines do
- App.newText("Disc"..i,lines[i],1,i + 2)
- Y = Y + 1
- end
- if Pages[I][3] ~= -1 then
- for i = 1, #Pages[I][3] do
- local file = fs.open(Pages[I][3][i],"r")
- local Height = 0
- local Content
- repeat
- Content = file.readLine()
- if Content ~= nil then Height = Height + 1 end
- until Content == nil
- file.close()
- App.newImage("Image"..i,Pages[I][3][i],1,Y)
- Y = Y + Height + 1
- end
- end
- if Pages[I][4] ~= -1 then
- for i = 1, #Pages[I][4] do
- App.newButton("link"..i,Pages[I][4][i][1],"tsk."..Pages[I][4][i][2],1,Y)
- Y = Y + 1
- end
- end
- end
- function FindPage(text)
- local I
- for i = 1, #Pages do
- if Pages[i][1] == text then I = i end
- end
- Page(I)
- end
- if tArg[1] == "start" then
- Menu()
- elseif tArg[1] == "Menu" then
- Menu()
- else
- FindPage(tArg[1])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement