Advertisement
Guest User

board

a guest
Mar 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.29 KB | None | 0 0
  1. print("boot -- starting")
  2. local monitor = peripheral.wrap("right")
  3. dofile("clearmon")
  4. monitor.setTextScale(2)
  5. menu = "main"
  6. --Draw menus and stuff
  7. print("boot -- building functions")
  8. function drawQuit (c)
  9.   print("draw -- quit button")
  10.   monitor.setBackgroundColor(c)
  11.   monitor.setCursorPos(1,10)
  12.   monitor.write(" Quit ")
  13. end
  14. function drawNews (c)
  15.   print("draw -- news button")
  16.   monitor.setBackgroundColor(colors.black)
  17.   monitor.setCursorPos(1,1)
  18.   monitor.write("Billboard by bbaovanc")
  19.   monitor.setBackgroundColor(c)
  20.   monitor.setCursorPos(3,2)
  21.   monitor.write("      ")
  22.   monitor.setCursorPos(3,3)
  23.   monitor.write(" News ")
  24.   monitor.setCursorPos(3,4)
  25.   monitor.write("      ")
  26. end
  27. function drawRules (c)
  28.   print("draw -- rules button")
  29.   monitor.setBackgroundColor(c)
  30.   monitor.setCursorPos(15,2)
  31.   monitor.write("       ")
  32.   monitor.setCursorPos(15,3)
  33.   monitor.write(" Rules ")
  34.   monitor.setCursorPos(15,4)
  35.   monitor.write("       ")
  36. end
  37. function drawMainMenu ()
  38.   print("draw -- main menu")
  39.   menu = "main"
  40.   dofile("clearmon")
  41.   drawNews(colors.orange)
  42.   drawRules(colors.green)
  43.   drawQuit(colors.red)
  44. end
  45. function drawNewsMenu ()
  46.   print("draw -- news menu")
  47.   menu = "news"
  48.   dofile("clearmon")
  49.   monitor.setBackgroundColor(colors.black)
  50.   monitor.setCursorPos(1,1)
  51.   monitor.write("-------------------------")
  52.   monitor.setCursorPos(1,2)
  53.   monitor.write("bbaovanc's PC shop coming")
  54.   monitor.setCursorPos(1,3)
  55.   monitor.write("soon!")
  56.   monitor.setCursorPos(1,4)
  57.   monitor.write("-------------------------")
  58.   monitor.setCursorPos(1,5)
  59.   monitor.write("Unvexed's Potion Pit now")
  60.   monitor.setCursorPos(1,6)
  61.   monitor.write("open!")
  62.   monitor.setCursorPos(1,7)
  63.   monitor.write("-------------------------")
  64.   drawQuit(colors.red)
  65. end
  66. function drawRulesMenu ()
  67.   print("draw -- rules menu")
  68.   menu = "rules"
  69.   dofile("clearmon")
  70.   monitor.setBackgroundColor(colors.black)
  71.   monitor.setCursorPos(1,1)
  72.   monitor.write("1. No griefing or ")
  73.   monitor.setCursorPos(1,2)
  74.   monitor.write("   permanent pranks")
  75.   monitor.setCursorPos(1,3)
  76.   monitor.write("2. No commands ever!")
  77.   monitor.setCursorPos(1,4)
  78.   monitor.write("3. Don't be rude in any")
  79.   monitor.setCursorPos(1,5)
  80.   monitor.write("   way. Use #reporting")
  81.   monitor.setCursorPos(1,6)
  82.   monitor.write("- Breaking any rule is a")
  83.   monitor.setCursorPos(1,7)
  84.   monitor.write("  bannable offense!")
  85.   monitor.setCursorPos(1,8)
  86.   monitor.write("- Make sure to put NEI in")
  87.   monitor.setCursorPos(1,9)
  88.   monitor.write("  recipe mode!")
  89.   drawQuit(colors.red)
  90. end
  91. drawMainMenu()
  92. --Loop
  93. while true == true do
  94.   local _,s,x,y = os.pullEvent("monitor_touch")
  95.   print("x: ", x, " y: ", y)
  96.   if x >= 3 and x <= 8 and menu == "main" then
  97.     if y >=2 and y <= 4 then
  98.       drawNews(colors.cyan)
  99.       os.sleep(0.5)
  100.       drawNewsMenu()
  101.     end
  102.   elseif x <= 6 and y == 10 and menu == "main" then
  103.     drawQuit(colors.green)
  104.     os.sleep(0.5)
  105.     dofile("clearmon2")
  106.     os.shutdown()
  107.     drawQuit(colors.red)
  108.   elseif x <= 6 and y == 10 and menu ~= "main" then
  109.     drawQuit(colors.green)
  110.     os.sleep(0.5)
  111.     drawMainMenu()
  112.   elseif x >= 15 and x <= 22 and menu == "main" then
  113.     if y >= 2 and y <= 4 then
  114.       drawRules(colors.red)
  115.       os.sleep(0.5)
  116.       drawRulesMenu()
  117.     end
  118.   end
  119. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement