Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- slc = 0
- x, y = term.getSize()
- function display()
- clear()
- if slc == 0 then
- header()
- intro()
- elseif slc == 1 then
- test()
- elseif slc == 2 then
- debug()
- end
- end
- function header()
- clear()
- print("=======================================")
- term.write("| ")
- term.setTextColor(colors.lightBlue)
- term.write(" SortBob 1.0 ")
- term.setTextColor(colors.yellow)
- term.write(" ["..time().."]")
- term.setTextColor(colors.white)
- term.write(" | ")
- print("=======================================")
- print(" ")
- end
- -------------Programs------------------
- function intro()
- header()
- print(format("Please select a program: "))
- print(format("setLayout"))
- print(format("checkChest"))
- print(format("debug"))
- input()
- end
- function test()
- clear()
- print("test")
- input()
- end
- function debug()
- header()
- print("Dimensions: width = "..x..", height = "..y)
- input()
- end
- -----------Functions---------------
- function input()
- print("")
- term.write("Input: ")
- selection(read())
- end
- function selection(input)
- if input == "" then
- clear()
- print("Display closed")
- error()
- end
- if input == "home" then
- slc = 0
- end
- if slc == 0 then
- if input == "set Layout" then
- slc = 1
- elseif input == "debug" then
- slc = 2
- end
- end
- end
- function clear()
- term.setCursorPos(1,1)
- term.clear()
- end
- function format(str)
- length = string.len(str)
- spaces = math.floor((x - length)/2)
- for i = 1,spaces do
- str = " "..str.." "
- end
- if string.len(str) < x then
- str = str.." "
- end
- return str
- end
- function time()
- local time = os.time()
- h = math.floor(time)
- m = math.floor((time-h)*100)
- if h < 10 then
- h = "0"..h
- end
- if m < 10 then
- m = "0"..m
- end
- return (h..":"..m)
- end
- -------------Main--------------
- while true do
- display()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement