Jump to content

Draw (Program): Difference between revisions

From Tekkit Lite Server
No edit summary
mNo edit summary
 
Line 2: Line 2:
'''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 ==
== Usage ==
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:
Once you have drawn your image, simply copy the program (or rewrite it from this page) onto the computer and then follow this syntax:


<code>draw <monitorSide> <pathToImage> <scale></code>
<code>draw <monitorSide> <pathToImage> <scale></code>

Latest revision as of 16:44, 17 May 2026

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.

Usage

Once you have drawn your image, simply copy the program (or rewrite it from this page) onto the computer and then 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()