Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

new to scripting.. how to make a sound

Egon Rothschild
Never Enough Prims
Join date: 22 Apr 2006
Posts: 556
05-28-2007 08:58
i've never written a script in sl yet. i have looked on the lsl-wiki and have read the crash course on scripting. the course outlines the general syntax of the sl scripting language.

i have also found the script library page.

what i seem to be missing is a guide to how each function works.

as an example...

i just build a small fountain. for the water prims.. i have put the appropriate texture on them and copies an pre-packaged animation script into the contents of the script. so far everything looks fine.

however, i also have some water sounds (bubbling, flowing, etc) that i would also like to put into the water prims. if i just move them into the prim, nothing happens. so i assume i need a script to run those sounds.

in the script library i have found quite a few functions for sounds. they are all listed very nicely and explain what they do. what is NOT described is HOW they do it.

as a test, i have created a simple box. no textures. i have put the sound file "bubbling_water.wav" into the prim's contents tab along with the following script:

default
{
state_entry()
{

llPlaySound(bubbling_water.wav, 1)

}
}

nothing happens. what am i doing wrong?

thanks in advance to an extreme script newbie.
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
05-28-2007 10:24
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llPlaySound

Check that link. Its probably just that the function takes a string parameter, try putting quotes around the name of your sound.
Egon Rothschild
Never Enough Prims
Join date: 22 Apr 2006
Posts: 556
05-28-2007 11:57
ok.. i changed the script to:

default
{
state_entry()
{

llPlaySound("bubbling_water.wav", 1)

}
}

and still nothing.

(btw.. the page you pointed me to shadow was the page where i found this script described)

do i need to DO anything? run this script? compile this script? i see things like "running" and "reset" when i have the script notecard open in the prim but don't know if i need to do anything with them. do i need to take the item back to inventoy and then re-rezz it?

i'm also familiar with tools menu bar and the recompile options there. does any of this apply to what i am trying to do?

is there any instructions anywhere as to how all this works besides the bare boned and very unhelpful lslwiki.. this is VERY frustrating.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
05-28-2007 12:06
don't ger frustrated. scripting takes calmness and humility. if it does not work, it is almost always your mistake.

So, to basics...are you getting any sounds from SL, aside from your script? Gestures, for example. If not, maybe it is your pc.

Is the name of the wav file **exact**? Same case, same spaces, etc.

If you go to the copy of the wav file in inventory, can you play it from there? (rt-click, I think.)

did you put the script IN the object? Scripts start running when they are put in an oject *unless* the Run box is unchecked. Scripts do not run from inventory.

Good luck.

PS, if you don't like the Wiki, then perhaps you could improve it by adding information.
Egon Rothschild
Never Enough Prims
Join date: 22 Apr 2006
Posts: 556
05-28-2007 12:32
found the problem... no semi-colon at the end of the PlaySound line...
Sterling Whitcroft
Registered User
Join date: 2 Jul 2006
Posts: 678
05-28-2007 15:46
Hiyas, Egon!
Could be the sound clip is to short to notice.
Will it work with llLoopSound("bubbling_water.wav", 1) ?
and is the '.wav' part of the sound name in world?
Here's some freebie code that works on a sound file named 'oceanlap'.

default {
state_entry() {
llLoopSound("oceanlap", 0.75);
}
}
Egon Rothschild
Never Enough Prims
Join date: 22 Apr 2006
Posts: 556
05-28-2007 16:29
thanks all (and hey sterling!).

From: someone
PS, if you don't like the Wiki, then perhaps you could improve it by adding information.[\qhote]

what i was pointing out earlier is that whereas there is a tutorial on scripting and a listing of scripting functions...

what seems to be missing is a description of the framwork on how to do this.

as examples:

1) there is a "running" box when you open a script. i only checked it because a friend told me to check it.
2) in the script description of llLoopSound (which is what i eventually used), it does not make clear that the sound file name needs to be in quotation marks.

it's small things like this (that all of you verterans know by second nature) that frustrate newbies like me. and of course, attempting to do this on a typical SL sunday (even tho it IS monday) with all of the typical sl-sunday-ness makes it ever worse ;)

again, thanks for all your time and suggestions.
Dnali Anabuki
Still Crazy
Join date: 17 Oct 2006
Posts: 1,633
05-28-2007 16:35
If you search for Freebies, there is a great find that includes sound scripts and sound prims where you just add the sound you want. The reason I mention it is that I look at scripts that already do what I want and learn from them and freebies often have great scripts attached.

Its like a huge script library waiting to be discovered but you do have to spend time hunting them down.
Egon Rothschild
Never Enough Prims
Join date: 22 Apr 2006
Posts: 556
05-28-2007 19:26
you bring a smile to my face, dnali.

i would LOVE to look at things other ppl do. it would give me an idea of ways to do things. unfortunately, all of my inventory with scripts usually tell me i am not authorized to view such scripts.

lol.
Dnali Anabuki
Still Crazy
Join date: 17 Oct 2006
Posts: 1,633
05-28-2007 22:13
I find scripts in all sorts of places. Have you been to Yadni's Junkyard? The gadgets boxes are full of things run by scripts that are open source.

Also, many of the classes give out open source scripts as part of the class supplies.

It's like a big treasure hunt. I have a bunch of free sound scripts and sound prims (loop, play on touch, intermittent, play at night or day) available at my place in the Lipshen sim. Just TP to the biggest land parcel and then go down the hill to the huts. The free sound scripts and prims are in the two revolving spheres in the hut to the left. The ground level is public including the house but the sky workshops have security on at the moment.
Egon Rothschild
Never Enough Prims
Join date: 22 Apr 2006
Posts: 556
05-29-2007 13:48
i've not been there dnali. i'll be sure to go.

and i'll look up your place too when i get a chance.

i have signed up for announcements from TUI and other teaching groups. hope to be able to attend one of them soon.

thx again all.