Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- --- ---- Boot System v1.x ---- --- --
- os.loadAPI("gui.lua")
- local dir = "/win/win"
- local function bootSequence()
- if gui.getButtonState( "cancel-button" ) == true then
- gui.setLabelText( "load-label" , "Canceling boot..." )
- os.sleep(1)
- gui.clearAllObjects()
- term.setCursorPos(1,1)
- print( "Canceled direct boot to" )
- print( "/CraftOS" .. dir )
- os.sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- print( "To boot, type \"reboot\"." )
- print( "Boot System" )
- os.pullEvent( "ternimate" )
- end
- gui.updateAll()
- end
- local w, h = term.getSize()
- local prog = 100
- local timer = 0
- gui.newLabel( "title-1" , "Boot System" , 1 , 1 , w - 8 , 1 , colors.blue )
- gui.newButton( "cancel-boot" , "Cancel", w - 8 , 1 , 8 , 1, nil, nil, colors.pink, colors.red, false)
- gui.newLabel( "boot-dir-title" , "Boot Directory" , 2 , 3 , w - 2 , 1 , colors.blue )
- gui.newLabel( "boot-dir" , "/CraftOS" .. dir , 2 , 5 , w - 2 , 2 , colors.gray )
- gui.newBar( "load-bar" , 1 , h - 2 , w , 1 , colors.lightBlue , colors.blue , 0)
- gui.newLabel( "load-label , "Invalid label" , 1 , h - 3 , w , 1 , colors.blue )
- os.sleep(0.01)
- gui.setLabelText( "load-label" , "Press F1 to cancel. Press enter to boot." )
- gui.updateAll()
- timer = 5
- repeat
- bootSequence()
- os.sleep( 0.1)
- timer = timer - 0.1
- until timer < 0.1
- repeat
- bootSequence()
- gui.setBarValue( "load-bar" , prog )
- gui.setLabelText( "load-label" , "Booting OS in " .. prog / 10 .. " seconds..." )
- prog = prog - 1
- os.sleep(0.1)
- until prog < 1
- gui.clearAllObjects()
- shell.exit()
Add Comment
Please, Sign In to add comment