These forums are CLOSED. Please visit the new forums HERE
llDetectedName to detect SPECIFIC objects? |
|
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-16-2009 22:45
I'm using a pretty simple script with llSensor and llDetectedName(obj) that I found, it helps me pick out all nearby objects. But that's a bit much for me. Does anyone know if there's a way to get it to detect specific objects by name?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
06-16-2009 23:58
There sure is, though only if you are searching for objects with an EXACT specified name (e.g. if you are looking for "Bob" you won't detect "bob" or "BOB" or "Bobbet"
. What you are looking for is the "name" parameter of llSensor() or llSensorRepeat().See: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSensor http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSensorRepeat |
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
06-17-2009 00:32
Most people do this by calling an unfiltered sensor and then looping through the results to do comparisons.
_____________________
![]() |
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 02:13
Most people do this by calling an unfiltered sensor and then looping through the results to do comparisons. Well, I'm quite sure that's beyond my scripting skills at the moment. Thanks, though. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
06-17-2009 03:40
Well, I'm quite sure that's beyond my scripting skills at the moment. Thanks, though. Hey come on now! Do not sell your self short. Post the script you are using and we can show where it needs to be changed. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
06-17-2009 04:12
Most people do this by calling an unfiltered sensor and then looping through the results to do comparisons. _____________________
From Studio Dora
|
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 10:43
Well, just for laughs, here's the script I'm using. Found it somewhere and modified it a little.
CODE
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
06-17-2009 10:50
Got an example of what you want to search for?
Like.. Anything beginning with "Bob"? Or anything with "bob" in the name anywhere? Or.. something else? _____________________
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 |
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 11:20
Got an example of what you want to search for? Like.. Anything beginning with "Bob"? Or anything with "bob" in the name anywhere? Or.. something else? Yes. I'd like to track down anything with the word paul in it. All the objects I create, I call 'em "Paul's [name of item]", and I figured I'd be able to track them down in this mess of a workshop of mine if there were a script I could use to locate objects that way. |
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
06-17-2009 11:26
Untested but this will probably be close...
CODE
_____________________
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 |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
06-17-2009 11:44
See? It's really not that bad and you pick it up as you go. If I can learn to script then anyone can. Plus you have the community here to nudge you in the right direction when you get lost.
Looking forward to more queries from you. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
06-17-2009 11:47
Looking forward to more queries from you. /me too!! You know I bill by the character, right? MORE WHITESPACE!! _____________________
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 |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
06-17-2009 11:50
/me too!! You know I bill by the character, right? MORE WHITESPACE!! I tried counting but lost track. Now how many mealworms do we owe you for this work? _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 11:55
Untested but this will probably be close... CODE
Oh... That works well... And if I'm correct... Changing that 20.0 in the llSensor changes the range? |
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
06-17-2009 11:57
I tried counting but lost track. Now how many mealworms do we owe you for this work? None! You get a kickback for encouraging the newbie. ![]() And if I'm correct... Changing that 20.0 in the llSensor changes the range? Yep. _____________________
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 |
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 12:19
Still only scans 16 objects, so I have to be practically on top of what I'm looking for anyway, but at least that gets rid of the long list of worthless stuff...
Is that an SL scripting limitation, or something that can actually be done, to scan more than 16 items? |
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
06-17-2009 12:44
That's expected - sensors are only able to detect the first 16 matches...
If you REALLY want to look for more, you can decrease the scanning radius (where you have PI in the sensor call now) and rotate your scanner object around.. _____________________
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 |
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 12:48
Yeah, I did increase the range, and tested it by dropping some other items, but it still seems to only scan the 16 nearest items, and misses an object 3 meters away, because the 56 prim cat wandered into scan range...
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
06-17-2009 13:09
OR you can put the EXACT name of the object inside the parenthesis in the sensor. THis way you can also strip back out the if tests in the script.:
llSensor("",NULL_KEY,PASSIVE|ACTIVE,20.0,PI); At work now but I can whip one up this afternoon unless someone beats me to it. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
06-17-2009 13:24
Please take a look at:
http://jira.secondlife.com/browse/SVC-791 http://jira.secondlife.com/browse/SVC-790 |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
06-17-2009 16:18
Here is a way to do it with an exact name search. Enter the EXACT name (In this case a partial name will not work) of the object you want to locate in the sensor description.:
CODE
This demonstrates a couple of easy concepts. First and more importantly is what we call an integer switch. In LSL TRUE = 1 and FALSE = 0. At the end of the touch_start event you will see this: switch = !switch; That is telling the script to change switch between 1 & 0(TRUE & FALSE). If it is 1 then it becomes 0 and if it is 0, it becomes 1. It is a nice, neat, easy way to make a touch_event do more then one thing and you can think of it like a light switch You will also notice that instead of just saying where the object is located I used llMapDestination instead. Now you have a big beacon shining right on the object and can even teleport there if you want to. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-17-2009 18:07
Here is a way to do it with an exact name search. Enter the EXACT name (In this case a partial name will not work) of the object you want to locate in the sensor description.: CODE
This demonstrates a couple of easy concepts. First and more importantly is what we call an integer switch. In LSL TRUE = 1 and FALSE = 0. At the end of the touch_start event you will see this: switch = !switch; That is telling the script to change switch between 1 & 0(TRUE & FALSE). If it is 1 then it becomes 0 and if it is 0, it becomes 1. It is a nice, neat, easy way to make a touch_event do more then one thing and you can think of it like a light switch You will also notice that instead of just saying where the object is located I used llMapDestination instead. Now you have a big beacon shining right on the object and can even teleport there if you want to. That's pretty cool. Although it keeps finding just one item, nothing else... Even when I put in the name exactly... And it looks like the map location is wrong, which probably has to do with detecting the wrong object... Hmm. great way to learn a script though, that's for sure. |
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
06-18-2009 00:28
MAJOR EDIT: see below
this will give 16 objects per 109.4713deg arc in 6 arcs but has some overlap (which is why we grab the name AND pos, to get items with the same name but different locations) CODE
the most efficient version (least overlap) would have 12 directions, but I didn't feel like doing the math. any regular polygon number of directions will work. more directions = more possible detected objects in range, but takes longer, and uses a lot more processing. MAJOR EDIT: the above works, and it's simpler than trying to reflect the sensor ( angle and angle-pi ) MAJOR "FUCK YOU" TO LL: I now can't print a valid rotation to the forums... thankfully ` is treated by the LSL compiler(s) as a space so it won't interfere with the program _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
|
Cappy Frantisek
Open Source is the Devil!
Join date: 27 Oct 2006
Posts: 400
|
06-18-2009 08:38
Ibtl
_____________________
SL is not better than FL
|
|
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
|
06-18-2009 12:43
I am so taking notes...
|