View difference between Paste ID: aarNNf1e and GZq6QTy5
SHOW: | | - or go back to the newest paste.
1-
--Versamenti ORO V2 lego11
1+
function clear()
2-
--VARIABILI
2+
3
term.setCursorPos(1,1)
4-
os.pullEvent = os.pullEventRaw()
4+
5
6-
local contanti = 0
6+
7
print("CONSORZIO AGRICOLO ECONOMICO")
8-
function clear() 
8+
9
print("Scaricare il treno e premere qualunque tasto quando tutti i vagoni sono stati scaricati")
10
11
os.pullEvent("key")
12
13-
function oggettiEstranei()
13+
14
clear()
15-
print("ATTENZIONE: RILEVATI OGGETTI ESTRANEI NELLA CASSAFORTE VERSAMENTI")
15+
16
ben = peripheral.wrap("bottom")
17-
redstone.setOutput("top", true)
17+
18-
print("Rimuovere gli oggetti estranei e premere un tasto per uscire")
18+
ben.getAvailableItems()
19
i,j = os.pullEvent("available_items_return")
20
21-
redstone.setOutput("top", false)
21+
22
if j[1] == nil then
23
	print("Errore: non è stato scaricato materiale")
24
	print("")
25
	print("Premere un tasto qualsiasi per uscire")
26
	print("")
27
	os.pullEvent("key")
28-
print("ASN- VENDITA URANIO")
28+
	sleep(1)
29
	os.reboot()
30
end
31
32
33
print("Inserire le credenziali del conto nPay")
34
35
 -- nomeutente
36
 term.setCursorPos(1, 9)
37
 term.write("Nome utente:")
38
 term.setCursorPos(15, 9)
39
 utenteAccettato = false
40
 conteggioErrori = 0
41-
                     "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" ..
41+
42
     utente = read()
43
     checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente="..utente).readAll()
44
     tabcheckuser = textutils.unserialize(checkuser)
45
     if tabcheckuser.stato == "OK" then
46
         term.setCursorPos(15, 9)
47
         term.write(utente)
48
         utenteAccettato = true
49
     else
50
         term.setCursorPos(15, 9)
51
         term.write("Utente errato!          ")
52
         sleep(2)
53
         term.setCursorPos(15, 9)
54
         term.write("                       ")
55
         term.setCursorPos(15, 9)
56
         conteggioErrori = conteggioErrori + 1
57
         if conteggioErrori > 2 then
58
             term.setCursorPos(15, 9)
59
             errore("Troppi tentativi di immissione errati    ")
60
         end
61
     end
62
 end
63
 term.setCursorPos(1, 11)
64
 term.write("Password:")
65
 term.setCursorPos(15, 11)
66
67
 conteggioErrori = 0
68
 passAccettata = false
69
 while passAccettata == false do
70
     password = read("#")
71
     checkuser = http.get(
72
                     "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" ..
73
                         password .. "&richiesta=addebito&valore=0&utente=" ..
74
                         utente).readAll()
75
     risposta = textutils.unserialize(checkuser)
76
     if risposta.stato == "OK" then
77
         term.setCursorPos(15, 11)
78
         term.write("##############               ")
79
         passAccettata = true
80
     else
81
         term.setCursorPos(15, 11)
82
         term.write("Password errata!            ")
83
         conteggioErrori = conteggioErrori + 1
84
         sleep(2)
85
         term.setCursorPos(15, 11)
86
         term.write("                               ")
87
         term.setCursorPos(15, 11)
88
         if conteggioErrori > 2 then
89
             term.setCursorPos(15, 11)
90
             errore("Troppi tentativi di immissione errati")
91
         end
92
     end
93
 end
94-
redstone.setOutput("top", true)
94+
95-
print("Inserire l'uranio nello sportello sotto questo computer.")
95+
96
print("Pesatura grano in corso...")
97-
print("AVVERTENZA IMPORTANTE:")
97+
98-
print("Inserire SOLO URANIO IN MULTIPLI DI 16 (minimo: 16 IC)")
98+
99
print("Totale versato: "..j[1][2].." pezzi di grano")
100-
print("NON INSERIRE ASSOLUTAMENTE ALTRI OGGETTI")
100+
101
102-
print("L'inserimento di oggetti errati comporta LA PERDITA TOTALE DEL VERSAMENTO.")
102+
rest = http.get("http://172.16.20.220/luanet/servlets/ingrosso_grano.php?qta="..j[1][2].."&npay="..utente.."&auth=NYDBGJTI");
103
rest_all = rest.readAll()
104-
print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
104+
105
t = textutils.unserialize(rest_all)
106
107
if t.stato == "KO" then
108
    clear()
109-
redstone.setOutput("top", false)
109+
110
    print(t.errore)
111-
if redstone.getInput("left") == false then
111+
112-
	print("Errore: nessun lingotto inserito")
112+
113
    os.reboot()
114
end
115
116
ben.makeRequest(j[1][1], j[1][2])
117
118
print("Denaro versato sul conto: "..utente)
119
print("")
120-
print("Conteggio uranio in corso...")
120+
121
print("Grazie per aver scelto il Consorzio Agricolo Economico!")
122
sleep(15)
123-
while redstone.getInput("left") == true do
123+
124-
	redstone.setOutput("back", true)
124+