Jump to content




Printer peripheral API: Makes everything fit inside the page easily


  • You cannot reply to this topic
No replies to this topic

#1 Yarillo

  • Members
  • 81 posts
  • LocationFrance

Posted 25 October 2015 - 05:48 PM

pastebin get qnGSLZW6 printingAPI

What it does:
Attempts to make the printing (on paper) of all the things easier.

If you use it normally:
It will basically add two functions,
- printFile(fileName)
- printBook(largeText)
These functions will:
- Take care of the length of each line it prints so that everything fits on the page properly
- Check if the printer's tray is full (and wait for it to empty a bit)
- Check if the printer has ink and paper (and wait for it to be supplied)

If you use it in a crafty turtle:
I don't recommend that you don't use this API on a crafty turtle. I mean, it works well, I wouldn't have implemented it if it didn't, but I obviously made that feature to suit my personnal needs and it' not very user friendly.
If you decide to use a turtle anyway, the API works very differently.
- It implements everything stated above, except...
- It will attempt to autocraft books (and try to use a minimal amount of strings when stitching the pages together).

What could I do with it ?
You could, for instance, download some plain text from the internet, put it on pastebin, and turn it into a book ingame. Yep.
I'm currently building a library containing 6528 books worth of badly written Minecraft fanfictions :D/>/>/>/>

How do I use it ?
Either like this:
-- Beginning of your code
os.loadAPI("printingAPI")
--
-- Your own code here
--
printingAPI.printFile("fileName")

Or copy the whole thing at the beginning of your code and use the functions like so:
printFile("fileName")

Edited by Yarillo, 30 October 2015 - 01:45 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users