Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function getCol(char)
- local convert = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!£$%^&*()_+-=[];'#,/<>?:@~{}|\\`¬"..'"'.."%."
- local index = 1
- for i=1,string.len(convert) do if convert:sub(i, i) == char then index = i end end
- local oind = index
- while index > 16 do index = index - 16 end
- if index <= 0 then index = 1 end
- if index < 1 then index = 1 elseif index > 16 then index = 16 end
- return 2 ^ (index-1), oind
- end
- local function visualData(data)
- local tempdat = data
- local cols = {}
- local cur = 1
- local dif = 1
- while string.len(tempdat) > 0 do
- local unused, index = getCol(tempdat:sub(cur, cur))
- local col, ind = getCol(tempdat:sub(index, index))
- cols[#cols + 1] = col
- local bef = tempdat:sub(1, index-1)
- local aft = tempdat:sub(index+1, -1)
- if bef ~= nil then tempdat = bef else tempdat = "" end
- if aft ~= nil then tempdat = tempdat..aft end
- if cur >= string.len(tempdat) then
- cur = string.len(tempdat)
- dir = -1
- elseif cur <= 0 then
- cur = 1
- dir = 1
- end
- cur = cur + dif
- end
- local w,h = term.getSize()
- local curn = 1
- local tick = 1
- for x=1,w do
- for y=1,h do
- local n, unused = getCol(data:sub(curn, curn))
- local xy = x + y + n
- while xy > #cols do xy = xy - #cols end
- if xy <= 0 then xy = 1 end
- local col = cols[xy]
- term.setCursorPos(x, y)
- term.setBackgroundColor(col)
- term.write(" ")
- curn = curn + 1
- if curn > string.len(data) then curn = 1 end
- tick = tick + 1
- if tick > 50 then
- tick = 0
- sleep(0)
- end
- end
- end
- end
- local stuff = {...}
- local dat = ""
- for i=1,#stuff do if dat == "" then dat = stuff[i] else dat = dat.." "..stuff[i] end end
- visualData(dat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement