;(
here is a download: [attachment=689:notepad.txt]
and this is what is contained in side it:
write "Welcome to Notepad"
sleep(1)
term.setCursorPos(1,1)
term.clear()
--this is getting rid of that line that we no longer need
sleep(.5)
--this is getting the user typeing
write "you may start typing. when you are done please push 'end' to print"
function notepad()
end
term.setCursorPos(1,3)
write "keys: [end] to finish, [enter] to move down a line, [ctrl+c] this opens the color choosing menu."
term.setCursorPos(1,4)
print "---------------------------------------------------"
term.setCursorPos(1,6)
function hows()
x = io.read()
button()
end
--this is getting the key pressing input
while true do
function button()
hows()
event, param1, param2 = os.pullEvent()
event, param3 = os.pullEvent()
if event == "char" and param1 == "[" then
function find()
print "which side is your printer on"
c = io.read()
local printer=perhipheral.wrap(c)
sleep(.2)
if printer==nil then
term.setTextColor(colors.red)
print "No Printer Detected!"
term.setTextColor(colors.white)
write "would you like to search automatically for the printer?"
j = io.read()
if j == "yes" then
for _,side in pairs(redstone.getSides()) do
if perhipheral.getType(side)=="printer" then
printer=peripheral.wrap(side)
break
elseif j == "no" then
find()
elseif printer==true then
print "printer found!"
sleep(2)
break
end
printered()
end
end
end
end
end
end
function note()
local e, t=term.getCursorPos()
k=1,#str
term.setCursorPos(1,t)
local str="Vertical"
u=1,#str
term.setCursorPos(k,u + k)
end
x = io.read()
button()
--this allows the person to change the text's color
if event == "char" and param2 == "enter" then
note()
end
end
if event == "key" and param3 == "ctrl+c" then
term.clear()
term.setBackgroundColor(colors.white)
function fuds()
write "what color text do you want? WARNING! this will"
term.setCursorPos(1,2)
write "ownly show up as a document in diffrent colors."
term.setCursorPos(1,3)
write "it will not print in diffrent colors!"
term.setCursorPos(1,4)
print "---------------------------------------------------"
term.setCursorPos(1,5)
write "sorry but black won't work here sorry!"
term.setCursorPos(1,6)
print "---------------------------------------------------"
term.setCursorPos(1,8)
term.setTextColor(colors.gray)
write "white"
term.setCursorPos(1,9)
term.setTextColor(colors.red)
write "red"
term.setCursorPos(1,10)
term.setTextColor(colors.blue)
write "blue"
term.setCursorPos(1,11)
term.setTextColor(colors.green)
write "green"
term.setCursorPos(1,12)
term.setTextColor(colors.orange)
write "orange"
term.setCursorPos(1,13)
term.setTextColor(colors.pink)
write "pink"
term.setCursorPos(1,14)
term.setTextColor(colors.purple)
write "purple"
term.setCursorPos(1,15)
term.setTextColor(colors.gray)
write "gray"
term.setCursorPos(1,17)
print (">")
z = io.read()
if z == "white" then
term.setTextColor(colors.white)
hows()
elseif z == "red" then
term.setTextColor(colors.red)
hows()
elseif z == "blue" then
term.setTextColor(colors.blue)
hows()
elseif z == "green" then
term.setTextColor(colors.green)
hows()
elseif z == "orange" then
term.setTextColor(colors.orange)
hows()
elseif z == "pink" then
term.setTextColor(colors.pink)
hows()
elseif z == "purple" then
term.setTextColor(colors.purple)
hows()
elseif z == "gray" then
term.setTextColor(colors.gray)
hows()
else
term.clear()
sleep(.5)
term.setTextColor(colors.red)
term.setCursorPos(1,2)
print "invlaid answer!"
term.setCursorPos(1,3)
print "---------------------------------------------------"
term.setCursorPos(1,4)
print "please try again!"
term.setCursorPos(1,5)
print "---------------------------------------------------"
sleep(4)
term.clear()
term.setTextColor(colors.white)
fuds()
end
end
end
--print start
-- this is to see if the printer is out of ink or paper
local printer
if printer.getInkLeve() == 0 then
write "No Ink! Add Some More To Print"
while printer.getInkLevel() == 0 do
os.sleep(.5)
end
end
if printer.getPaperLevel() == 0 then
write "No Paper! add some more please"
while printer.getPaperLevel() == 0 do
os.sleep(.5)
end
end
--print end
-- this where the printer starts to print
--print start
function printered()
printer.newPage()
sleep(1)
write "would you like to print?"
m = io.read()
if m == "yes" then
title()
printer.write(x)
printer.setCursorPos(1,2)
local w, h=printer.getPageSize()
printer.setCursorPos(1,h)
local str="Vertical"
for i=1,#str do
printer.setCursorPos(w.i)
printer.write(string.sub(str,i,i))
end
elseif m == "no" then
notepad()
end
--print end
-- this asks if the user wants to add a title
write "would you like to add a title to show in inventory"
i = io.read()
if i == "yes" then
write "what should it be"
o = io.read()
funcion = title()
printer.setPageTitle(o)
elseif i == "no" then
printer.endPage()
end
end
sleep(1)
write "your document is finished"
term.clear()
sleep(.5)
write "would you like to do another document"
b = io.read()
if b == "yes" then
notepad()
elseif b == "no" then
term.clear()
end
--parts of the code where the comment "print"
--was a part of the printer tutorial made by"GopherAtl"