|
MadamG Zagato
means business
Join date: 17 Sep 2005
Posts: 1,402
|
06-12-2006 08:22
Hiyas I am using the following script. What it SHOULD do is to say "Access Denied" if the person touching is not the owner. However, it says it no matter what. link_message(integer sender, integer num, string str, key id) { if (id == llGetOwner()) { llSay(0,"Access granted"); } else { llSay(0,"Access denied"); } }
So if it is me, then I get: Object: Access Granted Object: Access Denied If someone else, they just get: Object Access Denied Why am I getting Access Denied as well?
|
|
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
|
06-12-2006 08:37
Should probably be in the touch even instead of the link_message event touch_start(integer r) { if (llGetOwner()== llDetectedKey(0)) { llSay(0,"Access granted"); } else { llSay(0,"Access denied"); } }
Otherwise you need to make sure the llDetectedKey(0) is sent as the id from where you have the touch event. touch_start(integer r) { llMessageLinked(LINK_SET, 0,"",llDetectedKey(0)); }
|
|
Reitsuki Kojima
Witchhunter
Join date: 27 Jan 2004
Posts: 5,328
|
06-12-2006 08:41
Right. ID is only valid in the touch event (or wherever else you collect it) unless you specificly make it global.
_____________________
I am myself indifferent honest; but yet I could accuse me of such things that it were better my mother had not borne me: I am very proud, revengeful, ambitious, with more offenses at my beck than I have thoughts to put them in, imagination to give them shape, or time to act them in. What should such fellows as I do crawling between earth and heaven? We are arrant knaves, all; believe none of us.
|
|
Seronis Zagato
Verified Resident
Join date: 30 Aug 2005
Posts: 454
|
06-12-2006 11:25
Or to make sure you got them all... touch_start( integer num_touchers ) { integer curr_av; for( curr_av = 0; curr_av < num_touchers; ++curr_av ) { if( llDetectedKey(curr_av) == llGetOwner() ) { llSay(0,"Access Granted."); } else { llSay(0,"Access Denied."); } } } or if you really need that link_message in some other script... touch_start( integer num_touchers ) { integer curr_av; for( curr_av = 0; curr_av < num_touchers; ++curr_av ) { llMessageLinked(LINK_SET,0,"",llDetectedKey(curr_av) ); } }
|
|
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
|
06-12-2006 13:38
From: MadamG Zagato Hiyas I am using the following script. What it SHOULD do is to say "Access Denied" if the person touching is not the owner. However, it says it no matter what. link_message(integer sender, integer num, string str, key id) { if (id == llGetOwner()) { llSay(0,"Access granted"); } else { llSay(0,"Access denied"); } }
So if it is me, then I get: Object: Access Granted Object: Access Denied If someone else, they just get: Object Access Denied Why am I getting Access Denied as well? Are you sure that is an EXACT copy of what is running - Because if it is, it is impossible ( ie bug somewhere ) that you are getting two responses for one pass thru it ( and even if you were somehow going thru it twce with a maverick link message you would still get two access messages for the denied ) Also I would look at the logic above it - does it send 1 link message for every body else and 2 for you or something ( that would explain why you are getting two and everybody else is getting one )
|