Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function switchColors()
- local alphabet = {"a","b","c","d","e","f"}
- for i,v in pairs(colors) do
- if tonumber(v) then
- res = math.log(v)/math.log(2)
- if res > 9 then
- res = alphabet[res-9]
- end
- colors[i] = tostring(res)
- end
- end
- end
- function draw(str,xPos,yPos,txtcol,bakcol)
- local str = tostring(str) or ""
- local txtcol = txtcol or colors.white
- local bakcol = bakcol or colors.black
- if xPos and yPos then
- term.setCursorPos(xPos, yPos)
- end
- if term.blit then
- term.blit(str,string.rep(txtcol,#str),string.rep(bakcol,#str))
- else
- term.setBackgroundColor(bakcol)
- term.setTextColor(txtcol)
- term.write(str)
- end
- end
- if term.blit then
- switchColors()
- else
- os.loadAPI(shell.resolve("rom/apis/colors"))
- end
- while true do
- local events = {coroutine.yield()}
- term.clear()
- draw("EVENTS",1,1,colors.green)
- for i = 1,#events do
- draw(tostring(i).."."..tostring(events[i]),1,i+1,colors.yellow)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement