Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mod = peripheral.wrap("bottom")
- sensor = peripheral.wrap("right")
- mod.open(2)
- mod.open(3)
- while true do
- local event = {os.pullEvent()}
- if event[3] == 3 then
- redstone.setOutput("left", true)
- sleep(1)
- redstone.setOutput("left", false)
- else if event[3] == 2 then
- local count = 0
- for k,v in pairs(sensor.sense()) do
- if v["name"] == "Cow" then
- count = count + 1
- end
- end
- mod.transmit(2,2,tostring(count))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement