Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Page = "Home"
- function Input(y)
- local n = 1
- local Text
- while true do
- term.setCursorPos(1,y)
- term.clearLine()
- if n == 1 then if Text ~= nil then term.write("> ["..Text.."]") else term.write("> [_]") end else if Text ~= nil then term.write("["..Text.."]") else term.write("[_]") end end
- term.setCursorPos(1,y+1)
- term.clearLine()
- if n == 2 then term.write("> -enter") else term.write("-enter") end
- term.setCursorPos(1,y+2)
- term.clearLine()
- term.write("use arrow keys")
- local event, a, b = os.pullEvent()
- if event == "key" and a ~= 265 and a ~= 264 and n == 1 then term.setCursorPos(1,y) term.clearLine() Text = read() end
- if event == "key" and (a == 265 or a == 264) then if n == 1 then n = 2 else n = 1 end end
- if n == 2 and a == keys.enter then break end
- end
- term.clear()
- return Text
- end
- function List(y,options)
- local n = 1
- while true do
- for i = 1, #options do
- term.setCursorPos(1,(i-1)+y)
- term.clearLine()
- if n == i then term.write("> -"..options[i]) else term.write("-"..options[i]) end
- end
- term.setCursorPos(1,y+#options)
- term.clearLine()
- term.write("W/S, Enter")
- local a, b, c = os.pullEvent("key")
- if b == keys.w or b == 265 then if n == 1 then n = #options else n = n - 1 end end
- if b == keys.s or b == 264 then if n == #options then n = 1 else n = n + 1 end end
- if b == keys.enter then break end
- end
- term.clear()
- return n
- end
- function CreateCopyEdit(file)
- local Data
- local file = fs.open(file,"r")
- Data = file.readAll()
- file.close()
- file = fs.open("copy","w")
- file.write(Data)
- file.close()
- shell.run("edit","copy")
- local printer = peripheral.wrap("left")
- file = fs.open("copy","r")
- Data = file.readAll()
- printer.write(Data)
- printer.endPage()
- end
- function UI()
- term.clear()
- term.setCursorPos(1,1)
- if Page == "Home" then
- print("Home")
- local n = List(3,{"tax forum","land registry","company forums"})
- if n == 1 then Page = "Tax Forums" elseif n == 2 then Page = "Land Registry" elseif n == 3 then Page = "Company Forums" end
- elseif Page == "Tax Forums" then
- local n = List(3,{"return"})
- if n == 1 then Page = "Home" end
- elseif Page == "Land Registry" then
- local n = List(3,{"register land forum","return"})
- if n == 1 then Page = "Home" CreateCopyEdit("landforum.txt") elseif n == 2 then Page = "Home" end
- elseif Page == "Company Forums" then
- print("Company Forums")
- local n = List(3,{"return"})
- if n == 1 then Page = "Home" end
- end
- end
- function Main()
- while true do
- UI()
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement