Okay here you are.
--Setting the colors
term.setBackgroundColor(colors.white)
term.setTextColor(colors.cyan)
term.clear()
term.setCursorPos(1,1)
loading = "yes"
local installing = true
--Functions
local function centerPrint(text)
local x, y = term.getSize()
local x2, y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x/2) -(text:len()/2)), y2)
write(text)
term.setCursorPos(1,1)
end
local function load(yLoc)
w, h = term.getSize()
local x2, y2 = term.getCursorPos()
loc = math.ceil(w/2)
loc2 = yLoc
while loading == "yes" do
term.setCursorPos(loc-3, loc2)
print("|----|")
sleep(0.5)
term.setCursorPos(loc-3, loc2)
print("|O---|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|-O--|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|--O-|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|---O|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|--O-|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|-O--|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|O---|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
return
end
end
function downloadFiles()
w, h = term.getSize()
term.setCursorPos(1, h-1)
if fs.exists("/RedOS") then
fs.delete("/RedOS")
end
shell.run("pastebin", "get", "5U3kbqWp", "RedOS")
term.clearLine()
term.setCursorPos(1, 10)
term.clearLine()
term.setCursorPos(1, 11)
term.clearLine()
term.setCursorPos(1, h-1)
term.clearLine()
sleep(5)
installing = false
loading = "no"
end
--Main Code
centerPrint("RedOS Installer")
term.setCursorPos(1, 4)
centerPrint("Installing Files....")
parallel.waitForAny(downloadFiles, function() load(9) end)
term.clear()
centerPrint("Installed!")
sleep(2)
term.setCursorPos(1,1)
term.setBackgroundColor(colors.black)
term.clear()
It's the downloadFiles() function that is "flickering."