View difference between Paste ID: CDGYxfL0 and v84Q9wC1
SHOW: | | - or go back to the newest paste.
1-
-- BANCOMAT V2 aggiornato 2025 copyright lego11
1+
function clear() 
2-
local tabr = {}
2+
term.clear()
3
term.setCursorPos(1,1)
4-
function clear()
4+
5-
    term.clear()
5+
6-
    term.setCursorPos(1, 1)
6+
m = peripheral.wrap("right") --magcard
7
lbl = "BN Credit"
8
print("Porta a Pagamento(R)")
9-
function pinErrato()
9+
10-
    clear()
10+
11-
    print("Errore di verifica del PIN")
11+
12-
    print("")
12+
za,rawCredito = os.pullEvent("mag_swipe")
13-
    print("Premere un tasto per uscire")
13+
14-
    os.pullEvent("key")
14+
credito = tonumber(rawCredito)
15-
    os.reboot()
15+
16
print("La carta ha una disponibilità di "..credito.." IC.")
17
print("")
18-
function cartaNonValida()
18+
print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
19-
    clear()
19+
20-
    print("Carta non valida o corrotta.")
20+
print("[1] Aprire la porta - Costo: 2 IC")
21-
    print("")
21+
print("[2] Annullare il pagamento")
22-
    print("Premere un tasto per uscire")
22+
num=tonumber(read())
23-
    os.pullEvent("key")
23+
if num == 1 then
24-
    os.reboot()
24+
prelievo=2
25
if prelievo > credito then
26
clear()
27-
function cartaVuota()
27+
print("Disponibilità insufficiente")
28-
    clear()
28+
sleep(5)
29-
    print("Carta smagnetizzata o vuota.")
29+
30-
    print("")
30+
31-
    print("Premere un tasto per uscire")
31+
32-
    os.pullEvent("key")
32+
print("Inserire nuovamente la carta per confermare il pagamento")
33-
    os.reboot()
33+
nuovoCredito = credito - prelievo
34
ncr = tostring(nuovoCredito)
35
m.setInsertCardLight(true)
36-
function cartaNoSIB()
36+
m.beginWrite(ncr,lbl)
37-
    clear()
37+
os.pullEvent("mag_write_done")
38-
    print("Carta non in sistema interbancario.")
38+
39-
    print("")
39+
print("Porta perta")
40-
    print("Premere un tasto per uscire")
40+
41-
    os.pullEvent("key")
41+
redstone.setOutput("bottom", true)
42-
    os.reboot()
42+
sleep(5)
43
redstone.setOutput("bottom", false)
44
print("")
45-
function sibFail()
45+
print("Grazie!")
46-
    clear()
46+
sleep(5)
47-
    print("Errore connessione sistema interbancario")
47+
48-
    print("")
48+
elseif num == 2 then clear() break end
49-
    print("Premere un tasto per uscire")
49+
50-
    os.pullEvent("key")
50+
51-
    os.reboot()
51+
print("Attendere")
52
sleep(1)
53
os.reboot()