SHOW:
|
|
- or go back to the newest paste.
1 | --this function will print the text in the centre of the current line of the monitor connected on the specified side | |
2 | - | local side = "bottom" |
2 | + | local side = "left" |
3 | local monitorprintcentred = function(text, side) | |
4 | local monitor = peripheral.wrap(side) | |
5 | local maxw, maxh = monitor.getSize() --screen dimensions | |
6 | local curx, cury = monitor.getCursorPos() --cursor pos | |
7 | ||
8 | monitor.setCursorPos((maxw-#text)/2,cury) --set it to the point where write will make the text centred | |
9 | monitor.write(text) --write the text | |
10 | monitor.setCursorPos(curx,cury+1) --return the cursor to the same position on the next line | |
11 | end | |
12 | ||
13 | local maxw, maxh =monitor.getSize() --screen dimensions | |
14 | monitor.setCursorPos(1,math.floor(maxh/2))--set cursor to the start of the upper middle line | |
15 | ||
16 | monitor.setTextColor(colors.red) | |
17 | - | monitorprintcentred("Air Lock 1","left")--print centred on that line |
17 | + | monitorprintcentred("1")--print centred on that line |
18 | ||
19 | monitor.setTextColor(colors.green) | |
20 | monitorprintcentred("E Quarry")--print centred on that line |