Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- installation: pastebin run qExuNAUg
- -- installing: NhUI v0.5 (for Basic and Advanced PCs/Monitors) [CraftOS 1.7 compatibility confirmed]
- -- info: This is a UI program-set to be used in ComputerCraft, a mod for Minecraft which adds programmable computers
- -- add something that mentions when another program of the same name exists
- local nhver="v0.5"
- local nhuiProgs={["startup"]="CjD8TqJb",["desktop"]="JUhsDLDd",[".nhuicfg"]="mbD7EU2J"}
- local nhuiProgList={"startup","desktop","updater","login",".nhuicfg"}
- local function anyKey()
- sleep(.2)
- local event,b,x,y=os.pullEventRaw()
- if (event=="key" and b~=0) or (event=="mouse_click" and x>0 and y>0) then anyKey=nil end
- end
- term.clear() term.setCursorPos(1,1)
- print("You have initiated the NhUI ("..nhver..") installer. Installing NhUI will remove the following programs:\n")
- print("startup login\ndesktop .nhuicfg\nupdater")
- print("\nIf you wish to rename any programs, cancel the installation and do so before continuing.\n")
- local x,y=term.getCursorPos()
- local ans=nil
- repeat
- term.setCursorPos(x,y) term.clearLine()
- term.write("Would you like to install NhUI <y/n>? ")
- local input=read()
- if input=="y" then ans=true
- elseif input=="n" then print("\n@NhUI installation was canceled.\n@Press any key to continue.")
- anyKey() os.reboot()
- else print("\nPlease enter 'y' or 'n'.") end
- until ans==true
- if ans==true then print("\nWaiting for pastebin.com...") end
- while ans do
- http.request("http://pastebin.com/")
- local event=os.pullEvent()
- if event=="http_failure" then print("...could not connect.\n\n@NhUI installation was canceled.\n@Press any key to continue.")
- anyKey() os.reboot()
- elseif event=="http_success" then print("...connection successful.\n\nClearing paths...")
- for i=1, #nhuiProgList-1 do fs.delete(nhuiProgList[i]) end
- print("...paths cleared.\n\nFetching files...")
- shell.run("pastebin get",nhuiProgs["startup"],"startup")
- shell.run("pastebin get",nhuiProgs["desktop"],"desktop")
- if not fs.exists(".nhuicfg") then shell.run("pastebin get",nhuiProgs[".nhuicfg"],".nhuicfg") end
- if fs.exists("startup") and fs.exists("desktop") and fs.exists(".nhuicfg") then
- print("...programs fetched.\n\n@NhUI "..nhver.." installed successfully.\n@Press any key to continue.")
- anyKey() os.reboot()
- else error("ERROR: Program(s) failed to download likely due to a connection issue. You may attempt to re-run the installer.") end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement