View difference between Paste ID: WKDhnKTZ and D3EnkPe2
SHOW: | | - or go back to the newest paste.
1
---------------- Config -----------------------------------------------------
2-
USE_PASSWORD = true -- if true then program get password to close
2+
3
RS_DELAY = 3 -- delay for redstone signal
4
PASSWORD = "exit()" -- password to terminate
5-
PASSWORD = "exit()" -- if USE_PASSWORD true then , here password to close
5+
6
 
7
local function pulse(side)
8
rs.setOutput(side, true)
9
sleep(RS_DELAY)
10
rs.setOutput(side,false)
11
end
12
Tr = true
13
function os.pullEvent()
14
local event, p1,p2,p3,p4,p5 = os.pullEventRaw()
15
if event == "terminate" then
16-
if event == "terminate" then 
16+
17-
if USE_PASSWORD then
17+
p = read("*")
18
if p == PASSWORD then Tr = false end
19-
p = read("*") 
19+
20
return event,p1,p2,p3,p4,p5
21-
else
21+
22-
Tr = false
22+
 
23-
print("terminate")
23+
24
Recive = {"","",""}
25
Recive[1],Recive[2],Recive[3] = os.pullEvent()
26
pL = fs.list("Assets")
27
if Recive[1] == "player" then
28
for i =1 , 10 ,1 do
29
if Recive[3] == pL[i] then
30
pulse(RS_SIDE)
31
break
32
end
33
end
34
end
35
36
    end