Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- essentia reader computer FSM--
- os.loadAPI("button")
- os.loadAPI("melStart")
- m = peripheral.find("monitor")
- p = peripheral.find("EssentiaProvider")
- local x,y,z,v
- local n,a
- local colorsToUse = {colors.green,colors.blue,colors.brown}
- local colorTracker, collumnTracker, rowTracker
- local rowOffset, collumnOffset, collumnOffset2, rowLimit, collumnLimit
- --Set up some important 'local' globals (srsly lua?)
- collumnOffset = 18
- collumnOffset2 = 13 --Used for variable
- rowOffset = 1
- collumnLimit = 3
- rowLimit = 13
- n = -1
- a = 0
- x = 1
- y = 0
- z = y
- lineblank = ""
- aspectNum = 48
- function aspectTable()
- eTable = {p.getAspects()}
- end
- function aspectDis()
- --Reset trackers
- colorTracker = 0
- collumnTracker = 0
- rowTracker = 0
- --Do out first setup
- --m.setTextColor(colorsToUse[colorTracker])
- for i=1,96,2 do
- --Check if the table value is not nil
- if(eTable[i] == nil) then break end
- --Position the cursor
- m.setCursorPos(1+(collumnOffset*collumnTracker), 1+(rowOffset*rowTracker))
- m.write(eTable[i])
- m.setCursorPos(collumnOffset2+(collumnOffset*collumnTracker), 1+(rowOffset*rowTracker))
- m.write(":" .. eTable[i+1])
- --Bump down a row
- rowTracker = rowTracker + 1
- --If rowTracker is equal to rowLimit,
- --reset and bump collumnTracker
- if(rowTracker == rowLimit) then
- rowTracker = 0
- collumnTracker = collumnTracker + 1
- --Also set the colorTracker
- colorTracker = colorTracker + 10
- --m.setTextColor(colorsToUse[colorTracker])
- end
- end
- end
- function clearLine()
- throwaway,line = m.getCursorPos()
- m.write(lineblank)
- m.setCursorPos(1,line)
- end
- melStart.startup()
- termx,termy = m.getSize()
- for i = 1,termy do
- lineblank = lineblank.." "
- end
- m.setBackgroundColor(colors.purple)
- m.setTextColor(colors.black)
- m.setTextScale(1.5)
- while true do
- m.clear()
- aspectTable()
- aspectDis()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement