Advertisement
superkh

PastebinGet

Apr 15th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. --This pastebin get it dessined for the superOS and will not Work unless You have A installed versoin of superOS on a ComputerCraft computer
  2. --to Get SuperOS type pastebin run bYaMJcmW
  3. --Deasined to be used for a API
  4.  
  5.  
  6. --local cbuf = buf.setupBuffer()
  7. os.pullEvent = os.pullEvent
  8.  
  9. term.setBackgroundColor(colors.black)
  10. term.clear()
  11. term.setTextColor(colors.green)
  12. function main()
  13.     print("Install on SuperOS(1) or on desktop(2)?")
  14.     while true do
  15.         r = read()
  16.         if type(r)=="string" then
  17.             if r == "1" then
  18.                 OS()
  19.                 break
  20.             elseif r == "2" then
  21.                 desk()
  22.                 break
  23.             elseif r == "q" then
  24.                 break
  25.             end
  26.         end
  27.         print("needs to be a 1 or a 2")
  28.         print("Install on SuperOS(1) or on desktop(2)?")
  29.     end
  30. end
  31.  
  32. function desk()
  33.     count = 0
  34.     while count < 3 do
  35.         print("File name: ")
  36.         local r = read()
  37.         if not fs.exists(r) then
  38.             print("Pastebin Code:")
  39.             local c = read()
  40.             if c then
  41.                 if shell.run("pastebin","get",c,r) then
  42.                     print("Finnihsed")
  43.                     sleep(2)
  44.                     break
  45.                 else
  46.                     print("does not exists")
  47.                 end            
  48.             end
  49.         else
  50.             print("Not a valid responce")
  51.         end
  52.         count = count+1
  53.     end
  54. end
  55.  
  56. function OS()
  57.     local function Public()
  58.         while true do
  59.             print("File name: ")
  60.             local r = read()
  61.             if not fs.exists("os/programs/"..r) then
  62.                 print("Pastebin Code:")
  63.                 local c = read()
  64.                 if c then
  65.                     shell.run("pastebin","get",c,"os/programs/"..r)
  66.                     print("Finnihsed")
  67.                     sleep(2)
  68.                     break          
  69.                 else
  70.                     print("Not a valid responce")
  71.                 end
  72.             end
  73.         end
  74.     end
  75.     local function Private()
  76.         local user = A.RUser()
  77.         local location = "os/users/"..user.."/programs/"
  78.         esc = true
  79.         while esc do
  80.             print("File name: ")
  81.             local r = read()
  82.             if not fs.exists(location..r) then
  83.                 print("Pastebin Code:")
  84.                 local c = read()
  85.                 if c then
  86.                     shell.run("pastebin","get",c,location..r)
  87.                     print("Finnihsed")
  88.                     esc = false
  89.                 end
  90.             else
  91.                 print("Not a valid responce")
  92.             end
  93.         end
  94.     end
  95.     while true do
  96.         print("Public(1) or Private(2) program?")
  97.         local r = read()
  98.         if r=="1" then
  99.             Public()
  100.             break
  101.         elseif r=="2" then
  102.             Private()
  103.             break
  104.         else
  105.             print("Not a Valid Option> Please enter a 1 or a 2")
  106.         end
  107.     end
  108. end
  109.  
  110.  
  111. local ok,err = pcall(main)
  112. if not ok then
  113.     A.Error(err)
  114.     sleep(5)
  115. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement