Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llResetScript and touch_start event

Deanfred Brandeis
one who programs
Join date: 20 Aug 2006
Posts: 20
07-14-2007 00:38
One of my scripts is experiencing a very odd problem. The script is in a child prim. Basically, the default event responds to a touch by switching states, doing something, then resetting. Here's a skeleton version:

CODE
default {
touch_start(integer n)
{
state other;
}
}

state other {
state_entry()
{
// Tell another script something happened, then wait for a response.
llMessageLinked(LINK_ALL_OTHERS, ...);
}

link_message(integer sender, integer i, string s, key k)
{
// Do something.
llResetScript();
}
}


After I manually recompile/reset the script, it works fine. However, after it resets, it does not trigger the "touch_start" event by left-clicking on the object; I have to right-click on it and manually select "Touch" from the pie menu.

I've verified that it's properly resetting and getting back to the default state with debug statements, of course. And I have other scripts in other child prims that work in very similar ways that are behaving fine.

Is there anything that might prevent a simple left-click from triggering a "touch_start" event in a child prim?
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-14-2007 02:37
I think that's an old bug, and I think the work-around is to put an empty touch event into your "other" state.
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
07-14-2007 02:41
I do believe that I reported this bug and repro for it back in 1879 ;)
_____________________
http://slurl.com/secondlife/Together
Deanfred Brandeis
one who programs
Join date: 20 Aug 2006
Posts: 20
07-18-2007 06:11
Well, I was able to work around this by not calling llResetScript() (which was only a workaround for me to avoid the possibility of bad garbage collection and eventual stack-heap collision) and then going back to the default state.

For whatever reason, llResetScript() can apparently make the object "forget" that it can handle touches (in the default state at least) after reset.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
07-18-2007 10:36
Normally, a touch_start in an event in a child prim does not make the whole object touchable, just that child prim. Do you have another script in the root prim which makes the whole object touchable as well?
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
07-18-2007 10:53
could be related to this:
/54/ee/198199/1.html
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-18-2007 11:54
From: Deanfred Brandeis
Well, I was able to work around this by not calling llResetScript() (which was only a workaround for me to avoid the possibility of bad garbage collection and eventual stack-heap collision) and then going back to the default state.

For whatever reason, llResetScript() can apparently make the object "forget" that it can handle touches (in the default state at least) after reset.
Yes, this is mighty strange. (It's reproducible without the script being in a child prim, by the way. [edit: I used a timer event in the post-touch state, instead of link_message, to trigger the llResetScript.])

One thing that worked for me was to have a default state with nothing but a state_entry that transitions to the state with the touch_start handler (the state *formerly* known as "default";). Then you can llResetScript() and still get the touch sensitivity.

I'd open a jira on this (presumably 1879 was pre-jira ;) --I can't find an existing entry for this), but... is it Viewer or Service? The touch handler is still active because it's accessible from the pie menu, but you can't invoke it by actually touching the object.
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
07-18-2007 12:31
Given that you can still touch using the pie menu, I would write it as a viewer bug and let the viewer folks prove it's a server-side problem.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
jira filed
07-18-2007 20:21