|
Doctor Hickman
Registered User
Join date: 16 Oct 2006
Posts: 15
|
03-17-2008 04:58
Using the demo script (slightly amended) at http://wiki.secondlife.com/wiki/LlRequestAgentData, I can see how to get the SL born date of the owner of the script but actually I want to get the birthday of the avatar touching the object . I tried swapping llDetectedKey for llGetOwner in the demo script but this didn't work. This is the demo script: key owner_key; key owner_born_query; string owner_born; default { state_entry() { owner_key = llGetOwner (); owner_born_query = llRequestAgentData( owner_key, DATA_BORN); } dataserver(key queryid, string data) { if ( owner_born_query == queryid ) { owner_born = data; } } touch_start(integer total_number) { llSay(0, " The avatar was born : "+ owner_born ); } } Grateful for any suggestions. Thanks
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
03-17-2008 05:12
If you want the key of the AV who clicks an object, you need to add a touch-event:
default { state_entry() { // nothing to do here }
touch_start(integer num) { av_key = llDetectedKey(0); av_query = llRequestAgentData( av_key, DATA_BORN); }
dataserver(key queryid, string data) { if ( av_query == queryid ) { av_born = data; llSay(0, " The avatar was born : "+ av_born ); } } }
didn't test this online, though... 
|
|
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
|
03-17-2008 05:14
You will need an event that allows you to detect the avatar you want the birthday of..
I would suggest using a touch_start event instead of the state-entry as that then allows for llDetectedKey as SL knows who's touched the prim.
As the script stands in detects the owner when the script is rezzed or the script restarted. That will not work for anyone other than the owner.
Other suggestions may be a sensor but you would have to filter for agents and create a for(?) while(?) loop (can't remember which) to list each detected avatar in sequence.
For ease of use I would suggest the touch_start and just get each av to touch it to get their birthday.
The possible events are collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end()
_____________________
Tread softly upon the Earth for you walk on my face.
|
|
Doctor Hickman
Registered User
Join date: 16 Oct 2006
Posts: 15
|
03-17-2008 05:23
Thanks Haruki Watanabe - your script works great. Cheers
|