Posted 17 August 2015 - 02:07 PM
Hi all,
I'm experienced great weirdness with peripheral events in CC 1.74. I also have OpenPeripherals installed.
I'm looking out for peripherals being added and removed with a main event listener like this:
What happens when you add or remove nearby blocks from the computer, however, is more or less random madness. Or so it seems. Have I misunderstood what these events do?
One of two things will happen. Let's say I have a computer with a modem on top, two peripherals on the back and right. If I add something to the left, one of two things will happen. Either there will be up to SEVEN events fired - usually something like four adds ("peripheral") and three removes ("peripheral_detach") from several sides, usually right and left. Other times, I get the following:
It is starting to look like a bug but I am new to peripherals so not sure. Can anyone help?
I'm experienced great weirdness with peripheral events in CC 1.74. I also have OpenPeripherals installed.
I'm looking out for peripherals being added and removed with a main event listener like this:
function paddlistener()
local event, side = os.pullEvent("peripheral")
printdebug("Peripheral added: "..side)
end
function premovelistener()
local event, side = os.pullEvent("peripheral_detach")
printdebug("Peripheral removed: "..side)
end
-- main loop
while true do
parallel.waitForAny(mainlistener, paddlistener, premovelistener)
end
What happens when you add or remove nearby blocks from the computer, however, is more or less random madness. Or so it seems. Have I misunderstood what these events do?
One of two things will happen. Let's say I have a computer with a modem on top, two peripherals on the back and right. If I add something to the left, one of two things will happen. Either there will be up to SEVEN events fired - usually something like four adds ("peripheral") and three removes ("peripheral_detach") from several sides, usually right and left. Other times, I get the following:
Java Exception Thrown:
You are not connected to this Computer
It is starting to look like a bug but I am new to peripherals so not sure. Can anyone help?