touch_start() only triggers on the second touch if touch() is already active.
tracked
Moo Boo
As the title says, touch_start() won't fire until the second click if the object is already being touched. Here's some quick demo code:
default
{
touch_start(integer num) {
llOwnerSay("touch_start(): " + (string)num);
}
touch(integer num) {
llSetText("touch(): " + (string)num, <1.0, 1.0, 1.0>, 1.0);
}
}
Detailed scenario:
- User#1 clicks the prim and keeps their mouse button held,
- touch_start() outputs the correct number of 1 new touches,
- touch() outputs the correct number of 1 continuous touches,
- User#2 clicks the prim and keeps their mouse button held,
- touch_start() does not output anything.
- touch() outputs 2 continuous touches,
- User#2 releases their mouse button and clicks again
- touch_start() now outputs 1 new touches,
- touch() outputs 2 continuous touches.
I discovered this while coding authentication for a touchable object.
The alternative is to do authentication directly in touch() which will cripple performance as it will needlessly be validating unauthenticated users' access over and over whilst touched.
Log In
Maestro Linden
tracked
Maestro Linden
Hi Moo Boo, thanks for the report. I can reproduce this issue. If UserA is already touching the object, and UserB touches the object repeatedly, UserB only triggers touch_start() on every
even-indexed
touch attempt (2nd touch, 4th touch, etc.), while the odd-indexed
touch attempts fail to trigger touch_start(). All touches from UserB properly trigger touch() events (causing the script to report both UserA and UserB's ongoing touch). I see correct agent data in the touch() and touch_start() events which do trigger.
This issue seems somewhat similar to https://github.com/secondlife/jira-archive/issues/2983 , which describes certain touch events being dropped, but since there is no state change involved with your repro steps, this is definitely a distinct issue.
default
{
touch_start(integer num) {
integer i;
for(i = 0; i < num; i++)
{
llOwnerSay("touch_start(): " + (string)num + " by " + (string)llDetectedName(i));
}
}
touch(integer num) {
integer i;
for(i = 0; i < num; i++)
{
llSetText("touch(): " + (string)num + " by " + (string)llDetectedName(i), <1.0, 1.0, 1.0>, 1.0);
}
}
}