1 posts
Posted 05 August 2016 - 08:53 PM
How can I make my painted program display on computer startup?
How could I draw my paint onto my monitors on startup? Like naming a program startup.
8543 posts
Posted 05 August 2016 - 10:26 PM
This question was originally two posts, and was split from
here.
2427 posts
Location
UK
Posted 05 August 2016 - 11:08 PM
run something on a monitor: mon <side> <program> <arguments> <for> <program>
as for running on startup: create a startup file and edit it to include: shell.run("<program to run>", "<arguments>", "<for>", "<program>")
21 posts
Posted 05 August 2016 - 11:57 PM
You can put this script in a startup file:
local monitor = peripheral.wrap("<monitor side>")
local image = paintutils.loadImage("<path to image>")
term.redirect(monitor)
paintutils.drawImage(image, 1, 1) --or change 1,1 to the image location
--Optional, to return text output to computer
term.redirect(term.native())
Replace <monitor side> with the side your monitor is on/its id (ex: "monitor_1");
replace <path to image> with the path to the image you want to show.
7083 posts
Location
Tasmania (AU)
Posted 06 August 2016 - 02:31 AM
Regarding the use of
term.native() - advanced computers run a tab-based system called
multishell, which puts each shell instance in a separate
window. When you finish dealing with your monitor, if you redirect a given tab back to the native terminal, then that tab may not function correctly within multishell anymore.
term.redirect() returns the old terminal object, so to redirect to a new terminal and back again you can do:
local oldTerm = term.redirect(monitor)
term.redirect(oldTerm)
Granted, most users have no need to worry about breaking multishell or similar, but it's a more "robust" way of doing things.
On the flip side, if you want better performance from graphical-intensive scripts (and don't care about multishell compatibility at all) you can just redirect them to term.native() from the word go. The window objects multishell assigns them only slows them down.