Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Playing a sound when an avatar seats and unseats

Blaccard Burks
Registered User
Join date: 6 Apr 2007
Posts: 157
07-03-2007 01:38
Hereis a typical sitting script....

[START CODE]

string MENU_TEXT = "Ride!";
vector POSITION=<0,0,0>;
rotation ROTATION=<0,0,0,1>;

default
{
state_entry()
{
llSetSitText(MENU_TEXT);
llSitTarget(<-0.43268, -0.02157, -0.4>, <-0.51714, 0.48223, 0.57935, -0.40543>;);
llSetCameraEyeOffset(<-2, 4, 0>;);
llSetCameraAtOffset(<-1.5, -3, 0>;);
}

changed(integer change) {
if (change & CHANGED_LINK)
if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(),PERMISSION_TRIGGER_ANIMATION);
}
}

run_time_permissions(integer perm) {
if (perm & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit";);
llStopAnimation("sit_female";);
llStopAnimation("sit_generic";);
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, 0));
llPlaySound("sound_sit";);

}
}
}

[END CODE]

I can have a sound play when the avatar sits, but fo the life of me I can't get a stable unsitting sound.... any ideas?

ThANKS!
Noctua Janus
Registered User
Join date: 22 Mar 2007
Posts: 29
07-03-2007 01:48
If you get change & CHANGED_LINKand no avatar is sitting on your prim then your avatar stood up ;)

From: Blaccard Burks

changed(integer change) {
if (change & CHANGED_LINK)
if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(),PERMISSION_TRIGGER_ANIMATION);
}
else
llPlaySound("unsit";);
}
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
07-03-2007 05:10
Although I'm not positive what the underlying reason here is, I would caution against such a frequent sound with the issues with llPlaySound and llTriggerSound that are evidently never going to be fixed.
Blaccard Burks
Registered User
Join date: 6 Apr 2007
Posts: 157
07-03-2007 21:54
From: Noctua Janus
If you get change & CHANGED_LINKand no avatar is sitting on your prim then your avatar stood up ;)


I actually did the same routine, but it came me problems, sometimes working sometimes playing both sounds at the same time and now because the prims are linked every prim has the same defect.