Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local data
- local readPos = 1
- local width
- local height
- local fps
- local tape = peripheral.find("tape_drive")
- function readByte()
- readPos = readPos + 1
- return string.byte(data, readPos-1)
- end
- function readShort()
- return readByte() * 256 + readByte()
- end
- --Code
- local page = http.get(args[1],{},true)
- data = page.readAll()
- page.close()
- if (tape ~= nil) then
- tape.seek(-1000000000)
- tape.play()
- end
- width = readShort()/2
- height = readShort()/3
- fps = readByte()
- while (readPos < #data) do
- local pSize = readByte()
- for i = 1, pSize do
- term.setPaletteColor(2^(i-1), colors.packRGB(readByte()/255, readByte()/255, readByte()/255))
- --readByte()
- --readByte()
- --readByte()
- end
- for y = 1, height, 1 do
- local text = ""
- local fg = ""
- local bg = ""
- for x = 1, width, 1 do
- text = text..string.char(readByte())
- fg = fg..string.format("%x",readByte())
- bg = bg..string.format("%x",readByte())
- end
- term.setCursorPos(1,y)
- term.blit(text,fg,bg)
- end
- sleep(1/fps)
- end
- sleep(2)
- tape.stop()
Add Comment
Please, Sign In to add comment