SHOW:
|
|
- or go back to the newest paste.
| 1 | --Printing Program/API by LDShadowLord | |
| 2 | --Function Descriptions: | |
| 3 | --Prepare: Setup function | |
| 4 | --GetCP : Finds the Cursor Pos | |
| 5 | - | --Print : Whadda ya think? |
| 5 | + | --(L,C,R) Print : print Left, Print Center, Print Right |
| 6 | --Extra : nullVoid | |
| 7 | ||
| 8 | --Setting Variables | |
| 9 | - | ver = 1.1 |
| 9 | + | local ver = 1.1 |
| 10 | - | side = "right" |
| 10 | + | local side = "right" |
| 11 | - | cons = 1 |
| 11 | + | local cons = 1 |
| 12 | - | kons = 1 |
| 12 | + | local kons = 1 |
| 13 | ||
| 14 | --Local Functions | |
| 15 | local function prepare() | |
| 16 | p = peripheral.wrap(side) | |
| 17 | p.newPage() | |
| 18 | p.setPageTitle(tostring(kons)) | |
| 19 | kons = kons + 1 | |
| 20 | end | |
| 21 | ||
| 22 | - | local function getCP() |
| 22 | + | |
| 23 | - | vx, vy = p.getCursorPos() |
| 23 | + | local vx, vy = p.getCursorPos() |
| 24 | local vw, vh = p.getPageSize() | |
| 25 | cons = vy + 1 | |
| 26 | if cons == 20 then | |
| 27 | - | getCP() |
| 27 | + | |
| 28 | p.write(" PRNT API // V1.1")
| |
| 29 | p.endPage() | |
| 30 | p.newPage() | |
| 31 | cons = 1 | |
| 32 | p.setPageTitle(tostring(kons)) | |
| 33 | kons = kons + 1 | |
| 34 | end | |
| 35 | end | |
| 36 | ||
| 37 | --Global Functions | |
| 38 | function setup() | |
| 39 | - | --[[Temps |
| 39 | + | |
| 40 | - | function run() |
| 40 | + | local vx, vy = p.getCursorPos() |
| 41 | local vw, vh = p.getPageSize() | |
| 42 | - | vw, vh = p.getPageSize() |
| 42 | + | |
| 43 | - | print(vw..":"..vh) |
| 43 | + | |
| 44 | function title(name) | |
| 45 | - | ]] |
| 45 | + | |
| 46 | end | |
| 47 | ||
| 48 | function lPrint(text) | |
| 49 | p.write(text) | |
| 50 | - | getCP() |
| 50 | + | |
| 51 | p.setCursorPos(1,cons) | |
| 52 | end | |
| 53 | ||
| 54 | function cPrint(text) | |
| 55 | local vx, vy = p.getCursorPos() | |
| 56 | local vw, vh = p.getPageSize() | |
| 57 | - | function pprint(text) |
| 57 | + | vl = #text |
| 58 | myvx = (vw + 1) / 2 | |
| 59 | myvxx = math.ceil(myvx - (vl / 2)) | |
| 60 | term.setCursorPos(myvxx, cons) | |
| 61 | lPrint(text) | |
| 62 | end | |
| 63 | ||
| 64 | - | p.setCursorPos(1,19) |
| 64 | + | function rPrint(text) |
| 65 | local vx, vy = p.getCursorPos() | |
| 66 | local vw, vh = p.getPageSize() | |
| 67 | vl = #text | |
| 68 | myvx = 24 - vl | |
| 69 | term.setCursorPos(myvx, cons) | |
| 70 | lPrint(text) | |
| 71 | end | |
| 72 | ||
| 73 | function endmain() | |
| 74 | p.setCursorPos(1,21) | |
| 75 | p.write(" PRNT API // V1.1")
| |
| 76 | p.endPage() | |
| 77 | end |