This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Jahmaican's profile picture

Screensaver

Started by Jahmaican, 19 September 2012 - 04:36 PM
Jahmaican #1
Posted 19 September 2012 - 06:36 PM
Hi! Today I made a quite fancy screensaver that slowly fills down the screen with random characters, creating an impression of melting snow or whatever. For some people it might resemble Matrix, although it wasn't my intention and I don't even like the movies :)/>/>

http://pastebin.com/raUv6Pap

Ideas of using are obvious - you might modify it to lock a computer with password and even add some kind of watchdog on startup that would make it behave like real screensaver (e.g showing after 5 min idle). Both easy to code.
GalactusX #2
Posted 20 September 2012 - 05:31 AM
simply amazing, but … an implementation would be possible to run it on a monitor?
GalactusX #3
Posted 20 September 2012 - 05:49 AM
I love your show, could you give me permission to translate and implement it on the server I play (I have friends with the owner of the server XD)
KaoS #4
Posted 20 September 2012 - 08:17 AM
Great code there, I use a blatant rip off of the matrix but I love it

Spoiler


local size={term.getSize()}
local tPixels={}
for x=1,size[1]-1 do
tPixels[x]={}
for y=1,size[2] do
tPixels[x][y]=' '
end
end

local function render()
term.clear()
term.setCursorPos(1,1)
for y=1,#tPixels[1] do
if y~=1 then
print('')
end
for x=1,#tPixels do
write(tPixels[x][y])
end
end
end

local function cycle()
for x=1,#tPixels do
for y=#tPixels[x],2,-1 do
tPixels[x][y]=(tPixels[x][y-1]==' ' and ' ') or ((tPixels[x][y]~=' ' and tPixels[x][y]) or string.char(math.random(32,126)))
end
--[[for x=1,#tPixels do
local intC=nil
for y=2,5 do
if tPixels[x][y]==' ' then
intC=true
end
end
if not intC then
tPixels[x][1]=' '
end
end]]
end
end

local function create()
tPixels[math.random(1,#tPixels)][1]=string.char(math.random(32,126))
tPixels[math.random(1,#tPixels)][1]=' '
tPixels[math.random(1,#tPixels)][1]=' '
end

local bRunning=true
while bRunning do
cycle()
create()
render()
    local timer=os.startTimer(.1)
while true do
local sEvent, param = os.pullEvent()
if (sEvent=='timer' and param==timer) then
break
elseif sEvent=='key' then
bRunning=nil
break
end
end
end
Jahmaican #5
Posted 20 September 2012 - 01:49 PM
I love your show, could you give me permission to translate and implement it on the server I play (I have friends with the owner of the server XD)
Feel free to use it any way you like.
Novicode #6
Posted 21 September 2012 - 02:15 AM
simply amazing, but … an implementation would be possible to run it on a monitor?

Does this answer your question? :)/>/>




You can get the program using the built in pastebin program by typing "pasebin get raUv6Pap screensaver"
Then run it on a monitor with "monitor [side] screensaver" replace [side] with what side the monitor is on. Don't keep the [] though.

@Jahmaican Great program! I'll probably find something to use this for :D/>/>