Nike622000

Max

Aug 2nd, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. senI = sensor.wrap("back")
  3. monSide = "back"
  4. senSide = "top"
  5. Tcolor = colors.white
  6. Bcolor1 = colors.black
  7. Bcolor2 = colors.gray
  8. Rside = "bottom"
  9.  
  10. mon = peripheral.wrap("back")
  11. sen = sensor.wrap(senSide)
  12.  
  13. xMax,yMax = mon.getSize()
  14.  
  15. mon.setTextColor(Tcolor)
  16.  
  17. function BG()
  18. mon.setBackgroundColor(Bcolor1)
  19. for yPos = 1,yMax do
  20. for xPos = 1,xMax do
  21. mon.setCursorPos(xPos,yPos)
  22. mon.write(" ")
  23. end
  24. end
  25. end
  26.  
  27. while true do
  28. BG()
  29. rs.setOutput(Rside, false)
  30. zieleinv = sen.getTargets()
  31.     for k,v in pairs(zieleinv) do
  32.             if v.Name == "Player"
  33.             and v.Position.X <= 1 and v.Position.X >= -1
  34.             and v.Position.Y <= 0 and v.Position.Y >= -4
  35.             and v.Position.Z <= 4 and v.Position.Z >= 1.5
  36.             then
  37.             name = k
  38.              details = sen.getTargetDetails(k)
  39.                     for i = 1,40 do
  40.                     item = details.Inventory[i].Name
  41.                     if item == "Stick of Truth" then
  42.                         BG()
  43.                         mon.setCursorPos(1,1)
  44.                         mon.setBackgroundColor(Bcolor2)
  45.                         mon.write(name)
  46.                         mon.setCursorPos(1,2)
  47.                         mon.setBackgroundColor(colors.lime)
  48.                         mon.write("Item akzeptiert")
  49.                         rs.setOutput(Rside, true)
  50. for wait = 10,1,-1 do
  51. mon.setCursorPos(1,4)
  52. mon.setBackgroundColor(colors.red)
  53. mon.write("Refresh in "..wait.." ")
  54. mon.setCursorPos(1,5)
  55. mon.write("seconds       ")
  56. sleep(1)
  57. end
  58. end
  59. end
  60. end
  61. end
  62. end
Add Comment
Please, Sign In to add comment