danielcbailey

Paint Lobby Code

Jun 8th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. term.redirect(term.native())
  2. term.setBackgroundColor(colors.yellow)
  3. term.clear()
  4. term.setCursorPos(1, 1)
  5. term.setBackgroundColor(colors.lightGray)
  6. term.clearLine()
  7. term.setCursorPos(23, 1)
  8. term.setTextColor(colors.black)
  9. term.write("Paint")
  10. term.setCursorPos(51, 1)
  11. term.setBackgroundColor(colors.red)
  12. term.setTextColor(colors.white)
  13. term.write("X")
  14. term.setCursorPos(1,3)
  15. term.setBackgroundColor(colors.lightGray)
  16. term.write("File Name: ")
  17. term.setCursorPos(1,5)
  18. term.write("Directory:os/images ")
  19. term.setCursorPos(5,7)
  20. term.write("Editor")
  21. local keystrokes = "newFile"
  22. term.setCursorPos(11, 3)
  23. term.write(keystrokes)
  24. local progRunning = true
  25. while progRunning == true do
  26. event, button, xPos, yPos = os.pullEvent("mouse_click")
  27. if xPos > 10 and xPos < 27 and yPos == 3 then
  28. term.setCursorPos(1,3)
  29. term.setBackgroundColor(colors.lightGray)
  30. term.write("File Name: ")
  31. keystrokes = ""
  32. local scanning = true
  33. while scanning == true do
  34. event, keyTemp = os.pullEvent("key")
  35. if keys.getName(keyTemp) == "enter" then
  36. scanning = false
  37. end
  38. if scanning == true then
  39. keystrokes = keystrokes .. keys.getName(keyTemp)
  40. term.setCursorPos(11, 3) --set to proper y value.
  41. term.write(keystrokes)
  42. end
  43. end
  44. end
  45. if xPos > 4 and xPos < 11 and yPos == 7 then
  46. shell.run("paint os/images/" .. keystrokes)
  47. progRunning = false
  48. end
  49. if xPos > 50 and xPos < 52 and yPos == 1 then
  50. progRunning = false
  51. os.run({}, "os/gui")
  52. end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment