Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Listen only to item of same owner?

Rena Kuhn
Registered User
Join date: 25 Jun 2007
Posts: 13
04-23-2008 17:52
Ok, so in the design of one of my products I've come upon a snag that could cause a potential problem for my customers.

My design uses a object as a remote which sends a RGB vector string via LlSay to a Listen script in the product that changes the color accordingly.

My problem is I need a way to secure the communications between the remote and the product so it will only listen to commands from a remote of the same owner.
Otherwise, anyones remote will change the color if in range.

Anyone know a simple way I can fix this issue? :/
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-23-2008 18:17
You can use llGetOwner and compare against llGetOwnerKey in the listen event. You can choose to listen to your owner, your owner's objects, or both.

CODE

key myOwner;

default
{
state_entry()
{
myOwner = llGetOwner();
llListen(42, "", "", "");
}

listen(integer ch, string name, key id, string msg)
{
key yourOwner = llGetOwnerKey(id);
if (yourOwner == myOwner) {
llWhisper(0, "You are my owner, or another object owned by my owner.");

if (id == myOwner) {
llWhisper(0, "Actually, you are my owner, hi!");
}
else {
llWhisper(0, "Actually, you are an object owned by my owner.");
}
}
else {
llWhisper(0, "Go away, you pesky stranger.");
}

}
}

_____________________
Rena Kuhn
Registered User
Join date: 25 Jun 2007
Posts: 13
04-23-2008 18:39
From: Viktoria Dovgal
You can use llGetOwner and compare against llGetOwnerKey in the listen event. You can choose to listen to your owner, your owner's objects, or both.

CODE

key myOwner;

default
{
state_entry()
{
myOwner = llGetOwner();
llListen(42, "", "", "");
}

listen(integer ch, string name, key id, string msg)
{
key yourOwner = llGetOwnerKey(id);
if (yourOwner == myOwner) {
llWhisper(0, "You are my owner, or another object owned by my owner.");

if (id == myOwner) {
llWhisper(0, "Actually, you are my owner, hi!");
}
else {
llWhisper(0, "Actually, you are an object owned by my owner.");
}
}
else {
llWhisper(0, "Go away, you pesky stranger.");
}

}
}



Awesome, seems to work in my script. i'll test it and make sure it doesn't get interferance from other remotes.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
07-14-2008 13:29
i'm not in world to try this yet, but i see a potential problem. you need to add a reset or something to the script so it detects the new owner. if it doesn't detect the new owner, it won't work. but if you're just implementing this into another script you probably already have that covered i'm sure :-p
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
07-14-2008 13:34
edit: er.. Yeah. What Ordinal says below. Maybe one day I'll learn to read whole posts instead of just a few lines.. :O
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
07-14-2008 13:37
Or, just

if (llGetOwnerKey(id) != llGetOwner()) return;

Neither of these are exactly laggy functions.
_____________________
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
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
07-14-2008 14:04
From: Ruthven Willenov
i'm not in world to try this yet, but i see a potential problem. you need to add a reset or something to the script so it detects the new owner.

What would compel someone to sell that script, let alone give it away? It doesn't do anything.
_____________________
Rena Kuhn
Registered User
Join date: 25 Jun 2007
Posts: 13
07-14-2008 16:14
I'd hate to break it to you all who didn't look at the date of the topic...

this has long since been solved and implimented into my products for a while now and I haven't had a problem with it yet.

FYI, I didn't need whole a script so of course it isn't gonna work by itself... I just needed to fix the listener function on my current scripts.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
07-15-2008 12:09
From: Viktoria Dovgal
What would compel someone to sell that script, let alone give it away? It doesn't do anything.


obviously in the current state, but tweak it a bit and implement stuff into it or vice vera, and why not?after all, i'm sure most scripts are created by chopping and adding pieces of others. just sayin. lol, i've seen the changed owner mistake many times, easy fix, but also easy mistake to make, which can make an object not work for the next person and also:

From: Ruthven Willenov
but if you're just implementing this into another script you probably already have that covered i'm sure :-p
Rena Kuhn
Registered User
Join date: 25 Jun 2007
Posts: 13
07-15-2008 15:24
Do you guys read?

Look at the date of the posts.

Its been finished. YES it was added to another script. YES it works fine. NO it doesn't break on onwership change, at least in mine.

This was a request for a FIX to my previous listener code, not a request for a whole script. :/
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
07-15-2008 15:48
Hmm, this script looks very unfinished to me, and will probably not work if it is not part of another script - for a start I suspect that, if the owner changes, it will break.

Perhaps I should just rewrite the whole thing and post a replacement, that might be quicker.
_____________________
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
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
07-15-2008 16:35
From: Ordinal Malaprop
Hmm, this script looks very unfinished to me, and will probably not work if it is not part of another script - for a start I suspect that, if the owner changes, it will break.

Perhaps I should just rewrite the whole thing and post a replacement, that might be quicker.

lol, i don't think it's necessary, this is the scripting tips part of the forums, not the scripting library, i was simply adding an additional tip to anyone who may be looking for this type of help in the future........rena, obviously you're not the only one that reads or looks for tips in the forums, or they probably wouldn't be here, just because it's fixed for you, doesn't mean other people won't benefit from the continuation of the discussion