Link Number from linked Object Name
- Brayla Sana
- Posts: 78
- Joined: Wed Mar 27, 2013 7:09 pm
- Has thanked: 19 times
- Been thanked: 144 times
Link Number from linked Object Name
Why isn't there a way to get a linked object's number when you know the name? did they forget?
Dadiella's for Fashion and Brayla Sana Gallery for Building!
- Handy Low
- Posts: 231
- Joined: Fri Nov 08, 2013 3:38 pm
- Location: Yorkshire, England
- Has thanked: 207 times
- Been thanked: 140 times
- Contact:
Re: Link Number from linked Object Name
Really, a function that took a prim name and returned a link number should return a list, because multiple prims can have the same name.
But if you can be sure that there's only one prim with the given name, you could have something like this:
But if you can be sure that there's only one prim with the given name, you could have something like this:
Code: Select all
integer PrimName2LinkNumber(string Name) {
integer PrimCount = llGetNumberOfPrims();
integer L;
for (L = 1; L <= PrimCount; L++) {
if (llGetLinkName(L) == Name) return L;
}
return -1; // there's no prim with that name
}
- These users thanked the author Handy Low for the post:
- Brayla Sana
Handy Low
- Brayla Sana
- Posts: 78
- Joined: Wed Mar 27, 2013 7:09 pm
- Has thanked: 19 times
- Been thanked: 144 times
Re: Link Number from linked Object Name
Thank you. I want to create switches that provide feedback. I'm still learning things.
Dadiella's for Fashion and Brayla Sana Gallery for Building!
- Handy Low
- Posts: 231
- Joined: Fri Nov 08, 2013 3:38 pm
- Location: Yorkshire, England
- Has thanked: 207 times
- Been thanked: 140 times
- Contact:
Re: Link Number from linked Object Name
If someone is clicking on the switch, you can get the link number of the clicked prim from llDetectedLinkNumber() within the touch event, and then the prim name (using that link number) from llGetLinkName(). I'm not sure if that helps you.
Handy Low
- Brayla Sana
- Posts: 78
- Joined: Wed Mar 27, 2013 7:09 pm
- Has thanked: 19 times
- Been thanked: 144 times
Re: Link Number from linked Object Name
Both things were helpful. Thanks a lot!
- These users thanked the author Brayla Sana for the post:
- Handy Low
Dadiella's for Fashion and Brayla Sana Gallery for Building!