Guest User

prnt

a guest
Oct 25th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. --Printing Program/API by LDShadowLord
  2. --Function Descriptions:
  3. --Prepare: Setup function
  4. --GetCP  : Finds the Cursor Pos
  5. --Print  : Whadda ya think?
  6. --Extra  : nullVoid
  7.  
  8. --Setting Variables
  9. ver = 1.1
  10. side = "right"
  11. cons = 1
  12. 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()
  23.   vx, vy = p.getCursorPos()
  24. end
  25.  
  26. local function inc()
  27.   getCP()
  28.   cons = vy + 1
  29.   if cons == 20 then
  30.     p.setCursorPos(1,21)
  31.     p.write("     PRNT API // V1.1")
  32.     p.endPage()
  33.     p.newPage()
  34.     p.setPageTitle(tostring(kons))
  35.     kons = kons + 1
  36.   end
  37. end
  38.  
  39. --[[Temps
  40. function run()
  41.   prepare()
  42.   vw, vh = p.getPageSize()
  43.   print(vw..":"..vh)
  44. end
  45. ]]
  46.  
  47. --Global Functions
  48. function setup()
  49.   prepare()
  50.   getCP()
  51. end
  52.  
  53. function title(name)
  54.   p.setPageTitle(name)
  55. end
  56.  
  57. function pprint(text)
  58.   p.write(text)
  59.   inc()
  60.   p.setCursorPos(1,cons)
  61. end
  62.  
  63. function endmain()
  64.   p.setCursorPos(1,19)
  65.   inc()
  66.   p.endPage()
  67. end
Advertisement
Add Comment
Please, Sign In to add comment