Listeners stop listening after the first message
complete
SuzannaLinn Resident
Listener doesn't work after the first message:
local function listening(channel, name, id, msg)
print(msg)
end
LLEvents:on("listen", listening)
ll.Listen(1, "", "", "")
[ typing: /1 hello]
-- > hello
[ typing: /1 hello]
( nothing )
---
Both listeners don't work after the first message to any of them
local function listening(channel, name, id, msg)
print(msg)
end
LLEvents:on("listen", listening)
ll.Listen(1, "", "", "")
ll.Listen(2, "", "", "")
[ typing: /2 hello]
-- > hello
[ typing: /1 hello]
( nothing )
---
Event handlers are in place:
local function listening(channel, name, id, msg)
print(msg)
end
local function touching(events)
for _, eventName in LLEvents:eventNames() do
for _, myHandler in LLEvents:listeners(eventName) do
print(`{eventName} : {debug.info(myHandler,"n")}`)
end
end
end
LLEvents:on("listen", listening)
LLEvents:on("touch_start", touching)
ll.Listen(1, "", "", "")
[ typing: /1 hello]
-- > hello
[ touching ]
-- > touch_start : touching
-- > listen : listening
[ typing: /1 hello]
( nothing )
---
This doesn't work, listeners are removed after calling the event handler:
local function listening(channel, name, id, msg)
print(msg)
ll.Listen(1, "", "", "")
end
LLEvents:on("listen", listening)
ll.Listen(1, "", "", "")
---
This works:
local function listening(channel, name, id, msg)
print(msg)
LLTimers:once(0.1, function()
ll.Listen(1, "", "", "")
ll.Listen(2, "", "", "")
end)
end
LLEvents:on("listen", listening)
ll.Listen(1, "", "", "")
ll.Listen(2, "", "", "")
Log In
H
Harold Linden
marked this post as
complete
Should be fixed on the latest version, thanks again!
H
Harold Linden
marked this post as
in progress
Interesting, thanks for sending this in!
Looks like this is due to a change I made that unregisters all listeners once the last event handler for
listen
has been removed (to mimic what people used state changes for). That means sensor
s are probably broken too, since i did something similar for llSensorRepeat()
.Unfortunately that area of the code is very difficult to automatically test, and the scripts I used to test in-world used one-off
listen
handlers.We'll get this fixed up.
SuzannaLinn Resident
Harold Linden
Indeed,
ll.SensorRepeat()
only works once.Great idea to remove all the listeners when there are no listen handlers, keep it working, please.
H
Harold Linden
SuzannaLinn Resident: Okay, I have a fix for it, should be rolled out today