Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sound Script Problem

RaveWolf Strauss
Registered User
Join date: 1 Jan 2006
Posts: 53
09-13-2008 02:43
yea ive been working on a sound script im wanting it to play a sound when typing instead of the keyboardloop but for some reason cant get this to work can someone help me please.

CODE
key owner_key;
integer owner_typing;

default
{
state_entry()
{

llSetTimerEvent(0.25);
owner_key = llGetOwner();
}

changed(integer change)
{
if(change & CHANGED_OWNER)
{
owner_key = llGetOwner();
}
}

on_rez(integer param)
{

}

run_time_permissions(integer perm)
{

}

timer()
{
integer iTypingState = llGetAgentInfo(owner_key) & AGENT_TYPING;
if(owner_typing)
{
if(!owner_typing)
{
llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), 1.0);
}
}
else
{
if(owner_typing)
{
llStopSound();
}
}

}
}
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
09-13-2008 02:58
I have not tried it in world, but on a quick scan of the script, I thing your problem is the first line of the Timer event, you are declaring iTypingState but testing owner_typing.
change the event to:
timer()
{
if(llGetAgentInfo(owner_key) & AGENT_TYPING)
{
llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), 1.0);
}
else
{
llStopSound();
}
}
RaveWolf Strauss
Registered User
Join date: 1 Jan 2006
Posts: 53
awesome
09-13-2008 03:17
ty very much for your time and help! the timer event was the problem as you stated.When i get the item completed ill send you a copy.Ty once again....