Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --license:
- --you are free to modify, distribute, and re-license this code. This license does not apply to things downloaded via this code.
- --here's an actually decent installer
- --made in LuaEdit
- --are theyrunning in a tabbed os?
- --[[
- This is Install Utils by Geforce Fan. It's found @ BvL9rr0N , please get it from there to be sure it's up to date.
- Just paste it into your installer!
- ]]
- function pasteRun(id,aa)
- if not type(id)=="string" then
- return "Must has string!"
- end
- --get program off pastebin
- local a=http.get("http://www.pastebin.com/raw.php?i="..id)
- if not a then return false end
- a=a.readAll()
- if not a then return false end
- local env = {}
- a=loadstring(a)
- if not a then return false end
- local env= setmetatable({},{__index=_G})
- setfenv(a,env)
- local ok,err=pcall(a,unpack(aa))
- --a()
- if (not ok) and err then
- printError("Error running "..id..": "..err)
- return false
- end
- return err,env
- end
- function pastePI(id,tab)
- local returned,env = pasteRun(id)
- _G[tab] = env
- end
- function pasteGet(id)
- if not type(id)=="string" then
- return "Must has string!"
- end
- --get program off pastebin
- local a=http.get("http://www.pastebin.com/raw.php?i="..id)
- if not a then return false end
- a=a.readAll()
- if not a then return false end
- return a
- end
- function pasteGetAndSave(url,loc)
- local a=pasteGet(url)
- --write it
- local b = fs.open(loc,"w")
- if b then
- b.write(a)
- b.close()
- return true
- end
- return false
- end
- --This is the end of installutils. The rest is this person's installer.
- local _,ty=term.getSize()
- local tabbed = true
- if ty == 18 then
- tabbed=true
- end
- pGetNDL= pasteGetAndSave
- local function cPrint(y,text)
- --centerprinttext
- local h=term.getSize()
- h=(h-#text)/2
- term.setCursorPos(h,y)
- write(text)
- end
- local function drawInsUI()
- term.setBackgroundColor(colors.gray)
- term.clear()
- term.setBackgroundColor(colors.orange)
- term.setTextColor(colors.black)
- term.setCursorPos(1,1)
- print(" ")
- cPrint(1,"LimitlessBox V2")
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.orange)
- --make a box where the info will be displayed
- paintutils.drawLine(2,3,2,18,colors.lightGray)
- paintutils.drawLine(50,3,50,18,colors.lightGray)
- paintutils.drawLine(50,18,2,18,colors.lightGray)
- paintutils.drawLine(50,3,2,3,colors.lightGray)
- --draw next and previos buttons
- term.setBackgroundColor(colors.orange)
- term.setTextColor(colors.black)
- term.setCursorPos(50,ty)
- write">"
- term.setCursorPos(2,ty)
- write"<"
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.black)
- cPrint(ty,"DOWNLOAD!")
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.orange)
- end
- local function appPrint(t)
- local _,y=term.getCursorPos()
- term.setCursorPos(3,y)
- print(t)
- end
- local function handleSapphari()
- cPrint(4,"Sapphari:")
- print()
- print()
- appPrint(" Sapphari is a web browser for CC. ")
- appPrint(" Sapphari has everything you'd expect-- ")
- appPrint(" Tabs, bookmarks, site switching, etc. ")
- appPrint(" Welcome to the internet! ")
- cPrint(11,"Current version: 1.0")
- end
- local function handlePokeCCLevelEditor()
- cPrint(4,"PokeCC Level Editor:")
- cPrint(5,"Not out yet.")
- end
- local function handlePokeCC()
- cPrint(4,"Note to users:")
- 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.")
- end
- local function handleGameengine()
- cPrint(4,"Game-Engine")
- cPrint(5,"Sample text, lens-flare!")
- cPrint(6,"See the post in general for info.")
- end
- local function handleOs()
- cPrint(4,"[os]")
- cPrint(5,"Sample text, lens-flare!")
- cPrint(6,"No info on this, in a nobody-will-find-this-beta!")
- end
- local function handleInstaller()
- --//first draw the UI
- --now pass it off to the current app to install handler
- if args[2] == "update" then--an app is calling this to update
- os.queueEvent("mouse_click",1,23,19)--fake click dl button
- end
- return handleWhichApp()
- end
- args = {...}
- function handleWhichApp()
- while true do--don't feel like reindenting
- drawInsUI()
- --local currentApp={}
- if not args[1] then
- args[1]=1
- else
- args[1]=tonumber(args[1])
- end
- if args[1] == 1 then
- handleSapphari()
- elseif args[1] == 2 then
- --currentApp[2] ="handlePokeCCLevelEditor"
- handlePokeCC()
- elseif args[1]==3 then
- --currentApp[3]="handlePokeCC"
- handlePokeCCLevelEditor()
- elseif args[1]==4 then
- handleGameengine()
- elseif args[1]==5 then
- handleOs()
- end
- local evt,type,x,y=os.pullEvent()
- if evt=='mouse_click'then
- if y==ty then
- if x==2 then
- if args[1]>1 then
- args[1]=args[1]-1
- end
- elseif x==50 then
- if args[1]<3 then
- args[1]=args[1]+1
- end
- elseif x>20 and x<30 then
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.black)
- cPrint(19,"DLing... ")
- --dlbutton
- if args[1]==1 then
- --sapph dl
- if not fs.exists("sapphInt") then
- fs.makeDir("sapphInt")
- end
- fs.delete"sapphInt/startup"
- fs.delete"sapphInt/sapphUtils"
- fs.delete"sapphInt/redirect"
- pGetNDL('fJ409KH1','sapphInt/startup')
- pGetNDL("fU9Kj9zr","sapphInt/redirect")
- pGetNDL("hyNPyhQZ","sapphInt/sapphUtils")
- local ff=fs.open("sapphInt/sapphBookmarks","w")
- local bo = {}
- bo[1] = "Add Bookmark"
- ff.writeLine(textutils.serialize(bo))
- ff.close()
- --make a shortcut to sapphari
- ff=fs.open("Sapphari","w")
- ff.writeLine('shell.run("sapphInt/startup")')
- ff.close()
- cPrint(ty,"DOWNLOAD!")
- local i=quitw()
- if i then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.yellow)
- term.clear()
- term.setCursorPos(1,1)
- print(os.version())
- return i
- end
- elseif args[1]==2 then
- --pokecc dl
- elseif args[1]==3 then
- --levels dl
- elseif args[1]==4 then
- end
- end
- end
- end
- end
- end--for the while loop.
- function quitw()
- --check if updating via app
- if args[2]=="update" then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- return "update"--this tells the app it was sucsessful
- end
- --draw a prompt
- --we want this centered, so we'll use a trick'
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- cPrint(9," Quit? ")
- term.setBackgroundColor(colors.orange)
- cPrint(10,"Do you want")
- cPrint(11,"to quit? ")
- --give the user the option
- term.setBackgroundColor(colors.orange)
- cPrint(12," Yes No ")
- --fix the mess-up
- term.setBackgroundColor(colors.orange)
- term.setCursorPos(20,12)
- write" "
- --we must do it manual now
- term.setCursorPos(25,12)
- write" "
- term.setCursorPos(29,12)
- print" "
- --check for button press
- while true do
- local _,_,x,y=os.pullEvent()
- if y==12 then
- if x>21 and x<26 then
- return true
- elseif x>27 and x<30 then
- return false
- end
- end
- end
- end
- --if they're on a smaller screen we can't show them our fancy UI.
- local x,y=term.getSize()
- if x == 51 then else
- args[2]="update"
- end
- 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
- args[2]="update"
- end
- return handleInstaller()
Advertisement
Add Comment
Please, Sign In to add comment