Jump to content

Draw (Program)

From Tekkit Lite Server
Revision as of 11:40, 17 May 2026 by Rezizdigus (talk | contribs)
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.

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()