Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Buttons in script??

Richard Malaprop
Registered User
Join date: 19 Dec 2005
Posts: 5
01-16-2006 21:49
Ok.. please don't laugh, but how do I make a panel with buttons, to activate a given function?

I really appreciate your help.. :)
Toy LaFollette
I eat paintchips
Join date: 11 Feb 2004
Posts: 2,359
01-16-2006 21:52
llDialog


http://secondlife.com/badgeo/wakka.php?wakka=llDialog
_____________________
"So you see, my loyalty lies with Second Life, not with Linden Lab. Where I perceive the actions of Linden Lab to be in conflict with the best interests of Second Life, I side with Second Life."-Jacek
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
01-17-2006 02:26
The physical alternative is to create your object.

Create yuur buttons

Link them all together

In each of the buttons put this
CODE

default
{
state_entry{}

touch_start( integer num )
{
llMessageLinked( LINK_ROOT,0,llGetObjectName() + "=touched",llDetectedKey() );
}
}

then in the root prim put this in the link_message section
CODE

link_message( integer set, integer to,string mess, key id )
{
list temp = llParseString2List( mess,["="],[]);
string who = llList2String( temp,0 );
string what = llList2String( temp,1 );
//
// Your code - for example
if ( what == "touched" )
{
llSay ( 0, llDumpList2String( [llKey2Name(id),what,who]," " );
}
}


then when someone touches your "button" your main prim is told and you see
eg
fred touched button1
Richard Malaprop
Registered User
Join date: 19 Dec 2005
Posts: 5
Buttons
01-19-2006 05:17
Thank you so much for your help.. it work like a charm :)
Richard Malaprop
Registered User
Join date: 19 Dec 2005
Posts: 5
Need Help with Sensor and Dialog.. :(
01-26-2006 23:17
Ok.. I'm tryig to deteck someone, and send that person a menu.. But I'm getting confused.

Here's the code I have.

sensor(integer total_number)
{
vector pos = llGetPos();
integer j;
integer count = total_number;

for (j = 0; j < count; j++)
{
if(llDetectedName(j) != LOoking_For)
{
float diff = llVecDist(pos,llDetectedPos(j));
integer dist = llRound(diff);
string result = (llDetectedName(j)) + " " + ((string)dist) + "m";

if(llDetectedName(j) != LOoking_For)
{
Looking_For_Key = llDetectedKey(j);
Message = "On";
llMessageLinked(Stub_Button, 0, Message, "";);
}
}
else
{
Message = "Off";

}
llMessageLinked(Stub_Button, 0, Message, "";);
}
}



listen(integer channel, string name, key id, string message)
{

llSensorRepeat(LOoking_For,"",AGENT,200,PI,.5);

Ear = llParseString2List(message, [" "],[]);


list The_COMMANDS = ["Button_1", "Button_2", "Button_3"];
list Temp1;

if The_COMMANDS, [llList2String(Ear, 0)]) != -1) // verify dialog choice
{
llDialog(Looking_For_Key, "What do you want to do?", The_COMMANDS CHANNEL);
...
}
}


Thanks :)