Nike622000

Aufzug overlay

Oct 30th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. monSide = "back"
  2. bSide   = "left"
  3.  
  4. Etage1 = {2,2,colors.white,"Erdgeschoss"}
  5. Etage2 = {2,4,colors.magenta,"1.UG"}
  6. Etage3 = {2,6,colors.yellow,"Technik"}
  7. Etage4 = {2,8,colors.pink,"Crafting"}
  8. Etage5 = {23,2,colors.lightGray,"Thaumcraft"}
  9.  
  10. Etagen = {Etage1,Etage2,Etage3,Etage4,Etage5}
  11.  
  12. mon = peripheral.wrap(monSide)
  13. mon.setTextScale(.5)
  14.  
  15. xMax,yMax = mon.getSize()
  16.  
  17. function Background()
  18.   mon.setBackgroundColor(colors.black)
  19.   for xPos = 1,xMax do
  20.     for yPos = 1,yMax do
  21.       mon.setCursorPos(xPos,yPos)
  22.       mon.write(" ")
  23.     end
  24.   end
  25. end
  26.  
  27. function overlay()
  28.   for E = 1,#Etagen do
  29.     mon.setBackgroundColor(colors.gray)
  30.     mon.setCursorPos(Etagen[E][1],Etagen[E][2])
  31.     mon.write("Etage"..E)
  32.     mon.setBackgroundColor(colors.black)
  33.     mon.write(" "..Etagen[E][4])
  34.   end
  35. end
  36.  
  37. function check()
  38.   event,side,xPos,yPos = os.pullEvent("monitor_touch")
  39.   for E = 1,#Etagen do
  40.     if  Etagen[E][1] <= xPos and Etagen[E][1]+6 >= xPos
  41.     and Etagen[E][2] <= yPos and Etagen[E][2]+1 >= yPos then
  42.       rs.setBundledOutput(bSide,Etagen[E][3])
  43.       mon.setCursorPos(1,yMax)
  44.       mon.write("Ziel: Etage"..E)
  45.       sleep(0.5)
  46.       rs.setBundledOutput(bSide,0)
  47.       sleep(2)
  48.       mon.setCursorPos(1,yMax)
  49.       mon.write("              ")
  50.     end
  51.   end
  52. end
  53.  
  54. while true do
  55.   Background()
  56.   overlay()
  57.   check()
  58. end
Advertisement
Add Comment
Please, Sign In to add comment