Draw (Program): Difference between revisions
Appearance
Rezizdigus (talk | contribs) No edit summary |
Rezizdigus (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
[[File:TLS AD Monkey Business.png|thumb|Image Drawn using the Draw Program]] | [[File:TLS AD Monkey Business.png|thumb|Image Drawn using the Draw Program]] | ||
'''Draw''' is a custom ComputerCraft program used to display table image information (for example from the Paint program) on an Advanced Monitor. | '''Draw''' is a custom ComputerCraft program used to display table image information (for example from the Paint program) on an Advanced Monitor. | ||
== How to use == | |||
Once you have drawn your image, simply copy the program (or rewrite it from this page) onto the computer and then simply follow this syntax: | |||
<code>draw <monitorSide> <pathToImage> <scale></code> | |||
{| class="wikitable" | |||
|+ | |||
!Argument | |||
!Description | |||
!Required | |||
|- | |||
|monitorSide | |||
|The side where the monitor is relative to the computer | |||
''(left, right, top, bottom, back, front)'' | |||
|Yes | |||
|- | |||
|pathToImage | |||
|The path to an image on the computer | |||
|Yes | |||
|- | |||
|scale | |||
|The scale of the image. Must be an increment of 0.5 | |||
''(min: 0.5, max: 5)'' | |||
|Yes | |||
|} | |||
After drawing your image make sure to create a <code>startup</code> script inside the main director of the computer with the following code: | |||
{{Code|shell.run("draw", "<monitorSide>", "<pathToImage>", "<scale>")|lang=lua}} | |||
This will ensure the computer will always redraw the image when it's rebooted. Make sure to replace the values with yours. | |||
== Lua Code == | == Lua Code == | ||
Revision as of 11:46, 17 May 2026

Draw is a custom ComputerCraft program used to display table image information (for example from the Paint program) on an Advanced Monitor.
How to use
Once you have drawn your image, simply copy the program (or rewrite it from this page) onto the computer and then simply follow this syntax:
draw <monitorSide> <pathToImage> <scale>
| Argument | Description | Required |
|---|---|---|
| monitorSide | The side where the monitor is relative to the computer
(left, right, top, bottom, back, front) |
Yes |
| pathToImage | The path to an image on the computer | Yes |
| scale | The scale of the image. Must be an increment of 0.5
(min: 0.5, max: 5) |
Yes |
After drawing your image make sure to create a startup script inside the main director of the computer with the following code:
shell.run("draw", "<monitorSide>", "<pathToImage>", "<scale>")
This will ensure the computer will always redraw the image when it's rebooted. Make sure to replace the values with yours.
Lua Code
local defaultTerm = term.native
local function printUsage()
print("draw <monitorSide> <pathToImage> <scale>")
end
local tArgs = { ... }
if #tArgs < 3 then
printUsage()
return
end
local monitor = peripheral.wrap(tArgs[1])
local image = paintutils.loadImage(tArgs[2])
local function draw()
term.redirect(monitor)
if image then
term.setBackgroundColor(colors.white)
monitor.setTextScale(tonumber(tArgs[3]))
term.clear()
paintutils.drawImage(image, 1, 1)
else
print("Image not found")
end
term.redirect(defaultTerm)
end
draw()