Guest User

LimitlessBoxV3

a guest
Mar 18th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.57 KB | None | 0 0
  1. --license:
  2. --you are free to modify, distribute, and re-license this code. This license does not apply to things downloaded via this code.
  3. --here's an actually decent installer
  4. --made in LuaEdit
  5. --are theyrunning in a tabbed os?
  6. --[[
  7. This is Install Utils by Geforce Fan. It's found @ BvL9rr0N , please get it from there to be sure it's up to date.
  8. Just paste it into your installer!
  9. ]]
  10. function pasteRun(id,aa)
  11. --print(aa)
  12. aa=aa or {}
  13. if not type(id)=="string" then
  14. return "Must has string!"
  15. end
  16. --get program off pastebin
  17. local a=http.get("http://www.pastebin.com/raw.php?i="..id)
  18. if not a then return false end
  19. a=a.readAll()
  20. if not a then return false end
  21. local env = {}
  22. a=loadstring(a)
  23. if not a then return false end
  24. --local env= setmetatable({},{__index=_G})
  25. local env=getfenv()
  26. setfenv(a,env)
  27.  
  28. local ok,err=pcall(a,unpack(aa))
  29. --a()
  30. if (not ok) and err then
  31. printError("Error running "..id..": "..err)
  32. return false
  33. end
  34. return err,env
  35. end
  36. function pastePI(id,tab)
  37. local returned,env = pasteRun(id)
  38. _G[tab] = env
  39. end
  40. function pasteGet(id)
  41. if not type(id)=="string" then
  42. return "Must has string!"
  43. end
  44. --get program off pastebin
  45. local a=http.get("http://www.pastebin.com/raw.php?i="..id)
  46. if not a then return false end
  47. a=a.readAll()
  48. if not a then return false end
  49. return a
  50. end
  51. function pasteGetAndSave(url,loc)
  52. local a=pasteGet(url)
  53. --write it
  54. local b = fs.open(loc,"w")
  55. if b then
  56. b.write(a)
  57. b.close()
  58. return true
  59. end
  60. return false
  61. end
  62. --This is the end of installutils. The rest is this person's installer.
  63.  
  64.  
  65.  
  66. local _,ty=term.getSize()
  67. local tabbed = true
  68. if ty == 18 then
  69. tabbed=true
  70. end
  71. pGetNDL= pasteGetAndSave
  72. local function cPrint(y,text)
  73. --centerprinttext
  74. local h=term.getSize()
  75. h=(h-#text)/2
  76. term.setCursorPos(h,y)
  77. write(text)
  78. end
  79. local function drawInsUI()
  80. term.setBackgroundColor(colors.gray)
  81. term.clear()
  82. term.setBackgroundColor(colors.orange)
  83. term.setTextColor(colors.black)
  84. term.setCursorPos(1,1)
  85. print(" ")
  86. cPrint(1,"LimitlessBox V2")
  87. term.setBackgroundColor(colors.gray)
  88. term.setTextColor(colors.orange)
  89. --make a box where the info will be displayed
  90. paintutils.drawLine(2,3,2,18,colors.lightGray)
  91. paintutils.drawLine(50,3,50,18,colors.lightGray)
  92. paintutils.drawLine(50,18,2,18,colors.lightGray)
  93. paintutils.drawLine(50,3,2,3,colors.lightGray)
  94. --draw next and previos buttons
  95. term.setBackgroundColor(colors.orange)
  96. term.setTextColor(colors.black)
  97. term.setCursorPos(50,ty)
  98. write">"
  99. term.setCursorPos(2,ty)
  100. write"<"
  101. term.setBackgroundColor(colors.green)
  102. term.setTextColor(colors.black)
  103. cPrint(ty,"DOWNLOAD!")
  104. term.setBackgroundColor(colors.gray)
  105. term.setTextColor(colors.orange)
  106. end
  107. local function appPrint(t)
  108. local _,y=term.getCursorPos()
  109. term.setCursorPos(3,y)
  110. print(t)
  111. end
  112. local function handleSapphari()
  113. cPrint(4,"Sapphari:")
  114. print()
  115. print()
  116. appPrint(" Sapphari is a web browser for CC. ")
  117. appPrint(" Sapphari has everything you'd expect-- ")
  118. appPrint(" Tabs, bookmarks, site switching, etc. ")
  119. appPrint(" Welcome to the internet! ")
  120. cPrint(11,"Current version: 1.0")
  121.  
  122. end
  123. local function handlePokeCCLevelEditor()
  124.  
  125. cPrint(4,"PokeCC Level Editor:")
  126. cPrint(5,"Not out yet.")
  127.  
  128. end
  129. local function handlePokeCC()
  130. cPrint(4,"Note to users:")
  131. cPrint(5,"(this is temporry and will be removed when this space fills)just wanted everyone to know, that as of 1/11/2015 I'm working on Game-engine and will be releasing it soon-ish.")
  132.  
  133.  
  134.  
  135.  
  136. end
  137. local function handleGameengine()
  138. cPrint(4,"Game-Engine")
  139. cPrint(5,"Sample text, lens-flare!")
  140. cPrint(6,"See the post in general for info.")
  141. end
  142. local function handleOs()
  143. cPrint(4,"[os]")
  144. cPrint(5,"Sample text, lens-flare!")
  145. cPrint(6,"No info on this, in a nobody-will-find-this-beta!")
  146. end
  147. local function handleInstaller()
  148. --//first draw the UI
  149. --now pass it off to the current app to install handler
  150. if args[2] == "update" then--an app is calling this to update
  151. os.queueEvent("mouse_click",1,23,19)--fake click dl button
  152. end
  153. return handleWhichApp()
  154.  
  155. end
  156. function gDL(n)
  157. --load JSON
  158. pastePI("4nRg9CHU","json")
  159. local dir = shell.dir()
  160. -- Remove any previous versions in this directory
  161. fs.delete("/"..dir.."/Game-Engine")
  162. fs.delete("/"..dir.."/testgame")
  163. fs.makeDir("/"..dir.."/Game-Engine")
  164. pasteRun("6aMMzdwd",{"AI221", "Game-Engine", "master", "/"..dir.."/Game-Engine",})
  165. pasteGetAndSave("fU9Kj9zr","/"..dir.."/Game-Engine/redirect")
  166. os.loadAPI("/"..dir.."/Game-Engine/redirect")
  167. os.loadAPI("/"..dir.."/Game-Engine/game")
  168. --load the map
  169. local f=fs.open("/"..dir.."/Game-Engine/stOld","r")
  170. if f then
  171. local a=f.readAll()
  172. f.close()
  173. a=textutils.unserialize(a)
  174. --save
  175. game.save("/"..dir.."/secondTown",a)
  176. --delete stOld
  177. fs.delete("/"..dir.."/Game-Engine/stOld")
  178. else
  179. print"WARNIG - stOld missing"
  180. end
  181. --move testgame
  182. fs.move("/"..dir.."/Game-Engine/testgame","/"..dir.."testgame")
  183. if not n then
  184. local i=quitw()
  185. if i then
  186. term.setBackgroundColor(colors.black)
  187. term.setTextColor(colors.yellow)
  188. term.clear()
  189. term.setCursorPos(1,1)
  190. print(os.version())
  191. return i
  192. end
  193. end
  194. end
  195. args = {...}
  196. function handleWhichApp()
  197. while true do--don't feel like reindenting
  198. drawInsUI()
  199. --local currentApp={}
  200. if not args[1] then
  201. args[1]=1
  202. else
  203. args[1]=tonumber(args[1])
  204. end
  205. if args[1] == 1 then
  206. handleSapphari()
  207. elseif args[1] == 2 then
  208. --currentApp[2] ="handlePokeCCLevelEditor"
  209. handlePokeCC()
  210. elseif args[1]==3 then
  211. --currentApp[3]="handlePokeCC"
  212. handlePokeCCLevelEditor()
  213. elseif args[1]==4 then
  214. handleGameengine()
  215. elseif args[1]==5 then
  216. handleOs()
  217.  
  218. end
  219. local evt,type,x,y=os.pullEvent()
  220. if evt=='mouse_click'then
  221. if y==ty then
  222. if x==2 then
  223. if args[1]>1 then
  224. args[1]=args[1]-1
  225. end
  226. elseif x==50 then
  227. if args[1]<5 then
  228. args[1]=args[1]+1
  229. end
  230. elseif x>20 and x<30 then
  231. term.setBackgroundColor(colors.green)
  232. term.setTextColor(colors.black)
  233. cPrint(19,"DLing... ")
  234. --dlbutton
  235. if args[1]==1 then
  236. --sapph dl
  237. if not fs.exists("sapphInt") then
  238. fs.makeDir("sapphInt")
  239. end
  240. fs.delete"sapphInt/startup"
  241. fs.delete"sapphInt/sapphUtils"
  242. fs.delete"sapphInt/redirect"
  243. pGetNDL('fJ409KH1','sapphInt/startup')
  244. pGetNDL("fU9Kj9zr","sapphInt/redirect")
  245. pGetNDL("hyNPyhQZ","sapphInt/sapphUtils")
  246. local ff=fs.open("sapphInt/sapphBookmarks","w")
  247. local bo = {}
  248. bo[1] = "Add Bookmark"
  249. ff.writeLine(textutils.serialize(bo))
  250. ff.close()
  251. --make a shortcut to sapphari
  252. ff=fs.open("Sapphari","w")
  253. ff.writeLine('shell.run("sapphInt/startup")')
  254. ff.close()
  255. cPrint(ty,"DOWNLOAD!")
  256. local i=quitw()
  257. if i then
  258. term.setBackgroundColor(colors.black)
  259. term.setTextColor(colors.yellow)
  260. term.clear()
  261. term.setCursorPos(1,1)
  262. print(os.version())
  263. return i
  264. end
  265. elseif args[1]==2 then
  266. --pokecc dl
  267.  
  268. elseif args[1]==3 then
  269. --levels dl
  270.  
  271. elseif args[1]==4 then
  272. --game-engine dl
  273. gDL()
  274. elseif args[1]==5 then
  275. --[os] install
  276. gDL(true)
  277. fs.makeDir("/library")
  278. pasteRun("6aMMzdwd",{"AI221","-os-","master"})
  279. pasteGetAndSave("5CpA2rrQ","/library/nevardon")
  280. fs.makeDir"/library/acc"
  281. fs.makeDir"/library/acc/admin"
  282. local i=quitw()
  283. if i then
  284. term.setBackgroundColor(colors.black)
  285. term.setTextColor(colors.yellow)
  286. term.clear()
  287. term.setCursorPos(1,1)
  288. print(os.version())
  289. return i
  290. end
  291. end
  292. end
  293. end
  294. end
  295. end
  296. end--for the while loop.
  297.  
  298. function quitw()
  299. --check if updating via app
  300. if args[2]=="update" then
  301. term.setBackgroundColor(colors.black)
  302. term.clear()
  303. term.setCursorPos(1,1)
  304. return "update"--this tells the app it was sucsessful
  305. end
  306. --draw a prompt
  307. --we want this centered, so we'll use a trick'
  308. term.setBackgroundColor(colors.lightGray)
  309. term.setTextColor(colors.black)
  310. cPrint(9," Quit? ")
  311. term.setBackgroundColor(colors.orange)
  312. cPrint(10,"Do you want")
  313. cPrint(11,"to quit? ")
  314. --give the user the option
  315. term.setBackgroundColor(colors.orange)
  316. cPrint(12," Yes No ")
  317. --fix the mess-up
  318. term.setBackgroundColor(colors.orange)
  319. term.setCursorPos(20,12)
  320. write" "
  321. --we must do it manual now
  322. term.setCursorPos(25,12)
  323. write" "
  324. term.setCursorPos(29,12)
  325. print" "
  326.  
  327. --check for button press
  328. while true do
  329. local _,_,x,y=os.pullEvent()
  330. if y==12 then
  331. if x>21 and x<26 then
  332. return true
  333. elseif x>27 and x<30 then
  334. return false
  335. end
  336. end
  337. end
  338. end
  339. --if they're on a smaller screen we can't show them our fancy UI.
  340. local x,y=term.getSize()
  341. if x == 51 then else
  342. args[2]="update"
  343. end
  344. if y==19 then else--or y==18 then else--for OSes with a menubar, fine. not sure how they'll dl, will get to that later probs
  345. args[2]="update"
  346. end
  347. return handleInstaller()
Advertisement
Add Comment
Please, Sign In to add comment