Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dialog Menu/Music problems

Rachell Weatherwax
Registered User
Join date: 28 Nov 2007
Posts: 3
12-29-2008 10:50
I'm trying to write and menu drive radio changer. Below is a portion of the code:

//code
else if (message == "Country";)
llSay(0, "This is where stuff would happen if this wasn't just an example";);
llSetColor(<0.0, 0.0, 1.0>, ALL_SIDES);
llSetParcelMusicURL (Country);

if (message == "Martini";)

llSetColor(<0.9, 0.0, 0.0>, ALL_SIDES);
llSetParcelMusicURL (Martini);

if (message == "Jazz";)

llSetColor(<0.0, 0.9, 0.0>, ALL_SIDES);
llSetParcelMusicURL (Jazz);

} else
//code

I am puzzled that the music heard always reverts to the last selection, Jazz in this case. So if I selected Country from the menu, I hear that station momentarily before it reverts to Jazz. The object color associated with the station does not revert. Help is always appreciated.
Zaine Swords
Registered User
Join date: 26 Nov 2008
Posts: 47
12-29-2008 11:01
it sounds like the parcel your on might be set for a group. so inorder for you to be able to listen to your station you have to be part of the land group.
Rachell Weatherwax
Registered User
Join date: 28 Nov 2007
Posts: 3
12-29-2008 11:11
I think I have the group thing covered, I deed the scripted object to the group and then test. Just that whatever the last station on the list is, that is what plays. Thanks.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
12-29-2008 11:24
You've hit one of the quirks LSL inherited from its C syntax, the curly braces {} are optional, but if you leave them out only the first following statement is controlled by the if.

So, where you have:

CODE

if (message == "Martini")

llSetColor(<0.9, 0.0, 0.0>, ALL_SIDES);
llSetParcelMusicURL (Martini);


you instead want to use:

CODE

if (message == "Martini") {

llSetColor(<0.9, 0.0, 0.0>, ALL_SIDES);
llSetParcelMusicURL (Martini);
}


…and so on for the other if statements.

It's not a bad idea to just get in the habit of using the {} even if there is only one statement, so that you don't run into these surprises.
Rachell Weatherwax
Registered User
Join date: 28 Nov 2007
Posts: 3
12-29-2008 11:36
Major Hugs - thanks, gotta watch out for them curleys.