Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menus.

Axel Leroy
Registered User
Join date: 31 Dec 2006
Posts: 6
01-17-2007 11:39
I just cant seem to find out how Xcite did their menus.
Any help would be apreciated.

Probably just something ive missed but ive done tons of different searches on these forums and in the wiki. Guess i just aint looking for the right thing.

Thanks :)
Jessica Hull
Registered User
Join date: 11 Sep 2006
Posts: 3
01-17-2007 12:27
You should probably be more specific with your questions, but..

The Xcite! products mainly use, to my knowledge, the llDialog function so that when the part is clicked by someone, depending on whether by the owner or someone else, it would send a dialog to the clicker with a line of source that would look something like:

llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL);

The part in quotes would be the text in the dialog. MAIN_MENU refers to a list item which contains the buttons that would appear in the dialog box. The list item could be created, for example, by:

list MENU_MAIN = ["Sit", "Stand", "Fly", "Cheat", "Options..."];

Finally, CHANNEL refers to an integer of the channel on which the user's answer should be broadcast. The script could listen for an answer in this way and act accordingly, either by performing some function or saying something or sending the user a new dialog (as in a settings button that brings up another dialog with some settings, for example).

There's plenty of information about this on the wiki, you might want to check there. Just search llDialog.

Happy coding :)
Axel Leroy
Registered User
Join date: 31 Dec 2006
Posts: 6
01-17-2007 14:03
Ah thanks :)

Whoa when you explain stuff you certainly go in depth llDialog function is exactly what i was loonking for ^^
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-17-2007 14:06
From: Axel Leroy
Ah thanks :)

Whoa when you explain stuff you certainly go in depth llDialog function is exactly what i was loonking for ^^



I suggest you browse the New scripters start here thread, covers a lot of the basic's and would have directed you to the wikki.
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-27-2007 12:09
Hi all,
using a menu driven dialog script for changing colors. the Basic colors work no problem till I get to pink the <255,72,167> is returnning a default blank here is the code;

integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
menu_channel = (integer)(llFrand(99999.0) * -1);
menu_handler = llListen(menu_channel,"","","";);
llDialog(user,title,buttons,menu_channel);
llSetTimerEvent(5.0);
}

default
{
touch_start(integer t)
{
menu(llDetectedKey(0),"Piano Color Menu",["red","pink","black","white","blue"]);
}
timer() //so the menu timeout and close its listener
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}
listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners
{
if(message == "red";)
{
llSetLinkColor(4,<128,0,0>, ALL_SIDES);
llSetLinkColor(5,<128,0,0>, ALL_SIDES);
llSetLinkColor(6,<128,0,0>, ALL_SIDES);
llSetLinkColor(7,<128,0,0>, ALL_SIDES);
llSetLinkColor(8,<128,0,0>, ALL_SIDES);
llSetLinkColor(9,<128,0,0>, ALL_SIDES);
llSetLinkColor(10,<128,0,0>, ALL_SIDES);
llSetLinkColor(11,<128,0,0>, ALL_SIDES);
llSetLinkColor(12,<128,0,0>, ALL_SIDES);
llSetLinkColor(13,<128,0,0>, ALL_SIDES);
}
else if(message == "pink";)
{

llSetLinkColor(4,<255,72,167>, ALL_SIDES);
llSetLinkColor(5,<255,72,167>, ALL_SIDES);
llSetLinkColor(6,<255,72,167>, ALL_SIDES);
llSetLinkColor(7,<255,72,167>, ALL_SIDES);
llSetLinkColor(8,<255,72,167>, ALL_SIDES);
llSetLinkColor(9,<255,72,167>, ALL_SIDES);
llSetLinkColor(10,<255,72,167>, ALL_SIDES);
llSetLinkColor(11,<255,72,167>, ALL_SIDES);
llSetLinkColor(12,<255,72,167>, ALL_SIDES);
llSetLinkColor(13,<255,72,167>, ALL_SIDES);
}
else if(message == "black";)
{
llSetLinkColor(4,<0,0,0>, ALL_SIDES);
llSetLinkColor(5,<0,0,0>, ALL_SIDES);
llSetLinkColor(6,<0,0,0>, ALL_SIDES);
llSetLinkColor(7,<0,0,0>, ALL_SIDES);
llSetLinkColor(8,<0,0,0>, ALL_SIDES);
llSetLinkColor(9,<0,0,0>, ALL_SIDES);
llSetLinkColor(10,<0,0,0>, ALL_SIDES);
llSetLinkColor(11,<0,0,0>, ALL_SIDES);
llSetLinkColor(12,<0,0,0>, ALL_SIDES);
llSetLinkColor(13,<0,0,0>, ALL_SIDES);
}
else if(message == "white";)
{
llSetLinkColor(4,<1,1,1>, ALL_SIDES);
llSetLinkColor(5,<1,1,1>, ALL_SIDES);
llSetLinkColor(6,<1,1,1>, ALL_SIDES);
llSetLinkColor(7,<1,1,1>, ALL_SIDES);
llSetLinkColor(8,<1,1,1>, ALL_SIDES);
llSetLinkColor(9,<1,1,1>, ALL_SIDES);
llSetLinkColor(10,<1,1,1>, ALL_SIDES);
llSetLinkColor(11,<1,1,1>, ALL_SIDES);
llSetLinkColor(12,<1,1,1>, ALL_SIDES);
llSetLinkColor(13,<1,1,1>, ALL_SIDES);
}
else if(message == "blue";)
{

llSetLinkColor(4,<0,0,128>, ALL_SIDES);
llSetLinkColor(5,<0,0,128>, ALL_SIDES);
llSetLinkColor(6,<0,0,128>, ALL_SIDES);
llSetLinkColor(7,<0,0,128>, ALL_SIDES);
llSetLinkColor(8,<0,0,128>, ALL_SIDES);
llSetLinkColor(9,<0,0,128>, ALL_SIDES);
llSetLinkColor(10,<0,0,128>, ALL_SIDES);
llSetLinkColor(11,<0,0,128>, ALL_SIDES);
llSetLinkColor(12,<0,0,128>, ALL_SIDES);
llSetLinkColor(13,<0,0,128>, ALL_SIDES);
}
}
}
}
could sure use some understanding here. ty
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
01-27-2007 12:33
Ray:

