Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dumb question but.... what is it called - multiple buttons/single prim face

StarSong Bright
SL Addict
Join date: 24 Jan 2007
Posts: 191
09-12-2009 05:25
Hi all, I have been seeing single prim gizmos with multiple buttons on a single side of a prim. I am not even sure how to search to find out how to do this. Can someone please give me the name of this functionality, and if possible point me to where i can find out more about how to do it? Thanks!!!
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
09-12-2009 05:33
You can start here:
http://wiki.secondlife.com/wiki/Category:LSL_Touch
_____________________
From Studio Dora
Carbon Philter
Registered User
Join date: 4 Apr 2008
Posts: 165
09-12-2009 05:41
Hi StarSong.
I experimented after seeing an example in the College of Scripting and managed to create a prim with apparent separate buttons using llDetectedTouchUV function.
StarSong Bright
SL Addict
Join date: 24 Jan 2007
Posts: 191
Thank you!
09-12-2009 05:42
LOL i couldnt even figure out where to start. ;-)

I want to make a TP directory that will open the map llMapDestination.. need a dozen buttons but dont want to waste all those prims.
StarSong Bright
SL Addict
Join date: 24 Jan 2007
Posts: 191
Where to find the example
09-12-2009 05:57
Hi, i came to the college of scripting but i cant seem to find that example, which floor would i find it on, do you know?
Carbon Philter
Registered User
Join date: 4 Apr 2008
Posts: 165
09-12-2009 05:58
For help - level 5 of College of Scripting: http://slurl.com/secondlife/Horsa/70/188/123
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
09-12-2009 07:04
And when you're making the texture with all the buttons on, you may find some of the answers I received here /109/4a/331119/1.html of use. I certainly did!
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-12-2009 07:29
From: StarSong Bright
Hi all, I have been seeing single prim gizmos with multiple buttons on a single side of a prim. I am not even sure how to search to find out how to do this. Can someone please give me the name of this functionality, and if possible point me to where i can find out more about how to do it? Thanks!!!

The LSL function llDetectedTouchST () returns the coordinates of the point on the prim face where it was touched, and the function llDetectedTouchUV () returns the coordinates for the texture - which may be offset on the prim face.

The LSL portal () on the SL wiki should be your first port of call for technical information about the scripting language.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-12-2009 07:30
It's a fairly straightforward process. Think of a face of your prim as a grid with X and Y axes that go from 0 to 1, with the origin in the lower left corner. When you draw the texture to put on that face, it might help to actually mark off a grid in 0.05 units to use as an overlay layer while you're placing the buttons on the layer. Remember the corner coordinates (lower left and upper right) of each of your buttons.

Then, when you write the controlling script, use each button's coordinates as limits on if statements to activate some action. For example, if you have a button whose lower left corner is at (0.1,0.1) and whose upper right corner is at (0.3,0.45), you do something like this ...

CODE

touch_start(integer num_detected)
{
vector Hit = llDetectedTouchUV(0);
if (llDetectedTouchFace(0) == 1) //Ignore hits on any other face
{
if (0.1 < Hit.x & Hit.x < 0.3 & 0.1 < Hit.y & Hit.y < 0.45)
{
//Do something
}
}
}


ETA: I'm using llDetectedTouchUV in this example, because that way the touch coordinates are keyed to the texture and the buttons will still work properly even if I have to offset the texture on the prim face. You could use llDetectedTouchST instead, if you wanted to have coordinates keyed to positions on the prim, regardless of where the texture sits on it.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-12-2009 09:54
from the wiki http://wiki.secondlife.com/wiki/LlDetectedTouchST


CODE

//Sets a grid of x by y, in this case 144 squares and returns that number on touch.

float x=12.0;
float y=12.0;
integer Pos;

default{

touch_start(integer total_number){
if (llDetectedTouchFace(0) == -1)
llOwnerSay("old client");
else{
vector pos = llDetectedTouchST(0);
Pos = ((llFloor((pos.x*10)*x)/10)*(integer)y)+llCeil(pos.y*y);
llOwnerSay((string)Pos);
}
}
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
StarSong Bright
SL Addict
Join date: 24 Jan 2007
Posts: 191
Ty Ty Ty
09-13-2009 02:44
Thanks to all who responded, I got it all up and working!