Advertisement
Guest User

startup.lua

a guest
Apr 9th, 2020
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1.  
  2. print("Running... [hold ctrl+t to cancel]")
  3. redstone.setAnalogOutput("right",15);
  4.  
  5. m = peripheral.find("monitor")
  6. s = peripheral.find("speaker")
  7.  
  8. url2 = "http://157.230.185.40/tc/lastwood.php"
  9. url = "http://157.230.185.40/tc/lua.php"
  10.  
  11. m.write("Press the button to update...")
  12.  
  13. local open = io.open
  14.  
  15. local function read_file(path)
  16.     local file = open(path, "r")
  17.     if not file then return nil end
  18.     local content = file:read "*a"
  19.     file:close()
  20.     return content
  21. end
  22.  
  23. while true do
  24.  
  25.     os.pullEvent("redstone")
  26.     if rs.getInput("back") == true then
  27.         s.playSound("minecraft:ui.toast.challenge_complete")
  28.  
  29.         shell.run("rm status")
  30.         shell.run("rm wood")
  31.         m.clear()
  32.         shell.run("wget", url, "status")
  33.         shell.run("wget", url2, "wood")
  34.  
  35.         local systat = read_file("status")
  36.         m.setCursorPos(1,1)
  37.         m.write("TELEHACK SYSTEM STATUS")
  38.         m.setCursorPos(1,2)
  39.         m.write(os.date('%y-%b-%d %H:%M:%S'))
  40.         m.setCursorPos(1,3)
  41.         m.write( (systat) )
  42.         m.setCursorPos(1,5)
  43.         local woody = read_file("wood")
  44.         m.write( "underwood was last active")
  45.         m.setCursorPos(1,6)
  46.         m.write(woody .. " ago.")
  47.   m.setCursorPos(1,9)
  48.   m.write("Press the button to update...")
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement