SHOW:
|
|
- or go back to the newest paste.
| 1 | -- locals | |
| 2 | local logs = {}
| |
| 3 | - | local openTime = 5 |
| 3 | + | local openTime = 30 |
| 4 | local textSize = 1 | |
| 5 | local minimumNameLength = 4 | |
| 6 | local buttonPadding = 1 --Min 1, Space before/after | |
| 7 | local centerPadding = 0 --Min 0, Space before/after | |
| 8 | ||
| 9 | local buttonColor = colors.lightGray | |
| 10 | local buttonActiveColor = colors.orange | |
| 11 | local pageBack = "Prev Page" | |
| 12 | local pageFore = "Next Page" | |
| 13 | local resetButton = "Refresh" | |
| 14 | -- Hub Portals | |
| 15 | - | local portals = {
|
| 15 | + | |
| 16 | --internal | |
| 17 | - | { name="Nether"; address="Dehsetcro Migomcor Ormpra" },
|
| 17 | + | |
| 18 | - | { name="DS7"; address="Sileston Alsetbrei Lanulf" },
|
| 18 | + | |
| 19 | - | { name="Rapture"; address="Sileston Amecar Othgon"},
|
| 19 | + | |
| 20 | - | { name="Spawn"; address="Sileston Protaset Erpulf"},
|
| 20 | + | |
| 21 | - | { name="Reign"; address="Sileston Setusar Erporm"}
|
| 21 | + | |
| 22 | - | } |
| 22 | + | |
| 23 | local monMidR = 0 | |
| 24 | - | --local portals = {
|
| 24 | + | |
| 25 | - | -- { name="Hub"; address="Dehsetcro Migomcor Ormpra" }
|
| 25 | + | |
| 26 | - | --} |
| 26 | + | |
| 27 | local curPage = 1 | |
| 28 | local lastPage = 1 | |
| 29 | local namesPerPage = 1 | |
| 30 | local pages = {}
| |
| 31 | local gateType = 'Abstract Bus Adapter' | |
| 32 | ||
| 33 | ||
| 34 | function writeLog(text) | |
| 35 | print(text) | |
| 36 | end | |
| 37 | ||
| 38 | if not fs.exists('apis/json') then
| |
| 39 | writeLog("You don't have the JSON API. Grabboring it.")
| |
| 40 | shell.run("pastebin get 4nRg9CHU apis/json")
| |
| 41 | end | |
| 42 | os.loadAPI('apis/json')
| |
| 43 | ||
| 44 | monitorLocation = findSideFor('monitor')
| |
| 45 | monitor = peripheral.wrap(monitorLocation) | |
| 46 | gate = peripheral.find(gateType) | |
| 47 | ||
| 48 | end | |
| 49 | ||
| 50 | - | function init() |
| 50 | + | |
| 51 | - | if not fs.exists('apis') then
|
| 51 | + | |
| 52 | - | fs.makeDir('apis')
|
| 52 | + | |
| 53 | writeLog('----')
| |
| 54 | - | if not fs.exists('apis/touchpoint') then
|
| 54 | + | |
| 55 | - | writeLog("You don't have the touchpoint API. Beaming it down.")
|
| 55 | + | |
| 56 | - | shell.run('pastebin get pFHeia96 apis/touchpoint')
|
| 56 | + | |
| 57 | return result | |
| 58 | - | os.loadAPI('apis/touchpoint')
|
| 58 | + | |
| 59 | ||
| 60 | function closeGate() | |
| 61 | writeLog("Force closing the gate.")
| |
| 62 | result = gate.sendPacket("FFFF", "action: disconnect")
| |
| 63 | writeLog("Gate told to close. Result: "..result)
| |
| 64 | end | |
| 65 | ||
| 66 | ||
| 67 | function findSideFor(typeToFind) | |
| 68 | local sides = peripheral.getNames() | |
| 69 | for i, side in ipairs(sides) do | |
| 70 | local type = peripheral.getType(side) | |
| 71 | - | setupScreen() |
| 71 | + | |
| 72 | return(side) | |
| 73 | end | |
| 74 | - | function handleMonitorResize() |
| 74 | + | |
| 75 | - | writeLog("Screen resized. Setting up screen!")
|
| 75 | + | |
| 76 | - | setupScreen() |
| 76 | + | |
| 77 | ||
| 78 | init() | |
| 79 | ||
| 80 | if not problem then | |
| 81 | - | function determineLength(myString) |
| 81 | + | |
| 82 | - | local theLength = 0 |
| 82 | + | |
| 83 | - | if string.len(myString) > maxNameLength then |
| 83 | + | dialGate("Coronat Protaac Ormet")
|
| 84 | - | theLength = maxNameLength + buttonPadding * 2 |
| 84 | + | -- dialGate("Dehsetcro Migomcor Ormpra")
|
| 85 | - | else |
| 85 | + | |
| 86 | - | theLength = string.len(myString) + buttonPadding * 2 |
| 86 | + | |
| 87 | end |