In scripts, color vectors don't run from 0 to 255, they run from 0 to 1. Take all those numbers and divide by 255 and you'll be set.

The "black" and "white" sections are correct though, leave them alone.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-27-2007 12:34
Colour intensities are in the range 0.0 - 1.0 not 0-255

Also since your code is setting each prim to the same colour try using a loop to improve performance.

EDIT: I had said use llSetPrimitiveParams but of course that doesnt work with link sets!
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-27-2007 18:19
ok, ty it has me fooled because green , red & blue work just fine at <128,0,0> respectively so although I respect all your answers & will definately try it back ingame in a few, still "Colour intensities are in the range 0.0 - 1.0 not 0-255" something clearly is amiss or not fully explained otherwise red , green & blue would also return a blank color, no?

ok, after going in game trying the divide by 255, it did give me a color (better than default white :-)) however, the color was purple not pink so I hit the color chooser in the edit box and select pink the color picker shows <255,0,255> so what the hay I try it even though each number is not <1, and I get pink.
Could the one place in the vector number being either 0 0r 1, explain it?
So, gang we got the result but the explainations leave me wiggle room lol, also Newgate ty for the tip on loop I will look into that I probably have a few scripts that will show me an example.
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
01-27-2007 19:08
Regarding Red, Green, And Blue, they are working fine because the colors are in the form <R,G,B>. So, when you put <128,0,0>, that is actually the same as <1,0,0>, as I understand. LSL takes anything ABOVE 1 and just makes it 1. Since the Green and Blue values are 0, it shows up as red. BUT, it shows up as full red. I think that the 128 value intends for it to be a darker red, which would really be <.5, 0, 0>.

So, for consistency, you either make all your values between 0 and 1, or when you apply them, you divide by 255. Then you should get what you are expecting.

Baron H.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-28-2007 01:39
From: Ray Musketeer
ok, ty it has me fooled because green , red & blue work just fine at <128,0,0> respectively so although I respect all your answers & will definately try it back ingame in a few, still "Colour intensities are in the range 0.0 - 1.0 not 0-255" something clearly is amiss or not fully explained otherwise red , green & blue would also return a blank color, no?

ok, after going in game trying the divide by 255, it did give me a color (better than default white :-)) however, the color was purple not pink so I hit the color chooser in the edit box and select pink the color picker shows <255,0,255> so what the hay I try it even though each number is not <1, and I get pink.
Could the one place in the vector number being either 0 0r 1, explain it?
So, gang we got the result but the explainations leave me wiggle room lol, also Newgate ty for the tip on loop I will look into that I probably have a few scripts that will show me an example.


As Baron explained LSL caps a value so anything over 1 becomes 1.

As for loops, here is your menu code rewritten a little bit more efficiently.
It can be optomised further but this shows youa few better techniques

CODE

integer menu_handler;
integer menu_channel;

list Colours = ["red","pink","black","white","blue"];
list Intensities = [ <1,0,0>,<1,0.2824,0.655>,<0,0,0>,<1,1,1>,<0,0,1>];

menu(key user)
{
//make dialog easy, pick a channel by itself and destroy it after 5 seconds
string title = "Piano Color Menu";
menu_channel = 0 - (integer)llFrand(99999);
menu_handler = llListen(menu_channel,"",user,"");
llDialog(user,title,Colours,menu_channel);
llSetTimerEvent(5.0);
}

CancelListen()
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}

SetColours(vector colour)
{
integer index;
for(index=4;index <= 13;++index)
{
llSetLinkColor(index, colour, ALL_SIDES);
}
}

default
{
touch_start(integer t)
{
menu(llDetectedKey(0));
}

timer() //so the menu timeout and close its listener
{
CancelListen();
}

listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners
{
integer index = llListFindList(Colours,[message]);
if(index >= 0)
{
vector colour = (vector)llList2String(Intensities,index);
SetColours(colour);
}
}
}
}
Ray Musketeer
Registered User
Join date: 22 Oct 2005
Posts: 418
01-28-2007 20:03
ty ty ty all for clearing up my confusion, checking back in old class notes I see I was suppose to remembr this, lol. Newgate, way to get me thinking :-) (I have so much to learn) that last brain cell starting to scream now rofl.

Btw, works beatifully!