Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version = 1.8
- --History:
- --Load GIF MONITOR Computercraft
- --This is testing version
- --1.8 - fixed problem delete gifurl.gif (error reboot) 2.1.2020
- --Plan:
- -- create list gifs
- -- create menu for stop program
- ---------
- --Source:
- ---------
- --http://www.computercraft.info/forums2/index.php?/topic/23056-gif-api/
- --Resize your GIF: https://ezgif.com/resize
- ----------
- --Contact:
- ----------
- --Author: ScherryCZ - scherry@email.cz
- --Language: English, Czech
- --WWW: https://mineworldcc.blogspot.com/
- function Start()
- shell.run("delete gifurl.gif")
- if fs.exists("perna.st") then
- print(fs.exists("perna.st"))
- if fs.exists("perna.st") then
- loadGif()
- else
- print("Default GIF not exist. You paste URL GIF. Thx.")
- end
- end
- write("Load new GIF? y/n: ")
- local newgif = read()
- write("Pernamently GIF on reboot? y/n: ")
- local gif_perna = read()
- if gif_perna == "y" then
- local h = fs.open("perna.st", "w")
- h.write("perna")
- h.close()
- print("Program set pernament work.")
- shell.run("delete gifurl.gif")
- end
- if newgif == "y" then
- Newgifs()
- end
- if newgif == "n" then
- print(fs.exists("gifurl_local.gif"))
- if fs.exists("gifurl_local.gif") then
- loadGif()
- else
- print("Default GIF not exist.")
- Start()
- end
- end
- print("This command is bad. You please write y or n.")
- Start()
- end
- function Newgifs()
- print("IF URL = BLANK (THEN START WITH LAST IMAGE.")
- write("URL GIF and PRESS ENTER: ")
- local gifurl = read()
- print("Your URL: "..gifurl)
- print("... Please WAIT.. GIF IMAGE CONVERSION IN PROCESS...")
- finalurl = "bbpack mount "..gifurl.." gifurl.gif"
- print(finalurl)
- shell.run("pastebin get BMYUSgfV GIF")
- shell.run("pastebin get Tk0UG8fm bbpack")
- --LOAD GIF ON DISK from URL
- -- load gif (only one gif on root!)
- shell.run(finalurl)
- print("Deleting default GIF...")
- shell.run("delete gifurl_local.gif")
- shell.run("copy gifurl.gif gifurl_local.gif")
- print("GIF IMAGE CONVERSION IN PROCESS FOR BIG IMAGES ... Please WAIT ...")
- print("PRESS CTRL + T = Terminate program")
- print("And write REBOOT for START program.")
- loadGif()
- end
- function loadGif()
- print("LOADADING GIF...")
- os.loadAPI("GIF")
- local mon = peripheral.find("monitor")
- local gifs = fs.find("*.gif") -- Note: fs.find() is case-sensitive, even if your file system isn't.
- mon.setTextScale(0.5)
- local x, y = mon.getSize()
- while true do for i = 1, #gifs do
- local image = GIF.loadGIF(gifs[i])
- mon.setBackgroundColour(image[1].transparentCol or image.backgroundCol)
- mon.clear()
- GIF.animateGIF(image, math.floor((x - image.width) / 2) + 1, math.floor((y - image.height) / 2) + 1, mon)
- print(a)
- end
- end
- function Update()
- --------------------------------------------------------------------------------------------
- --FUNCTION FOR UPDATE
- --------------------------------------------------------------------------------------------
- print("ERROR UPDATE...")
- end
- end
- ----------------------------------------------------------------------
- --START
- ----------------------------------------------------------------------
- Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement