Travis Lambert
White dog, red collar
Join date: 3 Jun 2004
Posts: 2,819
|
06-23-2005 22:22
Hi! I'm working on an object that reports back to me an agent's birthdate when they walk over it. However, its not doing that - its detecting the collision, but not performing the dataserver event (or my dataserver query is invalid). Here's what I have: key request; float delay = 3; //collision delay
default { state_entry() { llOwnerSay("Ready"); } collision_start(integer total_number) { { request = llRequestAgentData(llDetectedName(0), DATA_BORN); llOwnerSay("I detected" + " " + llDetectedName(0)); //for debug only llSleep(delay); } } dataserver(key queryid, string data) { if(request == queryid) llOwnerSay(llDetectedName(0) + "has arrived, and was born on " + data); } } Two questions.... 1. It doesn't work, and I can't figure out why. It OwnerSay's the name - but never seems to perform the dataserver event. I'm not certain how to use these two events (collision and dataserver) together properly. 2. From the results gathered back from dataserver - is it possible to do math on that result? For example - setting up an IF condition so I could OwnerSay different messages depending on the AV being less than 7 days old or over 1 year old? Thanks in advance for your help! 
_____________________
------------------ The ShelterThe Shelter is a non-profit recreation center for new residents, and supporters of new residents. Our goal is to provide a positive & supportive social environment for those looking for one in our overwhelming world.
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
06-23-2005 23:08
Try removing the sleep and the if command in the dataserver event and see if it returns properly. Don't use sleep for collisions. Instead, use llMinEventDelay.And yes, you should be able to perform math functions on the result. Just (typecast)the_data_like_this. http://secondlife.com/badgeo/wakka.php?wakka=typecast
_____________________
---
|
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
|
06-23-2005 23:25
request = llRequestAgentData(llDetectedName(0), DATA_BORN);
should be:
request = llRequestAgentData(llDetectedKey(0), DATA_BORN);
|
Travis Lambert
White dog, red collar
Join date: 3 Jun 2004
Posts: 2,819
|
06-24-2005 06:04
Thanks, guys - that got me rolling  Especially llDetectedName() vs. llDetectedKey() - Ugh.
_____________________
------------------ The ShelterThe Shelter is a non-profit recreation center for new residents, and supporters of new residents. Our goal is to provide a positive & supportive social environment for those looking for one in our overwhelming world.
|
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
|
06-24-2005 09:07
Wouldn't the llDetectedName(0) in the dataserver event be borked, since that event doesn't really detect anything? You would probably need to store the name in the collision event.
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
06-24-2005 14:27
From: Zindorf Yossarian Wouldn't the llDetectedName(0) in the dataserver event be borked, since that event doesn't really detect anything? You would probably need to store the name in the collision event. Yes, I was just going to point that out. You need a global variable to pass data between events. (Yes, yes, or you could store it in an attribute of the object or--etc.) In virtually all cases like these, you want a global variable. Also, it's just good coding practice to store data obtained in a variable if you're going to use it more than once. Why bother with two llDetectedKey calls when you can get away with one?
|