Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reading descriptions from sound files in contents

Skilar Windlow
Registered User
Join date: 17 Nov 2008
Posts: 26
03-14-2009 08:53
I have an object that contains maybe 5 or 6 sound files in its contents. The script that i have running picks one of the sound files at random and plays it. I also want to be able to read the description for the sound file that i've picked as well. But I'm not sure exactly what LSL function to call. Seems like the llGetObjectDesc gets info for the object which the script is running in ... not objects that are contained in the contents. Any help would be appreciated!!! Thanks in advance for your help!!!

Skilar Windlow
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
03-14-2009 09:57
You can't. Period.

llGetObjectDetails() is the function you're looking for if you want the description of another object. Alas it doesn't work with objects in inventory, only with rezzed objects... and I don't think you can rez sounds. :P
Skilar Windlow
Registered User
Join date: 17 Nov 2008
Posts: 26
Ugh
03-14-2009 11:16
Seriously????? There's no way???? Baaaaaaaaaaaaaaaaaaaaah!!! That sucks because i guess that means i need to result to notecards to match up sound with text. Boooooo!!! His!!!!

Skilar
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-14-2009 12:22
or extend the names of your sound files to include a description.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Skilar Windlow
Registered User
Join date: 17 Nov 2008
Posts: 26
Possible
03-14-2009 16:59
Yes ... it's possible. I think what i'm going to end up doing is just setting up 2 separate lists that will contain the sound file name and corresponding text in the same index position. So I'll play the sound at index i in the first list and output the text at index i in the 2nd list. Will just have to update the script when i want to add more. It's crude but i think it will work.

Skilar
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-15-2009 00:27
or use a single strided list, with i being the filename, and i + 1 being the description. (personally I like seperate lists, but a single list is easier to read in codewise... not sure the parsing overhead is worth it though)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Skilar Windlow
Registered User
Join date: 17 Nov 2008
Posts: 26
Well
03-15-2009 09:01
Only thing with a single list is i plan on randomly selecting one to play when somebody touches it. Don't want to have to deal with one list that could randomly select any position in the list.

Skilar Windlow
Ferd Frederix
Registered User
Join date: 19 Dec 2007
Posts: 5
03-15-2009 09:55
From: Void Singer
or extend the names of your sound files to include a description.


With only 5 or 6 sound files, this is a good answer. For hundreds of sounds, it is still a good answer. Less work, almost no chance of error.

I would just rename them. You have 63 chars to work with. Is easy, simple, and fast. Pick a random number <= count of INVENTORY_SOUND, cast it to an integer, and play that sound and announce it's name.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-15-2009 17:01
From: Skilar Windlow
Only thing with a single list is i plan on randomly selecting one to play when somebody touches it. Don't want to have to deal with one list that could randomly select any position in the list.

Skilar Windlow

that's a simple modification of your random function

(integer)llFrand( listLength / 2 ) * 2
or
(integer)llFrand( NumOfSongs ) * 2

you can even shuffle the single list for sequential playback with

llListRandomize( songList, 2 );
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -