Miroslaw Bukowski
Registered User
Join date: 12 Dec 2003
Posts: 46
|
08-10-2005 22:23
Oki... since I really suck at scripting.... I hope that maybe somebody in here can help me. I am trying to add a sound effect to a fence I made on a current build I am working on. But when I use this script it makes the prim phantom. Any idea how to fix this? string Sound = "fenceslam";
default { state_entry() { llVolumeDetect(TRUE); llPreloadSound(Sound); }
collision_end(integer total_number) { llPlaySound(Sound, 1.0); }
}
_____________________
01001101011010010111001001101111011100110110110001100001011101110010000001000010011101010110101101101111011101110111001101101011011010010010000001101111011101110110111001011010001000000110101000110000001100000010000100100001
|
Miroslaw Bukowski
Registered User
Join date: 12 Dec 2003
Posts: 46
|
08-10-2005 22:29
opps... sorry... double post... too bad I can't delete that last one o_0
_____________________
01001101011010010111001001101111011100110110110001100001011101110010000001000010011101010110101101101111011101110111001101101011011010010010000001101111011101110110111001011010001000000110101000110000001100000010000100100001
|
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
|
08-11-2005 02:36
From the LSL wiki page: llVolumeDetect(integer detect)
When detect = TRUE, this makes the entire link set the script is attached to phantom. But, if another object interpenetrates it, it will get a collision_start event. When an object stops interpenetrating, a collision_end event is generated. While the other is interpenetrating, collision events are NOT generated. The script must be applied to the root object of the link set to get the collision events. Collision filters work normally (see llCollisionFilter). I think you may be wanting llCollisionSound.
|
Miroslaw Bukowski
Registered User
Join date: 12 Dec 2003
Posts: 46
|
08-11-2005 08:37
kewl... it worked just by removing TRUE and replacing it with FALSE in llVolumeDetect(TRUE);
silly me....
_____________________
01001101011010010111001001101111011100110110110001100001011101110010000001000010011101010110101101101111011101110111001101101011011010010010000001101111011101110110111001011010001000000110101000110000001100000010000100100001
|
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
|
08-12-2005 06:28
I'm glad it is working, but just wanted to note that though llVolumeDetect(FALSE) did un-phantom your object it also stopped VolumeDetection and is just using the collision_end() event that happens to every prim by default. So it is making both a regular collision "bonk" sound which is probably not heard over your "fenceslam".
llVolumeDectect was added to the LSL API to make prims that objects pass through generate collision events because prior to that call, a phantom object would not generate collisions.
|
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
|
08-12-2005 07:05
I have to agree with Malachi on this. Use llCollisionSound(). Not only does it work better since you won't have both the default noise and the fence noise but it will simplify your script.
The only real reason you would want to call a sound in a collision event instead is if you were trying to replace the collision particles as well as the sound by setting llCollisionSound volume to 0 and thus suppressing the particles (odd as that is).
|