Advertisement
KelvinBouma

reactor1

Feb 17th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. post_link = "http://cc.ordewittetafel.nl/reactor1.php"
  2. get_link = "http://cc.ordewittetafel.nl/switch_reactor1.php"
  3.  
  4. reactor = {
  5.     name = "Amunet",
  6.     temperature = "unknown"
  7. }
  8.  
  9. online = 0
  10.  
  11. while true do
  12.     reactor.status = tostring(redstone.getInput("back"))
  13.  
  14.     if online < 9 then
  15.         online = online + 1
  16.     else
  17.         online = 0
  18.     end
  19.  
  20.     http.post(post_link, "reactor=" .. reactor.name .. "&status=" .. reactor.status .. "&temp=" .. reactor.temperature .. "&online=" .. online)
  21.  
  22.     output = http.get(get_link)
  23.  
  24.     doOutput = output.readAll()
  25.  
  26.     if doOutput == "true" then
  27.         redstone.setOutput("back", true)
  28.     else
  29.         redstone.setOutput("back", false)
  30.     end
  31.  
  32.     output.close()
  33.  
  34.     os.sleep(1)
  35.     os.queueEvent("ok")
  36.     os.pullEvent("ok")
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement