Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Frustrated, please help

Katelyn Brock
Registered User
Join date: 15 Jun 2006
Posts: 5
08-03-2006 15:31
Dear Forum members

After two weeks trying to get 3 simple scripts working I've done it.

3 scripts in three objects all working individually, then finally linked together.

Each script is designed to make a sound on collision from a non owner avatar or attachment.

Problem...

When linked only one script seems to work.

When attached to an avatar the script keeps making a sound.

Question 1, does linking 3 objects each with their own script mess things up?
Question 2, why might only one work when the three are linked?
Question 3, even tho the, if (llDetectedKey(0) != llGetOwner()), works well with the object unattached, it does not seem to work when the object is attached to the owner avatar.

I'm sorry, Please what am I missing? apart from a brain that is !

Kind regards to all

Katelyn
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
08-03-2006 18:15
Not really sure how to answer you, but just want to tell you that llOwnerSay should be your friend. You can tell which of your touch and sensor events are invoked by using, say

CODE

integer debug = TRUE; // put this somewhere at the head of each script
string z ="this script name";


Then where you expect things to happen you write things like:

CODE

if (debug)
llOwnerSay ( z + " sensor " + (string) whatever integer we entered this routine with


When you happy everything is working, just set each debug to FALSE.

Hope that helps.

Ed
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
08-04-2006 04:56
From: [url=http://secondlife.com/badgeo/wakka.php?wakka=collisions
LSL Wiki]
Attachments will not trigger collision events if the object itself collides with something else. However, if the avatar collides with the object, the collision event is triggered.
[/url]
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
08-04-2006 07:55
I'm not a pro scripter by any means, however, I'm pretty sure that if you set up collisions on multiple prims and then link them, it's only going to register the collision as being with the root prim and treat the children as an extension of it.

I have no idea if this would work, and have no way of testing it atm as I'm at work, but I would think that you can test this simply by setting up a script similar to this:

CODE
default
{
collision(integer num_detected)
{
llMessageLinked(LINK_ROOT, 1, "", llDetectedKey(0));
}
}


To send a message to the root prim that that prim had a collision. Now the root prim would not have a collision event in it, but would be set to receive the linked messages and play the sound based off of which prim or avatar reported the collision as reported in the message by the integer and llDetectedKey.

Simple way to test this would be to take the above script, put in one prim, take another prim and put the same script with the message integer having a 2 instead, and have the 3rd root prim say what link message it receives when you have people collide with it.

If it returns the #'s correctly based off of what prim was run in to, then you should be golden.
Katelyn Brock
Registered User
Join date: 15 Jun 2006
Posts: 5
Thanks for the help
08-04-2006 08:05
Thank you both very much for this information, I shall now go away for another few weeks and try again.

Kind regards to all of you.


Antonia
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
08-04-2006 10:08
From: Katelyn Brock
When attached to an avatar the script keeps making a sound.

I believe this is because when you attach to an avatar, the script will respond to any collisions the avatar generates.. including the ground :)
_____________________
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
08-04-2006 10:23
From: Tiarnalalon Sismondi
I'm not a pro scripter by any means, however, I'm pretty sure that if you set up collisions on multiple prims and then link them, it's only going to register the collision as being with the root prim and treat the children as an extension of it.

I have no idea if this would work, and have no way of testing it atm as I'm at work, but I would think that you can test this simply by setting up a script similar to this:


Ummm, not exactly.

What happens with a linkset is that any prim that has a collision event handler will receive collision events that relate to it.

Any prim with no collision event handler will be received by the collision hander in the root prim.

Also, you may want to be using collision_start rather than collision, if you are not already.