LDShadowLord

MonitorMain

Oct 18th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Function Descriptions:
  3. wrapMon : Wraps a monitor on the specified side
  4. clear   : Clears the monitor and resets the text
  5. print   : Writes the text and then goes to the next line (Bit buggy right now)
  6. ]]
  7.  
  8. --Local Functions
  9. local function getMonStats()
  10.   monw,monh = apimon.getSize()
  11. end
  12.  
  13. local function getMyStats()
  14.   myx,myy = apimon.getCursorPos()
  15. end
  16.  
  17. local function inc()
  18.   local vx, vy = p.getCursorPos()
  19.   local vw, vh = p.getPageSize()
  20.   cons = vy + 1
  21.   ram = vh - 1
  22.   if cons == ram then
  23.     cons = 1
  24.   end
  25. end
  26.  
  27. --Testing Functions  (Remove before release)
  28. local function test()
  29.   getMonStats()
  30.   print(monw.." : "..monh)
  31.   getMyStats()
  32.   print(myx.." : "..myy)
  33. end
  34.  
  35. --Public Functions
  36. function wrapMon(side)
  37.   apimon = peripheral.wrap(side)
  38.   getMyStats()
  39.   getMonStats()
  40. end
  41.  
  42. function clear()
  43.   apimon.clear()
  44.   apimon.setCursorPos(1,1)
  45. end
  46.  
  47. function print(text)
  48.   apimon.write(text)
  49.   inc()
  50.   p.setCursorPos(1,cons)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment