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

.nfp viewer? nfp as startup

Started by CiclopeBizco, 18 January 2017 - 05:08 AM
CiclopeBizco #1
Posted 18 January 2017 - 06:08 AM
hi guys

i dont know (and didnt find) how to show a npf file on a monitor.
im looking for a program (startup) that shows the nfp file a monitor… i use the NPaintPro to create them…i guess that these files from npaintpro are for 1 5x3 monitor.

it would be also interesting to have like screensaver from nfp files

thanks :)/>
Edited on 19 January 2017 - 03:57 AM
Lupus590 #2
Posted 18 January 2017 - 09:59 AM
Program requests typically don't get far, but helping people make programs is usually productive.

I would start by looking at the render code for NPaintPro.
Edited on 18 January 2017 - 09:00 AM
Bomb Bloke #3
Posted 18 January 2017 - 10:00 AM
NFP files share the same format as regular CC Paint files. You should be able to load and view them via the paintutils API.

Eg:

term.redirect( peripheral.find("monitor") )  -- Redirect terminal output to the first found monitor.

paintutils.drawImage( paintutils.loadImage( "yourNFPfile.nfp" ), 1, 1 )  -- Draw image on the current terminal.
CiclopeBizco #4
Posted 19 January 2017 - 04:14 AM
NFP files share the same format as regular CC Paint files. You should be able to load and view them via the paintutils API.

Eg:

term.redirect( peripheral.find("monitor") )  -- Redirect terminal output to the first found monitor.

paintutils.drawImage( paintutils.loadImage( "yourNFPfile.nfp" ), 1, 1 )  -- Draw image on the current terminal.



thanks!


i couldnt make it work -facepalm-,…but i kept looking posts here, and could make something that works

term.redirect( peripheral.find("monitor") )
bground = paintutils.loadImage("FILENAME.nfp")
    paintutils.drawImage(bground,1,1)

:)/>



now im trying to make a gif,,,,,show image1.npf, then image2.npf …
my knowlage from programing is <0 :)/>
i tried this xd
  • term.redirect( peripheral.find("monitor") )
  • while true do
  • bground = paintutils.loadImage("mando.nfp")
  • paintutils.drawImage(bground,1,1)
  • wait(2)
  • bground = paintutils.loadImage("mando2.nfp")
  • paintutils.drawImage(bground,1,1)
  • end




and i have look this in the nyan cat animation xd


  • while true do
  • local e, t = os.pullEvent("timer")
  • if t == timer then
  • return
  • end



idk :)/> i have to reseatch more :)/>


thanks
Bomb Bloke #5
Posted 19 January 2017 - 10:42 AM
Well of course, the really easy way to show a GIF is:

if not fs.exists( "package" ) then shell.run( "pastebin get cUYTGbpb package" ) end
if not fs.exists( "GIF" ) then shell.run( "pastebin get 5uk9uRjC GIF" ) end

os.loadAPI( "package" )
os.loadAPI( "GIF" )

GIF.animateGIF( GIF.loadGIF( "yourGIF.gif" ), 1, 1, peripheral.find( "monitor", function(side, ob) ob.setTextScale(0.5) return ob.isColour() end ) )

… but if you specifically wanted to work with NFP files, you might do something like:

local images = {paintutils.loadImage("frame1.nfp"), paintutils.loadImage("frame2.nfp"), etc}

while true do
	for i = 1, #images do
		paintutils.drawImage(images[i], 1, 1)
		sleep(0.5)
	end
end