Advertisement
Padilk

Untitled

Aug 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. m = peripheral.wrap( "right" )
  2. m.setTextScale(2)
  3. x,y = m.getSize()
  4.  
  5. m.clear()
  6.  
  7. direction = 0
  8.  
  9. --H H H /\
  10. --H H H \/
  11.  
  12. floors = {}
  13. for i=1,6 do
  14. floors[i]=0
  15. end
  16.  
  17. floorsCount=5
  18. currentFloor=3
  19. floors[2]=1
  20.  
  21. function setColors(X)
  22. if X == 0 then --blank
  23. m.setTextColor(colors.white)
  24. m.setBackgroundColor(colors.black)
  25. elseif X==1 then --inactive
  26. m.setTextColor(colors.lightGray)
  27. m.setBackgroundColor(colors.gray)
  28. elseif X==2 then --active
  29. m.setTextColor(colors.white)
  30. m.setBackgroundColor(colors.lightGray)
  31. elseif X==3 then --current
  32. m.setTextColor(colors.white)
  33. m.setBackgroundColor(700)
  34. end
  35.  
  36.  
  37. end
  38.  
  39. function redraw()
  40. setColors(0)
  41. m.clear()
  42. cf = 1
  43. for j=1,2 do
  44. for i=1,5 do
  45. m.setCursorPos(i,j)
  46. if i%2 == 1 and cf<=floorsCount then
  47. if cf==currentFloor then
  48. setColors(3)
  49. elseif floors[cf] == 1 then
  50. setColors(2)
  51. else
  52. setColors(1)
  53. end
  54. m.write(cf)
  55. cf = cf+1
  56. else
  57. setColors(0)
  58. m.write(" ")
  59. end
  60. end
  61. end
  62. end
  63.  
  64.  
  65. c=1
  66.  
  67.  
  68. redraw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement