Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- print("A project by KidBrine")
- sleep(0.5)
- print("Contributors")
- sleep(0.5)
- print("#1 Luca_S")
- sleep(3)
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install BrineFormat? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/BrineFormat','w')
- NF.write(''
- ..'print("BrineFormat - By KidBrine")\n'
- ..'function TextBin(Concat,...)\n'
- ..' T = {...}\n'
- ..' if type(T[1]) == "table" then\n'
- ..' T = T[1]\n'
- ..' end\n'
- ..' Ret = {}\n'
- ..' for i = 1,#T do\n'
- ..' ch = string.byte(T[i])\n'
- ..' r = ""\n'
- ..' local function chn(n)\n'
- ..' if ch >= n then\n'
- ..' ch = ch-n\n'
- ..' r = r..1\n'
- ..' else\n'
- ..' r = r..0\n'
- ..' end\n'
- ..' end\n'
- ..' chn(128) chn(64) chn(32) chn(16)\n'
- ..' chn(8) chn(4) chn(2) chn(1)\n'
- ..' chn = nil\n'
- ..' table.insert(Ret,r)\n'
- ..' end\n'
- ..' if Concat == true then\n'
- ..' NRET = ""\n'
- ..' for i = 1,#Ret do\n'
- ..' NRET = NRET..Ret[i]\n'
- ..' end\n'
- ..' Ret = NRET\n'
- ..' end \n'
- ..' return Ret\n'
- ..'end\n'
- ..' \n'
- ..'function BinText(Concat,...)\n'
- ..' T = {...}\n'
- ..' if type(T[1]) == "table" then\n'
- ..' T = T[1]\n'
- ..' end\n'
- ..' Ret = {}\n'
- ..' for i = 1,#T do\n'
- ..' r = string.char(tonumber(T[i],2))\n'
- ..' table.insert(Ret,r)\n'
- ..' end\n'
- ..' if Concat == true then\n'
- ..' NRET = ""\n'
- ..' for i = 1,#Ret do\n'
- ..' NRET = NRET..Ret[i]\n'
- ..' end\n'
- ..' Ret = NRET\n'
- ..' end\n'
- ..' return Ret\n'
- ..'end\n'
- ..'\n'
- ..'function StrTbl(str,ChrSet)\n'
- ..' if type(str) ~= "string" then\n'
- ..' error("String expected, got "..type(str)..".", 2)\n'
- ..' end\n'
- ..' repeat\n'
- ..' if string.len(str)/ChrSet ~= math.floor(string.len(str)/ChrSet) then\n'
- ..' str = str.." "\n'
- ..' end\n'
- ..' until string.len(str)/ChrSet == math.floor(string.len(str)/ChrSet)\n'
- ..' Length = string.len(str)\n'
- ..' Output = {}\n'
- ..' for i = 1,Length/ChrSet do\n'
- ..' NC = string.sub(str,1,ChrSet)\n'
- ..' str = string.sub(str,ChrSet+1,string.len(str))\n'
- ..' table.insert(Output,NC)\n'
- ..' end\n'
- ..' return Output\n'
- ..'end\n'
- ..'\n'
- ..'function TblStr(...)\n'
- ..' T = {...}\n'
- ..' Opt = ""\n'
- ..' for i = 1, #T do\n'
- ..' Opt = Opt..table.concat(T[i])\n'
- ..' end\n'
- ..' return Opt\n'
- ..'end\n'
- ..'\n'
- ..'function SwapVars(V1,V2)\n'
- ..' NV1 = V2\n'
- ..' NV2 = V1\n'
- ..' return NV1, NV2\n'
- ..'end\n'
- )
- NF.close()
- end
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install BrineMath? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/BrineMath','w')
- NF.write(''
- ..'print("BrineMath - By KidBrine")\n'
- ..'function Root(R,N)\n'
- ..' if type(N) ~= "number" or type(R) ~= "number" then\n'
- ..' error("Number Expected.",2)\n'
- ..' else\n'
- ..' N = N^(1/R)\n'
- ..' end\n'
- ..' return N\n'
- ..'end\n'
- ..'\n'
- ..'function CircArea(R)\n'
- ..' if type(R) ~= "number" then\n'
- ..' error("Number Expected.")\n'
- ..' else\n'
- ..' R = math.pi*R^2\n'
- ..' end\n'
- ..' return R\n'
- ..'end\n'
- ..'\n'
- ..'function Average(...)\n'
- ..' N = {...}\n'
- ..' for i = 1,#N do\n'
- ..' if type(N[i]) ~= "number" then\n'
- ..' error("Arguments Can Only Be Numbers.",2)\n'
- ..' break\n'
- ..' end\n'
- ..' end\n'
- ..' NN = 0\n'
- ..' for i = 1,#N do\n'
- ..' NN = NN+N[i]\n'
- ..' end\n'
- ..' N = NN/#N\n'
- ..' return N\n'
- ..'end\n'
- ..'\n'
- ..'function Circumference(R)\n'
- ..' if type(R) ~= "number" then\n'
- ..' error("Number Expected.")\n'
- ..' else\n'
- ..' R = 2*math.pi*R\n'
- ..' end\n'
- ..' return R\n'
- ..'end\n'
- ..'function InjectMath()\n'
- ..' math.Root = BrineMath.Root\n'
- ..' math.CircArea = BrineMath.CircArea \n'
- ..' math.Average = BrineMath.Average\n'
- ..' math.Circumference = BrineMath.Circumference\n'
- ..'end\n'
- ..'\n'
- ..'function ExtractMath()\n'
- ..' math.Root = nil\n'
- ..' math.CircArea = nil\n'
- ..' math.Average = nil\n'
- ..' math.Circumference = nil\n'
- ..'end\n'
- )
- NF.close()
- end
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install BrinePeripheral? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/BrinePeripheral','w')
- NF.write(''
- ..'function ListType(T)\n'
- ..' V1 = peripheral.getNames()\n'
- ..' R = {}\n'
- ..' for i = 1,#V1 do\n'
- ..' if peripheral.getType(V1[i]) == T then\n'
- ..' table.insert(R,peripheral.wrap(V1[i]))\n'
- ..' end\n'
- ..' end\n'
- ..' return R\n'
- ..'end\n'
- )
- NF.close()
- end
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install BrinePic? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/BrinePic','w')
- NF.write(''
- ..'print("BrinePic - By KidBrine")\n'
- ..'function Draw(I,x,y)\n'
- ..' if not fs.find(I) then\n'
- ..' error("Could Not Find Image.",2)\n'
- ..' end\n'
- ..' if x == nil or y == nil then\n'
- ..' x, y = term.getCursorPos()\n'
- ..' end\n'
- ..' I = paintutils.loadImage(I)\n'
- ..' paintutils.drawImage(I,x,y)\n'
- ..' term.setBackgroundColor(32768)\n'
- ..'end\n'
- ..'\n'
- ..'function CenterImage(I)\n'
- ..' Im = paintutils.loadImage(I)\n'
- ..' l,w = term.getSize()\n'
- ..' y = math.ceil((w-#Im)/2)+1\n'
- ..' cp1,cp2 = term.getCursorPos()\n'
- ..' x = math.ceil((l-#Im[1])/2)+1 \n'
- ..' Draw(I,x,y)\n'
- ..'end\n'
- )
- NF.close()
- end
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install BrineText? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/BrineText','w')
- NF.write(''
- ..'print("BrineText - By KidBrine")\n'
- ..'function WritePos(T,x,y)\n'
- ..' if type(T) ~= "string" then\n'
- ..' error("First Argument Must Be a String.",2)\n'
- ..' end\n'
- ..' if type(x) ~= "number" or type(y) ~= "number" then\n'
- ..' error("Second and Third Argument Must Be Numbers.",2)\n'
- ..' end\n'
- ..' ox, oy = term.getCursorPos()\n'
- ..' term.setCursorPos(x,y)\n'
- ..' term.write(T)\n'
- ..' term.setCursorPos(ox,oy)\n'
- ..'end\n'
- )
- NF.close()
- end
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install Contributors.txt? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/Contributors.txt','w')
- NF.write(''
- ..'--#1 Luca_S - "I would suggest using varargs for\n'
- ..'-- the average function."\n'
- )
- NF.close()
- end
- InstallDir = ...
- if InstallDir == nil then InstallDir = 'BrineUtil' end
- term.clear()
- term.setCursorPos(1,1)
- print('Do you wish to install LoadAPIS? (Y/N)')
- local x = read()
- if x == 'y' or x == 'Y' then
- local NF = fs.open(InstallDir..'/LoadAPIS','w')
- NF.write(''
- ..'BrineUtil = {}\n'
- ..'BrineUtil.InstallDir = "/"..fs.getDir(shell.getRunningProgram())\n'
- ..'local APIS = fs.list(BrineUtil.InstallDir)\n'
- ..'for i = 1,#APIS do\n'
- ..' if APIS[i] ~= "LoadAPIS" then\n'
- ..' os.loadAPI("/"..BrineUtil.InstallDir.."/"..APIS[i])\n'
- ..' end\n'
- ..'end\n'
- ..'\n'
- ..'-- BrineUtil functions\n'
- ..'function BrineUtil.Update()\n'
- ..' fs.delete(BrineUtil.InstallDir)\n'
- ..' shell.run("pastebin run t0aw2K2m "..BrineUtil.InstallDir)\n'
- ..' shell.run(BrineUtil.InstallDir.."/LoadAPIS")\n'
- ..'end\n'
- ..'\n'
- ..'function BrineUtil.Uninstall()\n'
- ..' print("Do you wish to uninstalll BrineUtil?(Yee Yee/Nay Nay)")\n'
- ..' if read() == "Yee Yee" then\n'
- ..' fs.delete(BrineUtil.InstallDir)\n'
- ..' print("To finish uninstalling BrineUtil you must reboot.")\n'
- ..' print("Do you wish to reboot now?(Yee Yee/Nay Nay)")\n'
- ..' if read() == "Yee Yee" then\n'
- ..' os.reboot()\n'
- ..' end\n'
- ..' end\n'
- ..'end\n'
- ..'\n'
- ..'function BrineUtil.VersionCheck()\n'
- ..' print("BrineUtil: Ver 5.4")\n'
- ..' print("BrineMath: Ver 4.2")\n'
- ..' print("BrineFormat: Ver 2.6")\n'
- ..' print("BrineText: Ver 4.0")\n'
- ..' print("BrinePic: Ver 1.0")\n'
- ..'end\n'
- )
- NF.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment