Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Just know that this is still a work in progress.
- -- I'll make it so you can download it as an official os later. ok cool.
- -- after all this is a hobby project. although, I will show a list of shit im gonna add in later
- function getTime()
- local osTime = os.time()
- local minutes = math.floor(osTime%13)
- local seconds = osTime - math.floor(osTime)
- seconds = seconds * 100
- seconds = seconds / (100/60)
- seconds = math.floor(seconds)
- if seconds < 10 then
- seconds = 0 .. seconds
- end
- local timeBracket = " AM"
- if osTime / 13 >= 1 then
- timeBracket = " PM"
- end
- return minutes .. ":" .. seconds .. timeBracket
- end
- function newLine(lines)
- for a = 1, lines do
- print("")
- end
- end
- function printCenter(message, force)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.floor((x / 2) - (message:len() / 2))+0.5, y2+0.5)
- if not force then
- print(message)
- else
- write(message)
- end
- end
- function colorChange(menuBarColor)
- if menuBarColor == colors.red then
- menuBarColor = colors.orange
- elseif menuBarColor == colors.orange then
- menuBarColor = colors.yellow
- elseif menuBarColor == colors.yellow then
- menuBarColor = colors.green
- elseif menuBarColor == colors.green then
- menuBarColor = colors.blue
- elseif menuBarColor == colors.blue then
- menuBarColor = colors.purple
- elseif menuBarColor == colors.purple then
- menuBarColor = colors.black
- elseif menuBarColor == colors.black then
- menuBarColor = colors.red
- end
- return menuBarColor
- end
- local selection = 0
- local screen = 0
- local maxSelection = 1
- local menuBarColor = colors.red
- local backgroundColor = colors.black
- function keyMain()
- while true do
- local event, key, isHeld = os.pullEvent("key")
- if key == keys.up then
- selection = selection - 1
- elseif key == keys.down then
- selection = selection + 1
- end
- if key == keys.enter and screen == 0 and selection == 0 then
- term.clear()
- error("Goodnight.")
- elseif key == keys.enter and screen == 0 and selection == 2 then
- screen = 1
- selection = 0
- elseif key == keys.enter and screen == 0 and selection == 1 then
- screen = 2
- selection = 0
- elseif key == keys.enter and screen == 1 and selection == 0 then
- screen = 0
- selection = 1
- elseif key == keys.enter and screen == 1 and selection == 1 then
- menuBarColor = colorChange(menuBarColor)
- elseif key == keys.enter and screen == 1 and selection == 2 then
- backgroundColor = colorChange(backgroundColor)
- elseif key == keys.enter and screen == 2 and selection == 0 then
- screen = 0
- selection = 0
- elseif key == keys.enter and screen == 2 and selection == 1 then
- screen = 3
- selection = 0
- elseif key == keys.enter and screen == 3 then
- screen = 2
- selection = 1
- end
- end
- end
- local win = window.create(term.current(),1,1,term.getSize())
- term.redirect(win)
- function main()
- while true do
- win.setVisible(false)
- term.clear()
- term.setCursorPos(1,1)
- local termX, termY = term.getSize()
- if selection > maxSelection then
- selection = 0
- elseif selection < 0 then
- selection = maxSelection
- end
- local bg = term.getBackgroundColor()
- term.setBackgroundColor(backgroundColor)
- for b = 1, termY do
- for a = 1, termX do
- write(" ")
- end
- end
- term.setCursorPos(1, 1)
- term.setBackgroundColor(menuBarColor)
- for a = 1, termX do
- write(" ")
- end
- term.setCursorPos(1, 1)
- write("Ender OS")
- printCenter(getTime(), true)
- term.setBackgroundColor(backgroundColor)
- newLine(1)
- if screen == 0 then
- maxSelection = 2
- newLine(3)
- if selection == 0 then
- printCenter("<Exit>")
- else
- printCenter("Exit")
- end
- if selection == 1 then
- printCenter("<Utilities>")
- else
- printCenter("Utilities")
- end
- if selection == 2 then
- printCenter("<Settings>")
- else
- printCenter("Settings")
- end
- elseif screen == 1 then
- maxSelection = 2
- newLine(2)
- printCenter("[Settings]")
- if selection == 0 then
- printCenter("<Back>")
- else
- printCenter("Back")
- end
- if selection == 1 then
- printCenter("<Menu Bar Color>")
- else
- printCenter("Menu Bar Color")
- end
- if selection == 2 then
- printCenter("<Background Color>")
- else
- printCenter("Background Color")
- end
- elseif screen == 2 then
- maxSelection = 1
- newLine(2)
- printCenter("[Utilities]")
- if selection == 0 then
- printCenter("<Back>")
- else
- printCenter("Back")
- end
- if selection == 1 then
- printCenter("<Autocraft>")
- else
- printCenter("Autocraft")
- end
- elseif screen == 3 then
- newLine(1)
- printCenter("[Autocrafter]")
- print("This will automatically craft with anything in the current inventory. Does NOT work for computers, for turtles only. Only crafts in a 3x3 area. It will deposit anything it crafts below it into a chest. Enjoy!")
- newLine(2)
- printCenter("[Enter] to stop autocrafting")
- local totalcount = 0
- local itemCount = 0
- local maxSelection = 0
- local firstEmpty = 0
- for a = 1, 16 do
- local itemData = turtle.getItemDetail(a)
- if itemData ~= nil then
- itemCount = itemCount + 1
- if itemData.count >= 2 then
- maxSelection = maxSelection + 1
- end
- else
- if firstEmpty == 0 then
- firstEmpty = a
- end
- end
- end
- if firstEmpty ~= 0 then
- if maxSelection == itemCount then
- turtle.craft(1)
- turtle.select(firstEmpty)
- turtle.dropDown()
- end
- end
- end
- win.setVisible(true)
- os.sleep(0.1)
- end
- end
- parallel.waitForAny(main, keyMain)
Add Comment
Please, Sign In to add comment