Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local printerSide = "left"
- local BundledSide = "back"
- local Bcol = colors.lightGray
- local printer = peripheral.wrap(printerSide)
- local xMax,yMax = term.getSize()
- local Tscale = 1
- local col = 0
- Button = {}
- Button[1] = {2,xMax/2-1,3,5,colors.blue,colors.red,"Bunt",false}
- Button[2] = {xMax/2+1,xMax,3,5,colors.blue,colors.black,"SW",false}
- Button[3] = {2,xMax-1,7,9,colors.blue,colors.blue,"Anzahl: "..Tscale,false}
- Button[4] = {2,xMax/2-1,11,13,colors.gray,colors.blue,"Farbe",false}
- Button[5] = {2,xMax-1,15,17,colors.gray,colors.blue,"Drucken",false}
- function JoJa(xP,yP)
- term.setCursorPos(xP,yP)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.cyan)
- term.write("Jo")
- term.setTextColor(colors.orange)
- term.write("Ja ")
- term.setTextColor(colors.lightGray)
- term.write("Productions")
- end
- function Background(xP1,xP2,yP1,yP2,col)
- term.setBackgroundColor(col)
- for xP = xP1,xP2 do
- for yP = yP1,yP2 do
- term.setCursorPos(xP,yP)
- term.write(" ")
- end
- end
- end
- function printButton()
- for i = 1,#Button do
- if Button[i][9] == nil then
- term.setTextColor(colors.white)
- else
- term.setTextColor(Button[i][9])
- end
- if Button[i][8] then
- term.setBackgroundColor(Button[i][6])
- else
- term.setBackgroundColor(Button[i][5])
- end
- for xP = Button[i][1],Button[i][2] do
- for yP = Button[i][3],Button[i][4] do
- term.setCursorPos(xP,yP)
- term.write(" ")
- end
- end
- term.setCursorPos(((Button[i][1]+Button[i][2])/2)-(#Button[i][7]/2)+1,(Button[i][3]+Button[i][4])/2)
- term.write(Button[i][7])
- end
- end
- function checkButton(xP,yP)
- for i = 1,#Button do
- if xP >= Button[i][1] and xP <= Button[i][2] and
- yP >= Button[i][3] and yP <= Button[i][4] then
- if i == 4 then
- if Button[1][8] then
- col = col+1
- if col == 11 then
- Button[4][6] = colors.cyan
- else
- Button[4][6] = colors.blue
- end
- if col > 15 then
- col = 0
- end
- Button[4][9] = 2^col
- end
- elseif i == 5 then
- if Button[1][8] or Button[2][8] then
- Button[5][10] = true
- end
- else
- if Button[i][8] then
- Button[i][8] = false
- else
- Button[i][8] = true
- end
- end
- --
- if i == 1 then
- if Button[1][8] then
- Button[4][8] = true
- Button[2][8] = false
- end
- end
- if i == 2 then
- if Button[2][8] then
- Button[4][8] = false
- Button[1][8] = false
- Button[4][9] = 1
- end
- end
- if Button[1][8] or Button[2][8] then
- Button[5][8] = true
- else
- Button[5][8] = false
- end
- --
- if i == 3 then
- if Button[3][8] then
- Tscale = Tscale+1
- Button[3][7] = "Anzahl: "..Tscale
- Button[3][8] = false
- end
- end
- end
- end
- end
- while true do
- Background(1,xMax,1,yMax,Bcol)
- JoJa(xMax/2-7,1)
- term.setTextColor(colors.white)
- printButton()
- event,_,xPos,yPos = os.pullEvent("mouse_click")
- checkButton(xPos,yPos)
- if Button[5][10] then
- printer.newPage()
- xMaxP,yMaxP = printer.getPageSize()
- Background(1,xMax,1,yMax,Bcol)
- JoJa(xMax/2-7,1)
- Background(2,xMax-1,3,3,colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(2,3)
- term.write("Titel: ")
- titel = io.read()
- Background(1,xMax,1,yMax,Bcol)
- JoJa(xMax/2-7,1)
- Background(2,xMax-1,3,3,colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(2,3)
- term.write("Ueberschrift: ")
- uebers = io.read()
- Background(1,xMax,1,yMax,Bcol)
- JoJa(xMax/2-7,1)
- Background(2,xMax-1,3,3,colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(2,3)
- term.write("Autor: ")
- autor = io.read()
- Background(1,xMax,1,yMax,Bcol)
- JoJa(xMax/2-7,1)
- Background(2,xMaxP+4,3,yMax-1,colors.black)
- Zeile = {}
- for i = 1,16 do
- term.setCursorPos(2,2+i)
- term.write(i..":")
- term.setCursorPos(5,2+i)
- Zeile[i] = io.read()
- end
- for b = 1,Tscale do
- printer.setCursorPos(1,1)
- printer.write(uebers)
- printer.setPageTitle(titel)
- for i = 1,#Zeile do
- printer.setCursorPos(1,2+i)
- printer.write(Zeile[i])
- end
- printer.setCursorPos(1,20)
- printer.write("gez. "..autor)
- printer.endPage()
- printer.newPage()
- end
- printer.setCursorPos(1,1)
- printer.write("Auftrag:")
- printer.setCursorPos(1,3)
- printer.write("gedruckte Seiten: "..Tscale)
- printer.setCursorPos(1,4)
- printer.write("Titel: "..titel)
- printer.setCursorPos(1,5)
- printer.write("Ueberschrift: "..uebers)
- printer.setCursorPos(1,6)
- printer.write("Autor: "..autor)
- printer.endPage()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement