Advertisement
TheSpicePhantom

SpiceFunctions

Aug 18th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. function askForFunction()
  2.   term.clear()
  3.   term.setCursorPos(1,1)
  4.   term.write("Funktion: ")
  5.   term.setCursorPos(11,1)
  6.   func = read()
  7.   if func == "Reaktor" then
  8.     rct = peripheral.find("nuclear_reactor")
  9.     mon = peripheral.find("monitor")
  10.     mon.setCursorPos(2,2)
  11.     mon.write("Momentane Kernhitze: ")
  12.     mon.setCursorPos(2,4)
  13.     mon.write("Momentaner Output: ")
  14.     --Button
  15.     mon.setCursorPos(46,1)
  16.     mon.setBackgroundColor(colors.red)
  17.     mon.write(" X ")
  18.     mon.setBackgroundColor(colors.black)
  19.     while true do
  20.         local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  21.         heat = rct.getHeat()
  22.         EUout = rct.getEUOutput()
  23.         mon.setCursorPos(23,2)
  24.         mon.write(heat.." Celsius ")
  25.         mon.setCursorPos(23,4)
  26.         mon.write(EUout.." EU/t ")
  27.         sleep(0.2)
  28.         if event == "monitor_touch" and xPos > 46 and xPos < 49 and yPos == 1 then
  29.             mon.clear()
  30.             shell.run("restart")
  31.         end
  32.     end
  33.   end
  34. end
  35. askForFunction()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement