Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local s = sensor.wrap("top")
- rednet.open("front")
- mon = peripheral.wrap("back")
- side = "back" --Bildschirmseite für Button-Abfrage setzen
- mon.setBackgroundColor(32768)
- mon.setTextScale(1.5)
- mon.clear()
- --Hilfs-Funktionen--
- function calc_color(color)
- return math.pow(2, color - 1)
- end
- function msg(gap, line, color, groundb, text)
- mon.setBackgroundColor(calc_color(groundb))
- mon.setCursorPos(gap,line)
- mon.setTextColor(calc_color(color))
- text = mon.write(text)
- end
- function firstlayer()
- rednet.send(6324, "abfrage")
- rednet.send(6324, name)
- id, coins, z = rednet.receive()
- mon.setBackgroundColor(32768)
- mon.clear()
- msg(01,1,4,16,"Willkommen " ..name.. " ")
- msg(27,1,6,16,"Coins: " ..coins.. " ")
- msg(01,2,5,16,"------------------------------------------------------------")
- end
- function keinbutton1()
- msg(01,17,01,15," An dieser Stelle ist kein Button xD ")
- sleep(1)
- msg(01,17,16,16," ")
- msg(33,17,01,15," zurück ")
- msg(01,17,01,15," -> logout <- ")
- deutsch1()
- end
- function keinbutton2()
- msg(01,17,01,15," An dieser Stelle ist kein Button xD ")
- sleep(1)
- msg(01,17,16,16," ")
- msg(33,17,01,15," zurück ")
- count1()
- end
- function keinbutton3()
- msg(01,17,01,15," An dieser Stelle ist kein Button xD ")
- sleep(1)
- msg(01,17,16,16," ")
- count2()
- end
- function deutsch1()
- firstlayer()
- msg(01,4,10,16,"Was möchtest du einzahlen?")
- msg(01,5,10,16,"Klick einfach auf den Namen des Items.")
- msg(02,07,01,16,"Menge| Item | Gegenwert")
- msg(01,8,01,16,"~~~~~~|~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~")
- msg(02,09,01,16," 1x | Shard of Minium | 25 Coins")
- msg(02,10,09,16," 1x | Lead Ingot | 10 Coins")
- msg(02,11,01,16," 1x | Lead Ore | 20 Coins")
- msg(02,12,09,16," 1x | Shiny Ingot | 100 Coins")
- msg(02,13,01,16," 1x | Ferrous Ore | 10 Coins")
- msg(02,14,09,16," 1x | Quartz Crystal | 25 Coins")
- msg(02,15,01,16," 1x | Silver Ore | 12 Coins")
- msg(33,17,01,15," zurück ")
- msg(01,17,01,15," -> logout <- ")
- local event, side, X, Y = os.pullEvent("monitor_touch")
- if X >= 33 and X <=40 and Y >= 17 and Y <= 18 and side == side then -- zurück Button
- fs.delete("Player")
- shell.run("startup")
- elseif X >= 1 and X <=40 and Y >= 1 and Y <= 8 and side == side then
- keinbutton1()
- elseif X >= 1 and X <=40 and Y >= 16 and Y <= 16 and side == side then
- keinbutton1()
- elseif X >= 15 and X <=32 and Y >= 17 and Y <= 18 and side == side then
- keinbutton1()
- elseif X >= 1 and X <=40 and Y >= 9 and Y <= 9 and side == side then
- item = "Shard of Minium"
- ID = 6311
- itemwert = 25
- count1()
- elseif X >= 1 and X <=40 and Y >= 10 and Y <= 10 and side == side then
- item = "Lead Ingot"
- ID = 6313
- itemwert = 10
- count1()
- elseif X >= 1 and X <=40 and Y >= 11 and Y <= 11 and side == side then
- item = "Lead Ore"
- ID = 6316
- itemwert = 20
- count1()
- elseif X >= 1 and X <=40 and Y >= 12 and Y <= 12 and side == side then
- item = "Shiny Ingot"
- ID = 6317
- itemwert = 100
- count1()
- elseif X >= 1 and X <=40 and Y >= 13 and Y <= 13 and side == side then
- item = "Ferrous Ore"
- ID = 6318
- itemwert = 10
- count1()
- elseif X >= 1 and X <=40 and Y >= 14 and Y <= 14 and side == side then
- item = "Quartz Crystal"
- ID = 6319
- itemwert = 25
- count1()
- elseif X >= 1 and X <=40 and Y >= 15 and Y <= 15 and side == side then
- item = "Silver Ore"
- ID = 6320
- itemwert = 12
- count1()
- elseif X >= 1 and X <=14 and Y >= 17 and Y <= 18 and side == side then --logout Button
- fs.delete("Player")
- shell.run("startup")
- end
- end
- function count1()
- firstlayer()
- msg(33,17,01,15," zurück ")
- msg(01,4,10,16,"Bitte werf nun "..item.." in den")
- msg(01,5,10,16,"Input und klick danach hier auf OK ")
- msg(01,7,02,16,"Bitte nur maximal 16 Stacks einwerfen! ")
- msg(17,09,16,01," ")
- msg(17,10,16,01," ")
- msg(17,11,16,01," OK ")
- msg(17,12,16,01," ")
- msg(17,13,16,01," ")
- local event, side, X, Y = os.pullEvent("monitor_touch")
- if X >= 1 and X <=40 and Y >= 1 and Y <= 8 and side == side then
- keinbutton2()
- elseif X >= 01 and X <=40 and Y >= 14 and Y <= 16 and side == side then
- keinbutton2()
- elseif X >= 01 and X <=32 and Y >= 17 and Y <= 18 and side == side then
- keinbutton2()
- elseif X >= 01 and X <=16 and Y >= 09 and Y <= 13 and side == side then
- keinbutton2()
- elseif X >= 25 and X <=40 and Y >= 09 and Y <= 13 and side == side then
- keinbutton2()
- elseif X >= 33 and X <=40 and Y >= 17 and Y <= 18 and side == side then --zurück
- deutsch1()
- elseif X >= 17 and X <=24 and Y >= 9 and Y <= 13 and side == side then --OK
- count2()
- end
- end
- function count2()
- y = 1
- rednet.send(ID,y)
- x, y, z = rednet.receive()
- if y > 0 then
- firstlayer()
- wert = y * itemwert
- msg(01,04,10,16,"Es wurden "..y.." "..item.." erkannt.")
- msg(01,05,10,16,"Das entspricht einem Wert von "..wert.." ")
- msg(01,06,10,16,"Coins.")
- msg(01,08,10,16,"Möchetest du diese jetzt einzahlen?")
- msg(8,10,1,6," ") msg(23,10,1,15," ")
- msg(8,11,1,6," JA ") msg(23,11,1,15," NEIN ")
- msg(8,12,1,6," ") msg(23,12,1,15," ")
- local event, side, X, Y = os.pullEvent("monitor_touch")
- if X >= 01 and X <=40 and Y >= 01 and Y <= 09 and side == side then
- keinbutton3()
- elseif X >= 01 and X <=07 and Y >= 10 and Y <= 12 and side == side then
- keinbutton3()
- elseif X >= 19 and X <=22 and Y >= 10 and Y <= 12 and side == side then
- keinbutton3()
- elseif X >= 33 and X <=40 and Y >= 10 and Y <= 12 and side == side then
- keinbutton3()
- elseif X >= 01 and X <=40 and Y >= 13 and Y <= 18 and side == side then
- keinbutton3()
- elseif X >= 08 and X <=18 and Y >= 10 and Y <= 12 and side == side then -- Klick JA
- rednet.send(6324, "einzahlen")
- sleep(0.5)
- rednet.send(6324, name)
- sleep(0.5)
- rednet.send(6324, wert)
- id, coins, z = rednet.receive()
- y = 1000000 --Shards an mich
- rednet.send(ID,y)
- msg(01,1,4,16,"Willkommen " ..name.. " ")
- msg(27,1,6,16,"Coins: " ..coins.. " ")
- msg(01,14,10,16,"Es wurden "..wert.." Coins eingezahlt.")
- sleep(3)
- deutsch1()
- elseif X >= 23 and X <=33 and Y >= 09 and Y <= 11 and side == side then --Klick NEIN
- y = 0
- rednet.send(ID,y)
- msg(01,14,10,16,"--> Itemrückgabe")
- sleep(3)
- deutsch1()
- end
- elseif y == 0 then
- firstlayer()
- msg(01,07,15,16,"Es wurden kein "..item.." erkannt.") --keine shards drin
- sleep(3)
- count1()
- end
- end
- ------------- Programm START -------------
- file = fs.open("Player", "r")
- name = file.readLine()
- file.close()
- deutsch1()
Advertisement
Add Comment
Please, Sign In to add comment