Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setCursorBlink(false)
- local message = {
- "Welcome",
- "to",
- "LDDestroier's",
- "Personal",
- "Download Site!",
- }
- local spinner = {
- "|",
- "/",
- "-",
- "\\",
- }
- local spinPoint = 1
- local normalColor = colors.gray
- local normalTextColor = colors.white
- local backgroundFlashes = {
- colors.lightGray,
- colors.white,
- colors.black,
- colors.white,
- colors.lightGray,
- }
- term.setTextColor(normalTextColor)
- term.setBackgroundColor(normalColor)
- term.clear()
- local scr_x, scr_y = term.getSize()
- local midPoint = {
- scr_x / 2,
- scr_y / 2,
- }
- local spinSpeed = 1
- local function megaBackground(depth)
- for b = 1, math.ceil(depth) do
- term.setCursorPos(1,math.ceil(b))
- if b == math.ceil(depth) then
- term.setBackgroundColor(colors.black)
- else
- term.setBackgroundColor(colors.blue)
- end
- term.clearLine()
- end
- for b = 1, math.floor(depth) do
- term.setCursorPos(1,math.floor(scr_y-(b-1)))
- if b == math.floor(depth) then
- term.setBackgroundColor(colors.black)
- else
- term.setBackgroundColor(colors.blue)
- end
- term.clearLine()
- end
- end
- local function writeMessages(quick)
- if not quick then
- for a = 1, math.floor(midPoint[1]-(#message[1]/2)) do
- for c = 1, spinSpeed do
- spinPoint = spinPoint + 1
- if spinPoint > #spinner then
- spinPoint = 1
- end
- term.setCursorPos(a,math.floor(midPoint[2]-(#message/2))+1)
- term.clearLine()
- write(spinner[spinPoint])
- sleep(0)
- end
- end
- end
- totalLength = 0
- progress = 0
- for a = 1, #message do
- totalLength = totalLength + #message[a]
- end
- for a = 1, #message do
- if not quick then
- for b = 1, #message[a] do
- progress = progress + 1
- megaBackground(math.ceil((progress/totalLength)*(midPoint[2]-(#message/2)-1)))
- term.setBackgroundColor(normalColor)
- term.setTextColor(colors.orange)
- term.setCursorPos(midPoint[1]-(#message[a])/2,math.floor(midPoint[2]-(#message/2)+a))
- term.clearLine()
- write(string.sub(message[a], 1, b))
- term.setBackgroundColor(normalColor)
- term.setTextColor(normalTextColor)
- for c = 1, spinSpeed do
- spinPoint = spinPoint + 1
- if spinPoint > #spinner then
- spinPoint = 1
- end
- if b < #message[a] then
- term.setCursorPos((midPoint[1]-(string.len(message[a])/2))+b,math.floor(midPoint[2]-(#message/2)+a))
- write(spinner[spinPoint])
- sleep(0)
- end
- end
- end
- sleep(0.03)
- else
- term.setCursorPos(midPoint[1]-(string.len(message[a])/2),math.floor(midPoint[2]-(#message/2)+a))
- term.setTextColor(colors.orange)
- term.setBackgroundColor(normalColor)
- term.clearLine()
- write(message[a])
- end
- end
- end
- local function flashScreen()
- for a = 1, 2 do
- term.setBackgroundColor(colors.white)
- term.clear()
- sleep(0.1)
- term.setBackgroundColor(colors.black)
- term.clear()
- sleep(0.1)
- end
- return true
- end
- local function exitAnimation()
- term.setBackgroundColor(colors.black)
- term.clear()
- exitMessage = "Goodbye!"
- for a = 1, midPoint[2]-3 do
- megaBackground(a)
- term.setCursorPos(math.floor((scr_x-a)/1.4)+2,midPoint[2])
- term.clearLine()
- write(exitMessage)
- sleep(0.1)
- end
- sleep(0.6)
- term.setCursorPos(1,scr_y)
- return
- end
- writeMessages(false)
- sleep(0.6)
- for a = 1, #backgroundFlashes do
- term.setBackgroundColor(backgroundFlashes[a])
- term.clear()
- writeMessages(true)
- sleep(0.1)
- end
- --Time to make it look normal, and not have the background the last in backgroundFlashes
- term.setBackgroundColor(normalColor)
- term.clear()
- megaBackground(math.ceil((midPoint[2]-(#message/2)-1)))
- writeMessages(true)
- sleep(0.5)
- for a = 1, scr_y-2 do
- term.scroll(1)
- term.setCursorPos(1,scr_y)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- term.clearLine()
- sleep(0.1)
- end
- local commandNames = {
- " (1) Download Map ",
- " (2) Download On ",
- " (3) Download Monc ",
- " (4) Download STD",
- " (X) Exit ",
- }
- local fadeInColors = {
- colors.lightBlue,
- colors.lightGray,
- colors.black,
- }
- for a = 1, #fadeInColors+1 do
- if a > #fadeInColors then
- term.setTextColor(colors.white)
- else
- term.setTextColor(fadeInColors[a])
- end
- for b = 1, #commandNames do
- term.setCursorPos(math.floor(midPoint[2]-(#commandNames/2)),b+3)
- term.clearLine()
- term.setBackgroundColor(colors.gray)
- print(commandNames[b])
- term.setBackgroundColor(colors.blue)
- print("")
- end
- sleep(0.04)
- end
- local function downloadMap()
- term.setBackgroundColor(normalColor)
- term.clear()
- megaBackground(midPoint[2]-3)
- term.setCursorPos(3,midPoint[2])
- write("Downloading Map...")
- local downloadFile = http.get("http://pastebin.com/raw.php?i=x9ajKSc0").readAll()
- local file = fs.open("/map", "w")
- file.write(downloadFile)
- file.close()
- write("complete!")
- sleep(0.2)
- for a = 1, 4 do
- megaBackground(midPoint[2]-3+a)
- end
- term.setCursorPos(4,midPoint[2]+1)
- term.setTextColor(colors.white)
- print("Press a key to exit!")
- sleep(0)
- os.pullEvent("key")
- flashScreen()
- return
- end
- local function downloadOn()
- term.setBackgroundColor(normalColor)
- term.clear()
- megaBackground(midPoint[2]-3)
- term.setCursorPos(3,midPoint[2])
- write("Downloading On...")
- local downloadFile = http.get("http://pastebin.com/raw.php?i=W4GLNE39").readAll()
- local file = fs.open("/on", "w")
- file.write(downloadFile)
- file.close()
- write("complete!")
- sleep(0.2)
- for a = 1, 4 do
- megaBackground(midPoint[2]-3+a)
- end
- term.setCursorPos(4,midPoint[2]+1)
- term.setTextColor(colors.white)
- print("Press a key to exit!")
- sleep(0)
- os.pullEvent("key")
- flashScreen()
- return
- end
- local function downloadMonc()
- term.setBackgroundColor(normalColor)
- term.clear()
- megaBackground(midPoint[2]-3)
- term.setCursorPos(3,midPoint[2])
- write("Downloading Monc...")
- local downloadFile = http.get("http://pastebin.com/raw.php?i=FRJRneKL").readAll()
- local file = fs.open("monc", "w")
- file.write(downloadFile)
- file.close()
- write("complete!")
- sleep(0.2)
- for a = 1, 4 do
- megaBackground(midPoint[2]-3+a)
- end
- term.setCursorPos(4,midPoint[2]+1)
- term.setTextColor(colors.white)
- print("Press a key to exit!")
- sleep(0)
- os.pullEvent("key")
- flashScreen()
- return
- end
- local function downloadSTD()
- term.setBackgroundColor(normalColor)
- term.clear()
- megaBackground(midPoint[2]-3)
- term.setCursorPos(3,midPoint[2])
- write("Downloading STD...")
- local downloadFile = http.get("http://pastebin.com/raw.php?i=3PBKGR4k").readAll()
- local file = fs.open("std", "w")
- file.write(downloadFile)
- file.close()
- write("complete!")
- sleep(0.2)
- for a = 1, 4 do
- megaBackground(midPoint[2]-3+a)
- end
- term.setCursorPos(4,midPoint[2]+1)
- term.setTextColor(colors.white)
- print("Press a key to exit!")
- sleep(0)
- os.pullEvent("key")
- flashScreen()
- return
- end
- local curX, curY = term.getCursorPos()
- term.setCursorPos(4,curY)
- local curX, curY = term.getCursorPos()
- while true do
- sleep(0)
- -- event, key = os.pullEvent("key")
- -- key = tostring(keys.getName(key))
- term.setCursorPos(curX,curY)
- term.clearLine()
- write(">")
- local _,key
- repeat
- _,key = os.pullEvent("char")
- until string.find("1234x",key)
- if key == "1" then
- flashScreen()
- downloadMap()
- exitAnimation()
- return
- end
- if key == "2" then
- flashScreen()
- downloadOn()
- exitAnimation()
- return
- end
- if key == "3" then
- flashScreen()
- downloadMonc()
- exitAnimation()
- return
- end
- if key == "4" then
- flashScreen()
- downloadSTD()
- exitAnimation()
- return
- end
- if key == "x" then
- flashScreen()
- exitAnimation()
- return
- end
- end
- error("did not expect to get here...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement