Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

If owner touch then; if else, nothing; HOW?

Nyef Nyak
Junior Member
Join date: 23 Jul 2004
Posts: 17
08-14-2004 07:50
What can I use to make it so something changes when only the owner touches it? Been looking around and cant quite find something right...

[original code]

touch_start(integer total_number)
{
if (llGetColor(ALL_SIDES) == <1.0,1.0,0.0>;)
{
llSetColor(<1.0,1.0,1.0>,ALL_SIDES);
}
[/original code]

[what i want]

touch_start(integer total_number)
{
if person who touched == owner
{
if (llGetColor(ALL_SIDES) == <1.0,1.0,0.0>;)
{
llSetColor(<1.0,1.0,1.0>,ALL_SIDES);
}
}
}

[/what i want]


Thanks in advance!
Catfart Grayson
Registered User
Join date: 16 May 2004
Posts: 264
08-14-2004 08:08
You need llGetOwner to find the owner of the object and llDetectedKey to findout who touched it

CODE

touch_start(integer total_number)
{
if (llGetOwner() == llDetectedKey(total_number))
{
if (llGetColor(ALL_SIDES) == <1.0,1.0,0.0> )
{
llSetColor(<1.0,1.0,1.0>,ALL_SIDES);
}
}
}
_____________________
Cat
Nyef Nyak
Junior Member
Join date: 23 Jul 2004
Posts: 17
08-14-2004 08:10
well that was quick, thank you very much :)
Ace Cassidy
Resident Bohemian
Join date: 5 Apr 2004
Posts: 1,228
08-14-2004 08:38
From: someone
Originally posted by Catfart Grayson
You need llGetOwner to find the owner of the object and llDetectedKey to findout who touched it

CODE

touch_start(integer total_number)
{
if (llGetOwner() == llDetectedKey(total_number))
{
if (llGetColor(ALL_SIDES) == <1.0,1.0,0.0> )
{
llSetColor(<1.0,1.0,1.0>,ALL_SIDES);
}
}
}


This is broken... It should be :

CODE

touch_start(integer total_number)
{
if (llGetOwner() == llDetectedKey(total_number - 1))
{
if (llGetColor(ALL_SIDES) == <1.0,1.0,0.0> )
{
llSetColor(<1.0,1.0,1.0>,ALL_SIDES);
}
}
}


- Ace
_____________________
"Free your mind, and your ass will follow" - George Clinton
Catfart Grayson
Registered User
Join date: 16 May 2004
Posts: 264
08-14-2004 09:00
lol, I was in SL doing that very condition and realised that I'd got it wrong in the post. SO I popped back to correct.

As Ace says, my code is slighty broken.
_____________________
Cat