Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sounds Wile moving

raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
07-25-2008 02:02
I am still rather new to scripting been kinda learning on my own and I have yet again ran into some problems I know nothing about. A wile back I made a script for shews that would play sound when walking, well I have taken it a step further and am wanting to make the script play other sound to other movements so I am going from sound when just walking to sound when standing, turning, and walking. I have it all working kinda but I think its a bit buggy and I need it to do a few more advanced things like play one sound if you are standing and turn right or left and then play another sound if you walk and turn left or right lets say if I am standing I want to hum if I am standing and turn left or right I still hum but if I walk I sing and if I walk and turn right or left still sing and not hum like its doing now. Again this is for a attachment kinda like a AO but for sounds not animations. I have also made another script with Dialog to turn the script on and off that works great need no help with that. so if anyone could help me out that would be great. will list my script below.


CODE

//name of sound in each ""
//example Start_Walk = "name here";

string Start_Walk = "";
string Stop_Walk = "";
string Walking = "";
string Standing = "";
string Turning_Left = "";
string Turning_Right = "";
string last_state = "";

key ownerkey;

default
{
state_entry()
{
llSetTimerEvent(0.5);
ownerkey = llGetOwner();
}

on_rez(integer start_param)
{
if (ownerkey != llGetOwner())
{
llResetScript();
}
}

timer()
{
if(llGetAttached() != 0)
{

string anim_state = llGetAnimation(ownerkey);
if (anim_state == "Standing" && last_state != "anim_state") //stopped walking
{
llPlaySound(Standing,1.0);
}
else if (anim_state != "Turning Left" && last_state == anim_state) //started walking
{
llPlaySound(Turning_Left,1.0);
}
else if (anim_state != "Turning Right" && last_state == anim_state) //started walking
{
llPlaySound(Turning_Right,1.0);
}
else if (anim_state == "Walking" && last_state != anim_state) //started walking
{
llPlaySound(Start_Walk, 1.0); //play the sound for the start of the walk, comment out this and the llSleep if you do not have a start sound. The number at the end is the volume between 0.0 and 1.0 adjust accordingly
llSleep(0.05); //see above
llLoopSound(Walking, 1.0); //same volume info as above
}
else if (anim_state != "Walking" && last_state == "Walking") //stopped walking
{
llStopSound();
// llPlaySound(Stop_Walk, 1.0); //same volume info as //above, //comment this out if you do not have a walk stopping sound
}
last_state = anim_state;
}
}
}


again thank to any help...
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
07-25-2008 05:54
If you want multiple sounds playing at the same time, you need multiple prims. A prim can only make one sound at a time, so if you want to trigger another sound, use link messages to send a command to another prim (you may need to add dummy prims to have these prims), and when the link_message () event is triggered, play the sound from the other prim.

http://www.secondscripter.com
_____________________
My tutes
http://www.youtube.com/johanlaurasia
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
not 2 sounds
07-25-2008 11:14
I don't want it to play 2 sounds at the same time i want it to play one sound wile doing 2 movements like standing and turning and walking and turning so not to play 2 sounds at the same time but rather to have A sound play wile doing both anim_state.