|
Fairge Kinsella
Gravity isn't so serious!
Join date: 23 Oct 2004
Posts: 158
|
10-12-2005 03:48
I'm trying to use llCollisionFilter() to cut down on the number of collisions I have to check to see if I have hit a specified prim, a simple version of my script is below. If I take out the if statement inside the collision event, the prim containing this script says "Bumped!" for every prim it collides with, not just the prim named "Stop Here"; I've checked the wiki, but I wonder of I've got the wrong idea. What does llCollisionFilter() actually do? Thanks, Fairge string strStopPrim = "Stop Here";
init() { llCollisionFilter(strStopPrim, NULL_KEY, TRUE); }
default { state_entry() { init(); state running; }
}
state running {
collision(integer num_detected) { if (llDetectedName(0) == strStopPrim) { llOwnerSay("Bumped!"); } } }
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
10-12-2005 05:23
Don't change state. string strStopPrim = "Stop Here";
default { state_entry() { llCollisionFilter(strStopPrim, NULL_KEY, TRUE); }
collision(integer num_detected) { llOwnerSay("Bumped!"); } }
Or call init() again in state running ?
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Fairge Kinsella
Gravity isn't so serious!
Join date: 23 Oct 2004
Posts: 158
|
10-12-2005 16:45
You caught exactly where I went wrong. I called llCollisionFilter() in the state_entry of the state where I catch the collision, and it does just what I had been expecting. Thanks for the help. I will go and write "Always check if it is a state specific buggerup before posting" 10 times. Cheers, Fairge
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
10-12-2005 23:27
You don't need to feel sorry about it, AFAIK the loss of collision filter setting at change state isn't mentionned in the LSL Wiki  Someone ought to add it... *looks around* anyone ?
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
10-13-2005 05:31
From: Jesrad Seraph Someone ought to add it I agree - I'd like to see a table that lists what does or doesn't persist across states. We all know that listens don't, for example (they don't, right?) but I was happily switching states to clean up my llTargets when I discovered that they DO persist. *also looks around*
|