Advertisement
willwac

DuoStep - SETUP

Sep 14th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. local ver = "0.2"
  2. local server = "QsUB5kWK"
  3. local client = "ccypr5E0"
  4. local vo = nil
  5. local valid = false
  6.  
  7. if not http then
  8.     printError("You must enable the http API in the ComputerCraft.cfg file to download DuoStep.")
  9.     vo = false
  10. end
  11.  
  12. while not vo do
  13.   term.setBackgroundColor(colors.black)
  14.   term.setTextColor(colors.white)
  15.   term.setCursorPos(1,1)
  16.   term.clear()
  17.   print("DuoStep - Setup  v"..ver)
  18.   print("")
  19.   print("1: Install Server")
  20.   print("2: Install Client")
  21.   print("3: Exit")
  22.   option = read()
  23.   if option == "1" then
  24.     vo = true
  25.     term.setBackgroundColor(colors.black)
  26.     term.setTextColor(colors.white)
  27.     term.setCursorPos(1,1)
  28.     term.clear()
  29.     print("DuoStep - Setup v"..ver)
  30.     print("")
  31.     term.write("Save as: ")
  32.     local file = read()
  33.     local _,y = term.getCursorPos()
  34.     term.setCursorPos(1,y+1)
  35.     print("Downloading server as "..file.."...")
  36.     resp = http.get("http://pastebin.com/raw.php?i="..server)
  37.     if resp then
  38.         handler=io.open(file,"w")
  39.         handler:write(resp.readAll())
  40.         handler:close()
  41.         print("Success! DuoStep Server v"..ver.." has been installed.")
  42.     else
  43.         printError("An error occurred, DuoStep Server v"..ver.." could not be installed at this time.")
  44.     end
  45.   elseif option == "2" then
  46.     vo = true
  47.     term.setBackgroundColor(colors.black)
  48.     term.setTextColor(colors.white)
  49.     term.setCursorPos(1,1)
  50.     term.clear()
  51.     print("DuoStep - Setup v"..ver)
  52.     print("")
  53.     term.write("Save as: ")
  54.     local file = read()
  55.     local _,y = term.getCursorPos()
  56.     term.setCursorPos(1,y+1)
  57.     print("Downloading client as "..file.."...")
  58.     resp = http.get("http://pastebin.com/raw.php?i="..client)
  59.     if resp then
  60.         handler=io.open(file,"w")
  61.         handler:write(resp.readAll())
  62.         handler:close()
  63.         print("Success! DuoStep Client v"..ver.." has been installed.")
  64.     else
  65.         printError("An error occurred, DuoStep Client v"..ver.." could not be installed at this time.")
  66.     end
  67.   else
  68.     printError("Not a valid option!")
  69.     sleep(3)
  70.   end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement