Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Open/Close Mouth Script

jaas Box
Registered User
Join date: 10 Jan 2007
Posts: 19
01-15-2007 06:59
I have this item, that I want to have 2 prims open and close, kind of like a mouth.
When you touch the item, a sound is played, opens the item up and plays another tune.
What should I script? Any help would be much appreciated seeings how I have never scripted in any language let alone sl script before. Thanks in advance.

Jaas
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-15-2007 08:36
A few ways of doing it.
You could use a single prim and a texture to make the mouth appear to open using llSetTexture.
Or you can use multiple prims, and actually make the lips move using llSetPos or llSetRot.

Sounds can be played using llPlaySound.

Semi Pseudo code
CODE

string SoundName = "MySound"; // name of Sound file
float Volume = 1.0; // Volume at which to play it
float SoundLength = 3.0; // Length of file in seconds
default
{
state_entry()
{
ClosedMouth();
}

touch_start(integer num_detected)
{
OpenedMouth();
llPlaySound(SoundName,Volume);
llSleep(SoundLength);
ClosedMouth();
}
}

If you wanted the mouth to open and shut during the play back you could do so.
jaas Box
Registered User
Join date: 10 Jan 2007
Posts: 19
01-15-2007 08:46
Well I don't want anything too fancy, just a simple open and close. kind of like a puppet.
I take it I add that script to the prim i want to move, correct? And just replace the sounds I want with whatever sounds I have in my library?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-15-2007 11:03
LOL, yes and no.
That was just a sketch, you will need to write the Open and Close functions yourself.
If you need a hand IM me in world and if I'm on I'll come over.
jaas Box
Registered User
Join date: 10 Jan 2007
Posts: 19
01-16-2007 18:12
Well seeings how I am new at the script writing, any help would be much appreciated. Like what it all means, how to put it together, etc.
Heck even it's something small like this function, then cool
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-17-2007 00:57
From: jaas Box
Well seeings how I am new at the script writing, any help would be much appreciated. Like what it all means, how to put it together, etc.
Heck even it's something small like this function, then cool



Well the actual functions will be dependant upon how you have built the mouth. Will be much easier to help you if I can see what it is!

Meanwhile I suggest you look at llSetPos and llSetRot in the wikki and se if you can work it out yourself.
jaas Box
Registered User
Join date: 10 Jan 2007
Posts: 19
01-17-2007 09:07
I will look at those now. Thanks for the info. Are there other tutorials besides the small ones in the Wiki? I mean I know I can learn the code and all, but putting it all together so it actually does something is a different story.

Are there offline script testing apps or websites to test scripts in? Aside from actually going into the SL client?

The reason I ask, is because I can't really load the client up at work, but I can make it look like I am programming ;)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-18-2007 02:01
From: jaas Box
I will look at those now. Thanks for the info. Are there other tutorials besides the small ones in the Wiki? I mean I know I can learn the code and all, but putting it all together so it actually does something is a different story.

Are there offline script testing apps or websites to test scripts in? Aside from actually going into the SL client?

The reason I ask, is because I can't really load the client up at work, but I can make it look like I am programming ;)


look at the Alternative Editors page in the wikki for various different editors.

I personally use Scite-Ez and occassionally Notepad++.
For 'compiling' offline I use lslint which has recently been updated and is worth downloading although you can use it via the web.