Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

touch not appear on menu

Ivorness Steenbock
Registered User
Join date: 21 Jun 2006
Posts: 7
08-09-2006 14:30
I tried many different approaches but don't get the solution.

I've got a script with a touch_start, but the event does not being called when the prim is being touched and the touch-menu-item is not available (greyed). I'm pretty sure it's due a loop I'm working with (while) in the state_entry.
The approach of having to states switching quite fast did not solve the problem.

I did not find any limitations about that, but they seem to be there. Does anybody can provide help (how to get touch working or an workaround). Thnx in advance.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
08-09-2006 15:19
I'm not 100% sure how it works, I thought if the event was there and the state active it should work, but if you are getting into an infinite while loop in state_entry() it's possible that the vm doesn't read the rest of the events until after state_entry() and so it's never appearing.

llOwnerSay() in the while loop will let you check if it ever stops.

VERY confusingly the script will compile with 2 touch_start events in the same state (it won't with many of the other events). If there are two touch_starts the touch sector of the pie menu and the pointing hand are both not enabled.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
08-09-2006 15:23
I've also seen the touch option greyed out after script edits. I'm not sure what causes it, but I do a "set scripts to not running" then a reset, then a "set scripts to running", and it makes it show up again. Just doing the reset usually doesn't work. So... I dunno, might be a bug in my scripts, but this works for me, so I use it :)
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
08-09-2006 15:39
From: Ivorness Steenbock
I tried many different approaches but don't get the solution.

I've got a script with a touch_start, but the event does not being called when the prim is being touched and the touch-menu-item is not available (greyed). I'm pretty sure it's due a loop I'm working with (while) in the state_entry.
The approach of having to states switching quite fast did not solve the problem.

I did not find any limitations about that, but they seem to be there. Does anybody can provide help (how to get touch working or an workaround). Thnx in advance.


Event handlers are never interrupted by events. So if you have a infinite loop in the state_entry event handler, nothing else will happen.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-09-2006 15:58
From: Angela Salome
Event handlers are never interrupted by events. So if you have a infinite loop in the state_entry event handler, nothing else will happen.

I'm surprised it is still grayed out though. Maybe it IS after 'state_entry' that other even handlers are registered though. I guess that wouldn't be a bad thing since 'state_entry' is guaranteed to come first.
Ivorness Steenbock
Registered User
Join date: 21 Jun 2006
Posts: 7
08-10-2006 13:58
Eloise: Thanx for that hint. Okay I assumed that an infinit loop may be the point.
But I don't understand why I don't get to the touch event, when I approach 2 different states both with the touch event. in it. It should work even it they switch quite fast- shouldn't it?

Ziggy: I faced the effect of having an greyed touch which could solve only by being rezzed newly. It can not be the point.
Eloise: Yes it works (owner say) if I approach the state-solution - but still the touch event is not triggered
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
08-10-2006 16:54
If you've removed the infinite loop, then there still may be problem with touch text not showing correctly. I've got several objects that seem to show a problem related to this, which I haven't found the cause for. It could be a error in my scripts or it could be a LSL prim problem, relating to collisions as well.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
08-10-2006 20:13
I have noticed that if some of your states do not have touch_start event handlers then the touch option is grayed out even if you are in a state with a touch event handler. Just put an empty touch_start function in every state.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-11-2006 02:14
Oh. One minor note. If you are doing this in an attachment, the 'Touch' entry in the pie menu is NEVER enabled, but clicking DOES call into the applicable touch event (if the current state has one and you have given up control to the event system at some point).

BTW, it is a pretty fundamental principle of event-driven programming that you have to give time up to the event system in order to receive events. In SL (since each script is effectively single-threaded) that means you have to actually return from an event handler. And I don't know if popping back and forth between two states by putting 'state other' in the 'state_entry' events of each counts in LSL, so if that is what you are trying to do, use a timer instead.

The only case I've seen time NOT given up to the event system is in (EDIT: NON-)physical-movement scripts, because they need to perform their function and keep performing it as often and quickly as possible. And in these scripts you cannot get events at all once the inner loop has hit; you have to rely on an outside script pause or reset (and you have to rely on some kind of polling, not events).
Ivorness Steenbock
Registered User
Join date: 21 Jun 2006
Posts: 7
08-12-2006 11:51
Hm - thnx for all your suggestions.

Didn't come to a solution with the approach taken at start -
however I use now timer events - and it works now - thnx anyway for your suggestions.