Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

rezzing script attach to avatar - something not quite right!

Boris Eebus
Registered User
Join date: 8 Feb 2008
Posts: 45
05-12-2008 15:10
the problem is at the bottom pf this post


I have this script which simply rezzes an object:

-------------------------------------------------------------
Text(string Message)
{
llSetText(Message, <1, 1, 1>, 3.0);
}

default
{
state_entry()
{
Text("Touch to Activate";);

}
touch_start(integer total_number)
{


llRezObject("prism_measure", llGetPos() + <-1.0,-1.0,0.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);

}



}
------------------------------------------------------------------------------------------



When the object is rezzed this script is run it attaches to the avatar:



-------------------------------------------------------------------------------------------
default
{
state_entry()
{
llSetTimerEvent(.1);
llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
}
timer()
{
llSetText ((string)llGetPos(), <1.0, 1.0, 1.0>, 1.0);
}
run_time_permissions( integer vBitPermissions )
{
if (PERMISSION_ATTACH & vBitPermissions)
{
llAttachToAvatar( ATTACH_LHAND );
}
else
{
llOwnerSay( "Permission to attach denied" );
}
}

on_rez(integer rez)
{
if(!llGetAttached())
{ //reset the script if it's not attached.
llResetScript();
}
}

attach(key AvatarKey)
{
if(AvatarKey)
{//event is called on both attach and detach, but Key is only valid on attach
integer test = llGetAttached();
if (test) {
llOwnerSay( "The object is attached" );
} else {
llOwnerSay( "The object is not attached";);
llDie();
}
}
}

}
-----------------------------------------------------------------------------------------

This only seems to attach to my avatar not the avatar which activates the script any ideas where I have gone wrong?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
05-12-2008 15:16
Er, because you are specifically telling it to attach to the owner? See the line: llRequestPermissions( llGetOwner(), PERMISSION_ATTACH ); and the run_time_permissions() event that results from that.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-12-2008 17:34
Also you can't attach something to anybody but the owner. You can ask and get permission, but it will still fail with an error message if you try to attach something of yours to someone else.
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/