Advertisement
ComputerMan123

CodeStudio

Nov 9th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. --[[
  2. Code Studio by houseofkraft
  3. This program is licensed under the MIT license as described on this page: https://opensource.org/licenses/MIT
  4. You may use this program in your operating systems as long as you keep these lines
  5. ]]--
  6.  
  7. local files = {
  8.   [1] = {
  9.         "/cstudio/images/main",
  10.         "https://raw.githubusercontent.com/CoolMan119/CodeStudio/master/images/main"
  11.   }
  12. }
  13.  
  14. -- Check if files exist
  15. if fs.exists("cstudio") == false then
  16.   -- Start downloading all the files
  17.   local req
  18.   for k,v in pairs(files) do
  19.     print(v[1])
  20.     req = http.get(v[2])
  21.     file = fs.open(v[1], "w")
  22.     file.write(req.readAll())
  23.     file.close()
  24.   end
  25. end
  26.  
  27. -- Load images
  28. main = paintutils.loadImage("/cstudio/images/main")
  29.  
  30. -- Functions
  31. local function centerText(text)
  32.   local x,y = term.getSize()
  33.   local x2,y2 = term.getCursorPos()
  34.   term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  35.   write(text)
  36. end
  37.  
  38. -- Init
  39. term.clear()
  40. term.setCursorPos(1,1)
  41. paintutils.drawImage(main, 1, 1)
  42. os.sleep(1)
  43. term.clear()
  44. term.setCursorPos(1,1)
  45. centerText("HouseCode")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement