Advertisement
jamawie

Trade-o-Mat verfügbarkeit

May 29th, 2016
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1. bundledSide = "bottom"
  2. monside = "right"
  3. tauschen = true
  4.  
  5. mon = peripheral.wrap(monside)
  6. mon.setTextScale(0.75)
  7. x,y = mon.getSize()
  8.  
  9. --nichts mehr ändern
  10.  
  11. function midWrite(text, yPos)
  12.     xPos = math.floor((x-#text)/2)
  13.     mon.setCursorPos(xPos,yPos)
  14.     mon.write(text)
  15. end
  16.  
  17. function gui()
  18.     mon.setBackgroundColor(colors.lightGray)
  19.     mon.setTextColor(colors.gray)
  20.     for i=1,y do
  21.         mon.setCursorPos(1,i)
  22.         for j=1,x do
  23.             mon.write(" ")
  24.         end
  25.     end
  26.  
  27.     mon.setTextColor(colors.cyan)
  28.     midWrite(".::     .::.:::::::          .:       .:::     .::",3)   
  29.     midWrite(".::     .::.::    .::       .: ::     .: .::   .::",4)
  30.     midWrite(".::     .::.::    .::      .:  .::    .:: .::  .::",5)
  31.     midWrite(".::     .::.: .::         .::   .::   .::  .:: .::",6)
  32.     midWrite(".::     .::.::  .::      .:::::: .::  .::   .: .::",7)
  33.     midWrite(".::     .::.::    .::   .::       .:: .::    .: ::",8)
  34.     midWrite("  .:::::   .::      .::.::         .::.::      .::",9)
  35.    
  36.     mon.setTextColor(colors.orange)
  37.     midWrite("Uran Tausch-o-Mat - Status",1)
  38.    
  39.     mon.setTextColor(colors.gray)
  40.     mon.setCursorPos(2,12)
  41.     mon.write("UU-Matter Vorrat:")
  42.     mon.setCursorPos(2,15)
  43.     mon.write("Uran-Cell Isotope Vorrat:")
  44.  
  45.     mon.setCursorPos(x-7,12)
  46.     if uu then
  47.         mon.setTextColor(colors.red)
  48.         mon.write("too low")
  49.     else
  50.         mon.setTextColor(colors.green)
  51.         mon.write("ok")
  52.     end
  53.  
  54.     mon.setCursorPos(x-7,15)
  55.     if urancell then
  56.         mon.setTextColor(colors.red)
  57.         mon.write("too high")
  58.     else
  59.         mon.setTextColor(colors.green)
  60.         mon.write("ok")
  61.     end
  62.  
  63.     if not uu and not urancell then
  64.         mon.setTextColor(colors.green)
  65.         midWrite("+-+-+-+-+-+-+-+-+-+",18)
  66.         midWrite("|G|E|O|E|F|F|N|E|T|",19)
  67.         midWrite("+-+-+-+-+-+-+-+-+-+",20)
  68.         rs.setBundledOutput("bottom",colors.lime+colors.blue)
  69.     else
  70.         mon.setTextColor(colors.red)
  71.         midWrite("+-+-+-+-+-+-+-+-+-+-+-+",18)
  72.         midWrite("|G|E|S|C|H|L|O|S|S|E|N|",19)
  73.         midWrite("+-+-+-+-+-+-+-+-+-+-+-+",20)
  74.         rs.setBundledOutput("bottom",0)
  75.     end
  76. end
  77.  
  78. while true do
  79.     uu = rs.testBundledInput("bottom",colors.magenta)
  80.     urancell = rs.testBundledInput("bottom",colors.purple)
  81.  
  82.     mon.clear()
  83.     gui()
  84.  
  85.     event = os.pullEvent()
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement