Advertisement
Bendix

MC riddle - Zweiknopf

May 4th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. --ZweiKnopfBedienung
  2. white=1
  3. orange=2
  4. magenta=4
  5. lightblue=8
  6. yellow=16
  7. lime=32
  8. pink=64
  9. grey=128
  10. lightGrey=256
  11. cyan=512
  12. purple=1024
  13. blue=2048
  14. brown=4096
  15. green=8192
  16. red=16384
  17. black=32768
  18.  
  19. moni=peripheral.wrap("left")
  20. --moni.setTextScale(2)
  21.  
  22. function moniBlink()
  23.    for x=1,20 do
  24.       moni.setBackgroundColor(colors.red) moni.clear()
  25.       test()
  26.       sleep(.1)
  27.       moni.setBackgroundColor(colors.black) moni.clear()
  28.       test()
  29.       sleep(.1)
  30.    end
  31. end
  32. function test()
  33.    moni.setTextScale(2)
  34.    moni.setCursorPos(1,1)
  35.    moni.write("; ;")
  36.    moni.setCursorPos(1,2)
  37.    moni.write(" _ ")
  38. end
  39.  
  40.  
  41.  
  42. function moniTime()
  43.    moni.setTextScale(4)
  44.    for x=20,1, -1 do
  45.       if(x<10) then
  46.          moni.setCursorPos(2,1)
  47.          moni.write(math.floor(x))
  48.       else
  49.          moni.write(math.floor(x))
  50.       end
  51.       sleep(1)
  52.       moni.clear() moni.setCursorPos(1,1)
  53.    end
  54. end
  55. signalC=0
  56. counter=0
  57. while true do
  58.    moni.setBackgroundColor(colors.black)
  59.    moni.setTextScale(1)
  60.    moni.setCursorPos(1,1)
  61.    moni.write("Raum 1")
  62.    signalB = redstone.getBundledInput("bottom")
  63.    if (signalB > 0 ) then
  64.       signalC = signalC + signalB
  65.       counter = counter +1
  66.       sleep(1)
  67.    end
  68.    
  69.    if (signalC==magenta+grey) then
  70.       redstone.setOutput("top",true)
  71.       moniTime()
  72.       signalC=0
  73.    else
  74.       redstone.setOutput("top",false) sleep(.2)  
  75.       if(counter>=2)then
  76.          moniBlink()
  77.          signalC=0
  78.          counter=0
  79.       end
  80.  
  81.    end
  82.    print(redstone.getBundledInput("bottom"))
  83.     sleep(.8)
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement