Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ##### Variablen
- printer = peripheral.find("printer")
- flop = peripheral.find("disk")
- mon = peripheral.find("monitor")
- --Boxen
- xbox = 2
- ybox = 2
- xbox_re = xbox + 24
- ybox_m = ybox + 6
- ybox_u = ybox + 12
- xadd = 22
- yadd = 4
- -- ##### Vorprozeduren
- term.clear()
- printer.getPaperLevel()
- printer.getInkLevel()
- term.setCursorPos(11,4)
- term.write("Mine")
- term.setCursorPos(32,10)
- term.write("Strecke 4")
- term.setCursorPos(7,10)
- term.write("Bootsverleih")
- term.setCursorPos(23,4)
- term.write("Strecke 3")
- -- Boxen malen
- paintutils.drawBox(xbox, ybox, xbox + xadd, ybox + yadd, colors.red)
- paintutils.drawBox(xbox, ybox_m, xbox + xadd, ybox_m + yadd, colors.blue)
- paintutils.drawBox(xbox_re, ybox_m, xbox_re + xadd, ybox_m + yadd, colors.green)
- paintutils.drawBox(xbox_re, ybox, xbox_re + xadd, ybox + yadd, colors.yellow)
- paintutils.drawBox(xbox, ybox_u, xbox + xadd, ybox_u + yadd, colors.purple)
- paintutils.drawBox(xbox_re, yboy_u, xbox_re + xadd, ybox_u + yadd, colors.brown)
- -- ##### Funktionen
- function flopcop()
- if disk.isPresent("right") then
- disk.setLabel("right", "Fahrschein")
- fs.copy(prog, progdest)
- sleep(0.5)
- disk.eject("right")
- end
- end
- function printit()
- printer.newPage()
- printer.setPageTitle("Quittung")
- printer.setCursorPos(1,1)
- printer.write("........................")
- printer.setCursorPos(2,3)
- printer.write("Strecke:")
- printer.setCursorPos(15,3)
- printer.write(destination1)
- printer.setCursorPos(2,4)
- printer.write("Haltestelle:")
- printer.setCursorPos(15,4)
- printer.write(destination2)
- printer.setCursorPos(1,6)
- printer.write("........................")
- printer.setCursorPos(3,9)
- printer.write("Preis:")
- printer.setCursorPos(16,9)
- printer.write(preis)
- printer.setCursorPos(3,11)
- printer.write("Umstiege:")
- printer.setCursorPos(16,11)
- printer.write(umstiege)
- printer.setCursorPos(3,13)
- printer.write("Wartezeiten:")
- printer.setCursorPos(16,13)
- printer.write(warten)
- printer.setCursorPos(1,18)
- printer.write("........................")
- printer.setCursorPos(1,19)
- printer.write("Bitte entnehmen Sie Ihren")
- printer.setCursorPos(1,20)
- printer.write("Fahrschein")
- printer.endPage()
- end
- -- ##### Hauptprogramm
- mon.clear()
- mon.setCursorPos(7,1)
- mon.write("Fahrkartenautomat")
- mon.setCursorPos(1,2)
- mon.write("----------------------")
- mon.setCursorPos(4,4)
- mon.write("Hier Fahrschein kaufen")
- while true do
- local event, button, x, y = os.pullEvent()
- if event == "mouse_click" then
- if x >= xbox and y >= ybox and x <= xbox + xadd and y <= ybox + yadd then
- x = "1"
- prog = "dest_mine.lua"
- progdest = "disk/dest_mine.lua"
- flopcop()
- destination1 = "1: Mine"
- destination2 = "Basecamp II"
- preis = "2,50 EUR"
- umstiege = "0"
- warten = "Möglich"
- printit()
- elseif x >= xbox and y >= ybox_m and x <= xbox + xadd and y <= ybox_m + yadd then
- x = "1"
- prog = "dest_2"
- progdest = "disk/dest_2"
- flopcop()
- destination1 = "2: BVL"
- destination2 = "Bootsverl."
- preis = "0,50 EUR"
- umstiege = "0"
- warten = "NEIN"
- printit()
- elseif x >= xbox_re and y >= ybox and x <= xbox_re + xadd and y <= ybox + yadd then
- x = "1"
- prog = "dest_3"
- progdest = "disk/dest_3"
- flopcop()
- destination1 = "3: Strecke"
- destination2 = "Halte"
- preis = "3,50 EUR"
- umstiege = "0"
- warten = "NEIN"
- printit()
- elseif x >= xbox_re and y >= ybox and x <= xbox_re + xadd and y <= ybox + yadd then
- x = "1"
- prog = "dest_4"
- progdest = "disk/dest_4"
- flopcop()
- destination1 = "4: Strecke"
- destination2 = "Halte"
- preis = "5,- EUR"
- umstiege = "0"
- warten = "NEIN"
- printit()
- elseif x >=xbox and y >= ybox_u and x <= xbox + xadd and y <= ybox_u + yadd then
- x = "1"
- prog = "dest_5"
- progdest = "disk/dest_5"
- flopcop()
- destination1 = "5: Strecke"
- destination2 = "Halte"
- preis = "8,- EUR"
- umstiege = "0"
- warten = "NEIN"
- printit()
- elseif x >= xbox_re and y >= yboy_u and x <= xbox_re + xadd and y <= ybox_u + yadd then
- x = "1"
- prog = "dest_6"
- progdest = "disk/dest_6"
- flopcop()
- destination1 = "6: Strecke"
- destination2 = "Halte"
- preis = "9,50- EUR"
- umstiege = "0"
- warten = "NEIN"
- printit()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement