Advertisement
wirthe64

game1launcher

May 18th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1.  
  2. local function clicked(x,y,x1,y1,x2,y2)
  3. if x >= x1 and x <= x2 and y >= y1 and y <= y2 then
  4. return true
  5. end
  6. return false
  7. end
  8.  
  9. local function pastebin(paste,path)
  10. local file = http.get("http://pastebin.com/raw.php?i="..paste)
  11. if file then
  12. file = file.readAll()
  13. h=fs.open(path,"w")
  14. h.write(file)
  15. h.close()
  16. else
  17. term.setBackgroundColor(32768)
  18. term.clear()
  19. term.setCursorPos(1,1)
  20. error("Error 404")
  21. end
  22. end
  23.  
  24. local dataDownload = {
  25. {["paste"]="dxYxX6dn",["path"]="game1main/graphics"},
  26. {["paste"]="77kUygXF",["path"]="game1main/backgroundg.img"},
  27. {["paste"]="vqxBbzi9",["path"]="game1main/game1itamname"},
  28. {["paste"]="GXzR4ig8",["path"]="game1main/gamemain"},
  29. }
  30.  
  31. local function download()
  32. for f = 1, #dataDownload do
  33. if not fs.exists(dataDownload[f]["path"]) then
  34. pastebin(dataDownload[f]["paste"],dataDownload[f]["path"])
  35. end
  36. end
  37. end
  38.  
  39. term.setBackgroundColor(8192)
  40. term.clear()
  41. term.setCursorPos(1,1)
  42. term.write(string.rep("-",51))
  43. term.setCursorPos(19,1)
  44. term.write("Game launcher")
  45. local vnltext = "Game1 launcher by Wirthe16"
  46. term.setCursorPos(51-#vnltext,19)
  47. term.write(vnltext)
  48. local vnftext = "CC Graphics API by Wirthe16, Milliost"
  49. term.setCursorPos(51-#vnftext,18)
  50. term.write(vnftext)
  51. term.setCursorPos(18,4)
  52. term.write("Downloading...")
  53. download()
  54. term.setCursorPos(18,4)
  55. term.write(" ")
  56. term.setCursorPos(19,5)
  57. term.write("Quit Play")
  58.  
  59. while true do
  60. local e, b, x, y = os.pullEvent()
  61. if e == "mouse_click" and b == 1 and clicked(x,y,19,5,22,5) then
  62. term.setBackgroundColor(colors.black)
  63. term.clear()
  64. term.setCursorPos(1,1)
  65. break
  66. elseif e == "mouse_click" and b == 1 and clicked(x,y,27,5,30,5) then
  67. shell.run("game1main/gamemain")
  68. end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement