Skip to main content

How to use Multidisplays

ScrapComputers has a multidisplay system, however it can be quite complicated on how to use them. This guide would help you how to use them.

Notes

When me mean grids like 5x3 or 4x4, we mean like the first number being the amount of displays horizontally and the second number being the amount of displays vertically.

So a 4x4 grid would be this:

[(1,1)(2,1)(3,1)(4,1)(1,2)(2,2)(3,2)(4,2)(1,3)(2,3)(3,3)(4,3)(1,4)(2,4)(3,4)(4,4)]\begin{bmatrix} (1, 1) & (2, 1) & (3, 1) & (4, 1) \\ (1, 2) & (2, 2) & (3, 2) & (4, 2) \\ (1, 3) & (2, 3) & (3, 3) & (4, 3) \\ (1, 4) & (2, 4) & (3, 4) & (4, 4) \end{bmatrix}

Each coordinate being a display. 4 on the horizontal axis, 4 on the vertical axis. Hence a 4x4 grid of displays.

Placing the displays & Connecting them

We first have to place our displays, you have to choose 1 display size & 1 display resolution. Multi-display's do not support variant resolutions and using multiple display sizes would make it look weird.

In a perfect world, you can just connect the displays to the computer, write some code and it would work automaticly however we don't live in that world since that would complicated things alot and making the multi-displays draw pixels on to the screen already takes a chunk of math so we wil have to connect them in a order.

The order is left to right, top to bottom. Meaning if you let's say have a 4x4 grid of displays, your order of connecting them should be this:

Mapping Function:f(i,j)=(j1)rows+i\text{Mapping Function:} \quad f(i, j) = (j - 1) \cdot \text{rows} + iDisplay GridConversionOutput Order[(1,1)(2,1)(3,1)(4,1)(1,2)(2,2)(3,2)(4,2)(1,3)(2,3)(3,3)(4,3)(1,4)(2,4)(3,4)(4,4)][f(1,1)f(2,1)f(3,1)f(4,1)f(1,2)f(2,2)f(3,2)f(4,2)f(1,3)f(2,3)f(3,3)f(4,3)f(1,4)f(2,4)f(3,4)f(4,4)][12345678910111213141516]\begin{array}{c c c c c} \text{Display Grid} & & \text{Conversion} & & \text{Output Order} \\ \begin{bmatrix} (1,1) & (2,1) & (3,1) & (4,1) \\ (1,2) & (2,2) & (3,2) & (4,2) \\ (1,3) & (2,3) & (3,3) & (4,3) \\ (1,4) & (2,4) & (3,4) & (4,4) \end{bmatrix} & \longrightarrow & \begin{bmatrix} f(1,1) & f(2,1) & f(3,1) & f(4,1) \\ f(1,2) & f(2,2) & f(3,2) & f(4,2) \\ f(1,3) & f(2,3) & f(3,3) & f(4,3) \\ f(1,4) & f(2,4) & f(3,4) & f(4,4) \end{bmatrix} & \longrightarrow & \begin{bmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \\ 9 & 10 & 11 & 12 \\ 13 & 14 & 15 & 16 \end{bmatrix} \end{array}
note

Multi-displays only work in display grids that are rectangles or squares, shapes like circles, triangles and etc don't work with multi-displays

Writing the code for it

We now have to write a literal line of code to make this work. get the amount of displays on the horizontal and vertical axis and put them here.

Formula

local display = sc.multidisplay.new( sc.getDisplays(), columns, rows )

For a 4x4, 5x3 & a 2x8. It would look like this:

--- 4x4
local display = sc.multidisplay.new( sc.getDisplays(), 4, 4 )

--- 5x3
local display = sc.multidisplay.new( sc.getDisplays(), 5, 3 )

--- 2x8
local display = sc.multidisplay.new( sc.getDisplays(), 2, 8 )

After this, you can use the display table like a normal display, you can now use the multi-display in your project