Jump to content




Load Image on Monitor


  • You cannot reply to this topic
5 replies to this topic

#1 gametechish

  • Members
  • 47 posts

Posted 18 March 2015 - 12:42 AM

My program always spits the error
startup:5:attempt to call nil path
Here is the code:
logo = paintutils.loadImage("logo")
m = peripheral.wrap("monitor_0")
m.clear()
m.setCursorPos(1,1)
m.drawImage(logo,1,1)
and here is the image:
    eeeeeee   eeeeee    2222222	 e	   e
   e	   e  e	 e  2	   2    ee	  e
   e		  e	 e	  e	 2  e e	 e
   e		  e	 e		   22  e  e    e
    eeeeeee   eeeeee	   e	    e   e   e
		   e  e	  22    e	    e    e  e
		   e  e	  2	 e	    e	 e e
   e	   e  e	    2	   2    e	  ee
    eeeeeee   e		 2222222	 e	   e


#2 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 18 March 2015 - 01:00 AM

As far as I know, there is no drawImage for monitors, perhaps you meant paintutils.drawImage

#3 gametechish

  • Members
  • 47 posts

Posted 18 March 2015 - 01:12 AM

I have tried that it failed

#4 Zambonie

  • Members
  • 477 posts
  • LocationSpring Hill, Fl

Posted 18 March 2015 - 01:19 AM

You can term.redirect to the monitor, but other then that no there isn't a method, unless someone makes a simple function that can do it, it shouldn't be really that hard.

I'll hop on a server quickly and code it, ill post a pastebin link to such a function ina sec. I'm bored.

Edited by Zambonie, 18 March 2015 - 01:20 AM.


#5 Zambonie

  • Members
  • 477 posts
  • LocationSpring Hill, Fl

Posted 18 March 2015 - 01:35 AM

pastebin get MLHxfiZ5 drawmon

^draw image on monitor api

example of using it:

os.loadAPI("drawmon") --load the API
local m = peripheral.wrap("left") --or somewhere else
local image = paintutils.loadImage("/potato") --The Image to load
drawmon.drawImage(m, image, 2, 2) --draws my potato image at 2,2, supply the name of the monitor as the first parameter. in this case, m.

so bassicly in your own code it would look like this:
os.loadAPI("drawmon")
logo = paintutils.loadImage("logo")
m = peripheral.wrap("monitor_0")
m.clear()
m.setCursorPos(1,1)
drawmon.drawImage(m, logo, 1, 1)

Edited by Zambonie, 18 March 2015 - 01:36 AM.


#6 gametechish

  • Members
  • 47 posts

Posted 18 March 2015 - 01:47 AM

OMG thank you that works flawlessly you should post that on the forums





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users