|
Tanoosh Feldman
Registered User
Join date: 11 Sep 2006
Posts: 17
|
11-03-2007 11:44
Building a few buttons for a HUD (first time). To start testing I made two panels and linked them. So i believe I have a parent and one child. I read that the Parent is the LAST of the linked prims, and put the script there (I've tried it both ways, just in case).
I've tried DetecedKey, getLink Number, Getlinkname, individually, and all together - but
I get the same response (the parent) regardless of which Prim I touch.
What COULD I be doing wrong? Any response would be greatly appreciated.
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
11-03-2007 12:10
From: Tanoosh Feldman Building a few buttons for a HUD (first time). To start testing I made two panels and linked them. So i believe I have a parent and one child. I read that the Parent is the LAST of the linked prims, and put the script there (I've tried it both ways, just in case).
I've tried DetecedKey, getLink Number, Getlinkname, individually, and all together - but
I get the same response (the parent) regardless of which Prim I touch.
What COULD I be doing wrong? Any response would be greatly appreciated. There's too many underlying assumptions about how you built your object and such.. Paste code?
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-03-2007 13:22
From: Tanoosh Feldman Building a few buttons for a HUD (first time). To start testing I made two panels and linked them. So i believe I have a parent and one child. I read that the Parent is the LAST of the linked prims, and put the script there (I've tried it both ways, just in case).
I've tried DetecedKey, getLink Number, Getlinkname, individually, and all together - but
I get the same response (the parent) regardless of which Prim I touch.
What COULD I be doing wrong? Any response would be greatly appreciated. Unless the child prim has a script with a touch event in it then all touches are passed to the root prim automatically.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
11-03-2007 13:33
The link number of the prim touched in a touch event is returned by llDetectedLinkNumber(). The event will always trigger in the root prim, though. It will trigger in a child prim if that prim has a script in it with a touch_start() or other touch event.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal
http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
|
|
Tanoosh Feldman
Registered User
Join date: 11 Sep 2006
Posts: 17
|
Prim detection resolved
11-04-2007 06:43
Thanks for the input guys.
In putting together the script and output to display here - I tried an initialized unreferenced variable in the integer panel= llDetectedLinkNumber(number);
previously I had the variable total_number from the Touch_end event.
Now it works.
Thanks
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-04-2007 08:02
Glad to see you got it Tanoosh. Here is a simple, bare bones hud script that might help a little bit. Just create 4 prim, link them and then drop this script into the linkset: integer prim_num; string prim_name; vector color;
say(){ llOwnerSay( "Prim name: " + prim_name + ", link #" + (string)prim_num + " touched." ); } params(){ llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, color, 0.6]); say(); }
default { touch_start( integer n ) { prim_num = llDetectedLinkNumber(0); prim_name= llGetLinkName(prim_num); if(prim_num == 1){ color = <1, 1, 1>; params(); llOwnerSay("I am also the Root Prim"); } if(prim_num == 2){ color = <0, 0, 1>; params(); } if(prim_num == 3){ color = <0, 1, 0>; params(); } if(prim_num == 4){ color = <1, 0, 0>; params(); } } }
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Tanoosh Feldman
Registered User
Join date: 11 Sep 2006
Posts: 17
|
Thanks Jesse
11-06-2007 11:24
I've left one frustration behind to move adroitly on to the next - thanks for code! it's useful now.
|