|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
03-27-2006 18:27
I have a problem with detecting when an avatar sits. I cut from the wiki changed event, and eventually pared it down to this to see if it actually detects anything. default { state_entry() { } changed(integer change) { if (change & CHANGED_LINK) { if (llAvatarOnSitTarget() != NULL_KEY) { llOwnerSay("someone sit down?"); } else if (llAvatarOnSitTarget() == NULL_KEY) { llOwnerSay("someone stood up?"); } else llOwnerSay("woops"); } }
}
Whether I sit down on or stand up from the object, I always get the second message, "someone stood up?". How do I get it to detect when I actually sit down??? Thanks, Baron
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
03-27-2006 18:33
You need to set a sit target for that to work.
|
|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
03-27-2006 19:32
Oh. I started out setting the sit target, but it was set at <0,0,0>. Apparently, I never hit it. When I changed it to <0,0,.5>, that worked.
Now, though, I am trying to deal with linked prims.
Here is the problem.
I need to detect when someone sits down on the child prim. According to the wiki, the changed event does not work in a child prim. So, can I use llSitTarget in a child prim and detect the changed event from a script in the root prim? Or am I completely barking up the wrong tree????
Thanks, Baron
|
|
Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
|
03-27-2006 19:59
I've never had a problem with using changed in a child prim. In fact, my glasses of town portal spawn portals that rely on that. Also, changed will only fire on sitting if the sit target is set to a non-ZERO_VECTOR value. So <0,0,0> will reset the sit target and stop it from firing, <0,0,0.001> will let it fire.
|
|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
03-27-2006 20:47
Well, it turns out to work well as long as the script is RUNNING. I had forgotten that I had turned it off, then wondered why it did not appear to log changed events. duh. Now it works.
Baron
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
03-27-2006 21:20
From: Baron Hauptmann Oh. I started out setting the sit target, but it was set at <0,0,0>. Apparently, I never hit it. When I changed it to <0,0,.5>, that worked. Now, though, I am trying to deal with linked prims. Here is the problem. I need to detect when someone sits down on the child prim. According to the wiki, the changed event does not work in a child prim. So, can I use llSitTarget in a child prim and detect the changed event from a script in the root prim? Or am I completely barking up the wrong tree???? Thanks, Baron Ah - a sit target of ZERO_VECTOR turns the sit target off. The Wiki appears to be very wrong... I'm off to have a look-see.
|