Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("right")
- local S1 = 1
- local S5 = 2
- local Slettre = 3
- local Sdrop = 16
- local rs = "left"
- function drop(slot, nb)
- turtle.select(slot)
- turtle.transferTo(Sdrop,nb)
- turtle.select(Sdrop)
- turtle.drop()
- end
- modem.open(512)
- while true do
- local event, modemSide, senderChannel, replyChannel, timbres, senderDistance = os.pullEvent("modem_message")
- --timbres = read()
- timbres = tonumber(timbres)
- if timbres <= 20 then
- if timbres >= 5 then
- tb5 = 0
- while timbres >= 5 do
- tb5 = tb5 +1
- timbres = timbres - 5
- end
- print("timbres5: " .. tb5)
- drop(S5, tb5)
- end
- local rare = math.random(0, 10)
- if rare == 10 then
- print("Jackpot (ou pas)")
- rs.setOutput(rs,true)
- sleep(0.5)
- rs.setOutput(rs,false)
- end
- print("timbres1: " .. timbres)
- print("-------")
- drop(S1, timbres)
- drop(Slettre, 1)
- else
- print("Erreur:timbres>20")
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement