Posted 05 May 2014 - 11:11 PM
Just a simple printing program I made.
For use with people who want to write something and don't want to print it out like this:
n. and I like pie.So, just to be safe I made this.
[Features]
Ink Detection.
Automatically starts a new page when it is full.
Stops you from writing the page like above.
[Notes]
* The number after the sentence of "You must enter a max of 25 characters:" is how many characters was entered.
* The title check for nil is buggy, But the rest of the program still works. :D/>
* Does not have color yet
[Plans]
* Fix the nil bug
* Add some color
* If possible, Try to make the program more lighter.
[Pictures]
[attachment=1635:2014-05-06_15.39.52.png]
The Editor
[attachment=1636:2014-05-06_15.40.08.png]
The Result
[attachment=1637:2014-05-06_15.40.18.png]FAQ:
A. Look up.
Q. This program is copyright!
A. How am I supposed to know that and what kind of person puts
copyright on a printer program… (No Offense)
Q. This program has a bug.
A. Post the bug and I will try and fix it.
Q. This program sucks.
A. I said it was simple. Plus it is for certain people who don't know
how big a page really is.
Q. How do you install it?
A. pastebin get sZKRNNKF Printer
Q. Printer:42: attempt to index ? ( a nil value )
A. Now, how are you gonna print a piece of paper without a printer?
Q. Printer:36: Page not Started
A. Now, how are you gonna print a piece of paper without a piece of paper?!?!?!?Before you ask any of these Questions, look at the FAQ.
For use with people who want to write something and don't want to print it out like this:
Spoiler
Hello, My name is John. and I like pie.
Spoiler
--[[
Printer Program by
cptdeath58
--]]
local pSide = "left" -- change "left" to whatever side the printer is on.
local tCursor = "2"
function testSize()
local px , py = printer.getCursorPos()
local tx , ty = term.getCursorPos()
if px > 25 then
write( "You must enter a max of 25 characters:" )
write( px )
printer.setCursorPos(1,py)
printer.write(" ")
term.setCursorPos(1,ty + 1)
printer.setCursorPos(1,py - 1)
elseif py > 21 then
printer.newPage()
printer.setCursorPos( 1,2 )
setPrinter()
end
end
function setPrinter()
while true do
term.clear()
term.setCursorPos(1,1)
term.write( "Please input Title: " )
local title = read()
if title == nil then
term.setCursorPos(1,2)
term.write( "You must enter a Title!" )
sleep(1)
setPrinter()
else
printer.newPage()
printer.setPageTitle( title )
break
end
end
end
function testInk()
local ink = printer.getInkLevel()
if ink < 1 then
repeat
term.clear()
sleep(1)
term.setCursorPos( 1,1 )
term.write( "Please Insert Ink!" )
sleep(1)
startPrinter()
until ink > 1
end
end
function startPrinter()
printer = peripheral.wrap( pSide)
testInk()
setPrinter()
term.clear()
term.setCursorPos(1,1)
term.write( "Input the Text you want to print." )
term.setCursorPos(1,2)
term.write( "To start a new page, type 'new page'." )
term.setCursorPos(1,3)
term.write( "To end, enter 'quit'." )
term.setCursorPos( 1,4 )
term.write( "To Erase last line, type 'erase'." )
term.setCursorPos ( 1,5 )
printer.setCursorPos(1,2)
while true do
local input = read()
if input == "quit" then
printer.endPage()
term.clear()
term.setCursorPos(5,1)
write( "Thank you for using the Printer Program" )
term.setCursorPos(15,2)
write( "By cptdeath58" )
term.setCursorPos(1,3)
break
elseif input == "new page" then
printer.endPage()
setPrinter()
elseif input == "erase" then
local px , py = printer.getCursorPos()
printer.setCursorPos( 1,py - 1 )
printer.write( " " )
term.setCursorPos( 1,py + 2 )
else
local px , py = printer.getCursorPos()
printer.setCursorPos( 1,py + 1)
printer.write( input )
testSize()
end
end
end
startPrinter()
Ink Detection.
Automatically starts a new page when it is full.
Stops you from writing the page like above.
[Notes]
* The number after the sentence of "You must enter a max of 25 characters:" is how many characters was entered.
* The title check for nil is buggy, But the rest of the program still works. :D/>
* Does not have color yet
[Plans]
* Fix the nil bug
* Add some color
* If possible, Try to make the program more lighter.
[Pictures]
Spoiler
Input Title[attachment=1635:2014-05-06_15.39.52.png]
The Editor
[attachment=1636:2014-05-06_15.40.08.png]
The Result
[attachment=1637:2014-05-06_15.40.18.png]
Spoiler
Q. There is no color.A. Look up.
Q. This program is copyright!
A. How am I supposed to know that and what kind of person puts
copyright on a printer program… (No Offense)
Q. This program has a bug.
A. Post the bug and I will try and fix it.
Q. This program sucks.
A. I said it was simple. Plus it is for certain people who don't know
how big a page really is.
Q. How do you install it?
A. pastebin get sZKRNNKF Printer
Q. Printer:42: attempt to index ? ( a nil value )
A. Now, how are you gonna print a piece of paper without a printer?
Q. Printer:36: Page not Started
A. Now, how are you gonna print a piece of paper without a piece of paper?!?!?!?
Edited on 06 May 2014 - 10:22 PM