Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setBackgroundColor(colors.purple)
- term.clear()
- UsrPin = "1"
- if peripheral.isPresent("left","speaker") then
- SPEAKER = peripheral.wrap("left")
- elseif peripheral.isPresent("right","speaker") then
- SPEAKER = peripheral.wrap("right")
- elseif peripheral.isPresent("top","speaker") then
- SPEAKER = peripheral.wrap("top")
- elseif peripheral.isPresent("bottom","speaker") then
- SPEAKER = peripheral.wrap("bottom")
- end
- if SPEAKER == nil then
- print("No speaker found")
- SPEAKERPRESENT = false
- else
- print("Found speaker")
- SPEAKERPRESENT = true
- SPEAKER.playNote("bell",50,1)
- sleep(0.1)
- SPEAKER.playNote("bell",50,2)
- sleep(0.1)
- SPEAKER.playNote("bell",50,1)
- sleep(0.2)
- SPEAKER.playNote("bell",50,5)
- end
- shell.run("dj")
- print("WAIT")
- sleep(0)
- function ErrorLog(E)
- if SPEAKERPRESENT == true then
- SPEAKER.playNote("banjo",5,0)
- end
- if LOG == nil then
- LOG = {}
- end
- LOG[#LOG+1] = E
- end
- function PANIC(E)
- if SPEAKERPRESENT == true then
- SPEAKER.playNote("banjo",20,0)
- sleep(0.1)
- SPEAKER.playNote("banjo",20,0)
- end
- ErrorLog(E)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- print("A CRITICAL ERROR OCURRED")
- print("YOUR COMPUTER HAS BEEN PAUSED WITH THE ERROR:")
- print(E)
- print("THE COMPUTER WILL ATTEMPT TO CONTINUE SHORTLY")
- sleep(10)
- end
- function DrawIMG(File,X,Y)
- OX,OY = term.getCursorPos()
- if fs.exists(File) then
- local I = (paintutils.loadImage(File))
- paintutils.drawImage(I,X,Y)
- else
- ErrorLog("Cant draw file,"..File.." does not exist")
- end
- end
- function DrawBG()
- OX,OY = term.getCursorPos()
- term.setCursorPos(1,1)
- if fs.exists("AIOS/.EXPLORER/BG.nfp") then
- local I = paintutils.loadImage("AIOS/.EXPLORER/BG.nfp")
- paintutils.drawImage(I,1,1)
- else
- term.setBackgroundColor(colors.purple)
- term.clear()
- ErrorLog("BG.nfp not found")
- end
- end
- function MainMenu()
- if fs.exists("AIOS/") then
- if fs.exists("AIOS/.EXPLORER/BG.nfp") then
- DrawBG()
- else
- ErrorLog("BG.nfp not found")
- end
- if fs.exists("AIOS/.EXPLORER/") then
- while true do
- sleep(0.1)
- DrawBG()
- W,H = term.getSize()
- DrawIMG("AIOS/.EXPLORER/ICONS/WEB",7,1)
- App_WEB_X = 7
- App_WEB_Y = 1
- DrawIMG("AIOS/.EXPLORER/ICONS/RECYCLE",1,7)
- App_RECYCLE_X = 1
- App_RECYCLE_Y = 7
- DrawIMG("AIOS/.EXPLORER/ICONS/SHOP",7,7)
- App_SHOP_X = 7
- App_SHOP_Y = 7
- DrawIMG("AIOS/.EXPLORER/ICONS/EXPLORER",1,1)
- App_EXPLORER_X = 1
- App_EXPLORER_Y = 1
- DrawIMG("AIOS/.EXPLORER/ICONS/START",1,H-1)
- E,K,X,Y = os.pullEvent()
- EVENT = E
- if EVENT == "mouse_click" then
- term.setCursorPos(1,1)
- sleep(0)
- if X == App_WEB_X and Y == App_WEB_Y then
- if fs.exists("ARE.lua") then
- shell.run("ARE")
- else
- ErrorLog("ARE.lua NOT FOUND")
- end
- elseif X == App_EXPLORER_X and Y == App_EXPLORER_Y then
- if fs.exists("FM2.lua") or fs.exists("FM2") then
- shell.run("FM2")
- shell.run("fg ls")
- shell.run("cd ..")
- else
- ErrorLog("EXPLORER.lua NOT FOUND")
- end
- elseif X == App_SHOP_X and Y == App_SHOP_Y then
- if fs.exists("APM.lua") or fs.exists("APM") then
- term.clear()
- shell.run("APM list")
- print("select package to install or type exit to exit")
- local INP = read()
- if INP == "exit" then
- else
- shell.run("APM install",INP)
- end
- else
- ErrorLog("APM NOT FOUND")
- end
- elseif X == App_RECYCLE_X and Y == App_RECYCLE_Y then
- if fs.exists("AIOS/RECYCLE/") then
- if fs.exists("FM2.lua") then
- shell.run("FM2.lua","AIOS/RECYCLE")
- shell.run("fg ls")
- shell.run("cd ..")
- else
- ErrorLog("EXPLORER.lua NOT FOUND")
- end
- else
- ErrorLog("DIR RECYCLE NOT FOUND")
- end
- end
- elseif E == "key" then
- if K == string.byte("S") then
- shell.run("fg")
- end
- end
- end
- else
- PANIC("EXPLORER NOT FOUND!")
- shell.run("fg")
- end
- end
- end
- MainMenu()
- sleep(1)
- PANIC("SYSTEM PROGRAM STACK END REACHED!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement