Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

adding sound?

Stinky Omlet
Registered User
Join date: 12 Mar 2006
Posts: 23
07-27-2007 13:58
I have this typing AO script that I can add my own animation to it.. I want to add sound as well.. I looked up on wiki and that helped a lot.. I can add the sound, so when I type it plays and when I stop the sound stops too.. but is there a way to make the sound only play at the start of the typing and not keep playing as you type? like the default typing sound, where when you start typing, it sounds like you are typing on a keyboard but it only plays for a sec then stops even though you are still typing.. how can I make it like that but with my own sound?

I hope I explained this good

Thx

PS
I'm a big noob when it comes to scripting
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
07-27-2007 14:02
Might be easier if you post your current code for people to work from.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
07-27-2007 14:37
There's two ways I can think of.

1) Make your sound 1 second long. Then use something like llPlaySound (not llLoopSound) and it will play the one second sound, and stop.

2) User a timer. For example, start playing or looping your sound, set the timer for 1 second:

llSetTimerEvent(1.0)

Then in your timer event stop the sound and stop the timer:

timer()
{
llStopSound();
llSetTimerEvent(0.0);
}
Stinky Omlet
Registered User
Join date: 12 Mar 2006
Posts: 23
07-27-2007 15:28
From: Milambus Oh
Might be easier if you post your current code for people to work from.


I would do that but my friend made the script for me so I'm not trying to let everyone have it.. I havn't seen him on in awhile so I can't have him do it...

RJ: I'll try out that timer thing.. thx
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
07-27-2007 15:40
refer to this:
http://rpgstats.com/wiki/index.php?title=LibraryKeyboardScript

this should resemble some of the code in your script. If you keep track of whether you are typing or not typing, you can initiate the typing sounds only when the state has changed from not typing to typing.

Basically a direct copy from that reference should help you along. That one was setting alpha of a keyboard prim.. but the same logic should apply.
Stinky Omlet
Registered User
Join date: 12 Mar 2006
Posts: 23
07-27-2007 15:47
I found this free typing script... how would I add sound to it?

this isn't the script my friend made, its just a free one that I found in SL..

// the first free keyboard script
// by nonnux White
// free to mod, sell, erase, explode, burn :)
list anims = [];
default
{
state_entry()
{
llSetTimerEvent(.2);
}
timer()
{
anims = llGetAnimationList(llGetOwner());
if(llListFindList(anims,[(key)("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9";)]) != -1)
{
llSetText("",<1,0,0>,1);
llSetLinkAlpha(LINK_SET,1.0,ALL_SIDES);
}
if(llListFindList(anims,[(key)("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9";)]) == -1)
{
llSetText("",<1,1,0>,1);
llSetLinkAlpha(LINK_SET,0.0,ALL_SIDES);
}
}
}
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-30-2007 02:37
From: Stinky Omlet
I found this free typing script... how would I add sound to it?...
Wondering if this got resolved in the interim. If not, I could throw together some minimal typing AO with sound, for illustration purposes. The posted script is not a good place from which to start, for several reasons (one of which I mumble about in another thread, ).