Advertisement
Guest User

treespc

a guest
Apr 26th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local term = require("term")
  2. local comp = require("component")
  3. local event = require("event")
  4. local m = comp.modem
  5. local colours = require("colors")
  6. local gpu = comp.gpu
  7.  
  8. local output = 0;
  9.  
  10. local trees = {"None","Iron", "Gold", "Lead","EXIT"}
  11. local treesLength = 5
  12.  
  13. gpu.setResolution(10, treesLength+1)
  14. term.clear()
  15.  
  16. repeat
  17.   for i = 1, treesLength, 1 do
  18.     if i == output then
  19.       gpu.setBackground(0x5A5A5A)
  20.     else
  21.       gpu.setBackground(0x000000)
  22.     end
  23.  
  24.     print(trees[i])
  25.   end
  26.  
  27.   local _, _, x, y = event.pull("touch")
  28.   output = y
  29.  
  30.   m.open(123)
  31.   m.broadcast(123, output)
  32.    
  33.   term.clear()
  34. until(output == treesLength)
  35.  
  36. gpu.setResolution(50,40)
  37. term.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement