llSensor problems
|
|
MistySue Wallaby
Registered User
Join date: 22 Apr 2005
Posts: 40
|
04-30-2006 20:10
In the script i'm attempting to write, i'm wanting to see if a specified avatar is within 10m. Only the agent name is given, not the key. The script is going in an attachment. code segment: search (string name2look4) { string tempName; key tempKey;
llSensor (name2look4, NULL_KEY, AGENT, 10, PI); }
sensor (integer items) { integer temp; llWhisper (0, "found: "); for (temp = 0;temp < items;temp++) { llWhisper (0, llDetectedKey (temp)); llWhisper (0, llDetectedName (temp)); } }
problem is the name and key is always a string of "00000000-0000-0000-0000-000000000000" what am i doing wrong?
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
04-30-2006 20:22
for the future use php tags, makes it ezer to read //open php //close php
edit my solution was incorrect 
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
04-30-2006 20:27
From: MistySue Wallaby sensor (integer items) { integer temp; llWhisper (0, "found: "); for (temp = 0;temp < items;temp++) { llWhisper (0, llDetectedKey (temp)); llWhisper (0, llDetectedName (temp)); } }
Consider using llOwnerSay instead of llWhisper, as it's faster and immune to eavesdropping and doesn't spam chat.
|
|
MistySue Wallaby
Registered User
Join date: 22 Apr 2005
Posts: 40
|
04-30-2006 20:38
ok..that would solve the spam problem, but not the failure of llDetectedKey and llDetectedName
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
04-30-2006 20:39
i ran this tru SL search (string name2look4) { string tempName; key tempKey;
llSensor (name2look4, NULL_KEY, AGENT, 10, PI); }
default { state_entry(){search("");}
sensor (integer items) { integer temp; llOwnerSay ("found: "); for (temp = 0;temp < items;temp++) { llOwnerSay ( llDetectedKey (temp)); llOwnerSay ( llDetectedName (temp)); } } }
and it works just fine except for state_entry its a copy of what you posted (oh and owner say heh)
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
04-30-2006 20:41
I suspect there's something else wrong in your script. Can you post the entire script please?
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
04-30-2006 20:43
aye your probally passing a funky string to search() ie " " instead of "" which would make it look for everything named (space)
|
|
Leonard Churchill
Just a Horse
Join date: 19 Oct 2005
Posts: 59
|
04-30-2006 20:49
It's a race to find what's wrong.... and the horse can't resist a race. Works fine when not attached, I bet. Are you testing with your own name? Works not attached, and then you attach it... then it fails. My testing as attached to hud works fine to detect others, not myself. Probably because the sensor is using my av's center as the origin point (don't claim to know the mysteries of the detection logic when the origin == target). search (string name2look4) { llSensor(name2look4, NULL_KEY, AGENT, 10, PI); }
default { state_entry() { llOwnerSay("Hello, Avatar!"); }
touch_start(integer total_number) { llOwnerSay("Touched."); search("Jezabeth Poutine"); }
sensor (integer items) { integer temp; llOwnerSay("found:" + (string)items);
for (temp = 0;temp < items;temp++) { llOwnerSay((string)llDetectedKey (temp)); llOwnerSay(llDetectedName (temp)); } } }
_____________________
"Give me a fish and I eat for a day. Teach me to fish and I eat for a lifetime." - Chinese Proverb Always check the Wiki and/or Script Library
|
|
MistySue Wallaby
Registered User
Join date: 22 Apr 2005
Posts: 40
|
04-30-2006 21:06
i get the same results whether worn or not. also have tried hardcoding a name in place of name2look4 and still get the garbage
|
|
Jigsaw Partridge
A man of parts
Join date: 3 Apr 2005
Posts: 69
|
04-30-2006 21:54
Very odd, that should work. Plus the sensor event would only be invoked if something matching your criteria has actually been detected.
Do you have a non-integer global variable called 'temp' at all? I wouldn't have thought it would compile if you had, but it might be worth checking. Try printing out the value of temp within the loop, or in fact try passing the literal value 0 to llDetectedKey() and see what comes out.
|
|
Zodiakos Absolute
With a a dash of lemon.
Join date: 6 Jun 2005
Posts: 282
|
04-30-2006 23:04
Objects cannot detect themselves. This also extends to objects attached to an avatar. An attached object can also not sense the avatar it is attached to. An object cannot detect child prims on an object. http://secondlife.com/badgeo/wakka.php?wakka=llSensor
|
|
MistySue Wallaby
Registered User
Join date: 22 Apr 2005
Posts: 40
|
04-30-2006 23:36
ok..now i'm more confused than ever, but it just started working
|