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

Problems with Paintutils.drawImage!

Started by Endergreen117, 27 November 2014 - 05:21 PM
Endergreen117 #1
Posted 27 November 2014 - 06:21 PM
Right now I'm working on an OS for cc, and I want to include a dock similar to what Pear OS offers. I've written the following code to draw the icons onto the dock and it keeps returning an error.


function loadDockIcons ()
local pnt = paintutils.loadImage ("/Falchion/Res/Prg/paint.nfp")
local qst = paintutils.loadImage ("/Falchion/Res/Prg/quest.nfp")
local ink = paintutils.loadImage ("/Falchion/Res/Prg/ink.nfp")
paintutils.drawImage (pnt, 5, 17)
paintutils.drawImage (ink, 10, 17)
paintutils.drawImage (qst, 15, 17)

^ That's the Function I call to draw the icons, but after it is called it returns the following eror:


gui.FSA:38: Expected image, x, y

Also, line 38 is "paintutils.drawImage (ink, 10, 17)"
Edited on 27 November 2014 - 06:34 PM
Exerro #2
Posted 27 November 2014 - 06:26 PM
Err, paintutils.draw( pnt, 5, 17 ) and paintutils.draw( qst, 15, 17 ) of course :P/> That's what you named the variables.

Ah, line 38 is the ink one eh, make sure the file is loaded correctly, that's probably the problem. (If the file doesn't exist I'm pretty sure paintutils.loadImage() will return nil)
Edited on 27 November 2014 - 05:28 PM
Endergreen117 #3
Posted 27 November 2014 - 07:35 PM
Err, paintutils.draw( pnt, 5, 17 ) and paintutils.draw( qst, 15, 17 ) of course :P/> That's what you named the variables.

Ah, line 38 is the ink one eh, make sure the file is loaded correctly, that's probably the problem. (If the file doesn't exist I'm pretty sure paintutils.loadImage() will return nil)

Fixed the mismatched variables, still gives an error. Also what do you mean by "loaded correctly"?

EDIT: I switched the positions of line 38 and line 39 and now it says the error is on line 39, which of course is where "ink" is drawn. So, I thought that either "/Falchion/Res/Prg/ink.nfp" doesn't exist, I have a syntax error, or there is an error in the formatting of ink.nfp. "ink.nfp" just happens to be the only icon that I made using Paint, the rest I made using Sketch. I will try and find out if that's the problem.

EDIT: I am an idiot. ink.nfp does not exist. I accidentally made two "paint.nfp"s instead.
Edited on 27 November 2014 - 06:44 PM