Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Play sounds wile AV walks

raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
03-19-2008 09:04
im looking for help with a script,,, i know how to make a basic loop sound script but what i want is a script that will play a sound when your AV walks. i hope someone can point me in the right direction.

i came up with this but i cant tell if it works or not my sound is kinda quiet so if its working i cant hear it,,, can someone see if there is a bug in it or test it on one of your own sounds that is loud?

key owner;
integer status;
initialize()
{
llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), 1);
llSetTimerEvent(.5);
owner = llGetOwner();
status = 0;
}

default
{

state_entry()
{
if(llGetOwner() != owner)
{
initialize();
}
}

on_rez(integer total_number)
{
if(llGetOwner() != owner)
{
initialize();
}
}

timer()
{
integer temp = llGetAgentInfo(owner) & AGENT_WALKING;
if (temp != status)
{
llStopSound();
status = temp;
}
}
}
Ryann Slade
Registered User
Join date: 5 Jan 2008
Posts: 8
03-19-2008 09:15
hmmmmmmm Lets look :)
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
03-19-2008 09:20
hmmm ya this is cleaner but well it didnt work quite right,,, it looped the sound till i started walking then it stoped and wont start again
Ryann Slade
Registered User
Join date: 5 Jan 2008
Posts: 8
03-19-2008 09:33
Try this!

From: someone

///////////////////////////////
// Edit the strings below to reflect your sound names.
// Make sure you load the sounds into the object
///////////////////////////////

string Start_Walk = "start";
string Stop_Walk = "stop";
string Walking = "walking";

string last_state = "";

key ownerkey;

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

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

timer()
{
string anim_state = llGetAnimation(ownerkey);
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;
}
}
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
03-19-2008 09:37
ya that works but sound dont stop when i stop it plays out

gonna tweek the script a bit change things as noted in it :D

edit
got it had to take out llPlaySound(Stop_Walk, 1.0); //same volume info as above, comment
it helps if i read things lmao
Ryann Slade
Registered User
Join date: 5 Jan 2008
Posts: 8
03-19-2008 09:43
LOL yea I get that alot forget to read :P
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
03-19-2008 09:44
ok now i have flipflops that play sound but not so loud that i piss off other people lol i plan to sale these so is there anything you want for the help with the script?
Ryann Slade
Registered User
Join date: 5 Jan 2008
Posts: 8
03-19-2008 09:46
just give me a shout later in game :)
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
03-19-2008 09:47
lol already IMed you ingame gonna drop you a pair of my flipflops when i finish them gotta make a script to change the color of them :D that i can do with no problems
Ryann Slade
Registered User
Join date: 5 Jan 2008
Posts: 8
03-19-2008 09:51
I have a script I made in game that is menu based color changer :)