Guest User

Untitled

a guest
Jul 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. -- NewOS 1.0
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. _ver = "1,1"
  5. OSname = "NewOS "
  6. loginchoise = "false"
  7. registerchoise = "true"
  8. yeschoise = "false"
  9. nochoise = "true"
  10.  
  11. -- defining cPrint function!
  12. local function cPrint(text)
  13. local x,y = term.getSize()
  14. local x2,y2 = term.getCursorPos()
  15. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  16. print(text)
  17. end
  18.  
  19. function yN()
  20. local n=1
  21. while true do
  22. local x, y=term.getCursorPos()
  23. term.clearLine()
  24. if n==1 then cPrint("|     -> Login <-   Register      |") else cPrint("|      Login   -> Register <-     |") end
  25. term.setCursorPos(x, y)
  26. a, b=os.pullEvent()
  27. while a~="key" do a, b=os.pullEvent() end
  28. if b==203 and n==2 then n=1 end
  29. if b==205 and n==1 then n=2 end
  30. if b==29 then print("") break end
  31. end
  32. if n==1 then loginchoise = true end
  33. if n==2 then registerchoise = false end
  34. return false
  35. end
  36.  
  37. yN()
Add Comment
Please, Sign In to add comment