|
Gregerson Halderman
Registered User
Join date: 9 Aug 2007
Posts: 15
|
08-18-2007 10:39
I've been trying to write code that determines whether a name typed in a given channel is a substring of a nearby (10.0 units) detected avatar name. the problem is that llDetectedName(i) (for a given index i) is always giving -1 as a return value even when the substring is correct. So that: // start of for loop //... ...
llSay(0, "Avatar = " + llDetectedName(i)); index = llSubStringIndex(llDetectedName(i), "Fred"); llSay(0, "index = " + (string)index);
Will always give an index of -1. Even when, say, Fred Bloggs is detected. If I replace with index = llSubStringIndex("Fred Bloggs", "Fred");
Obviously the string function works and returns 0. What is the issue with llDetectedName?
|
|
Gregerson Halderman
Registered User
Join date: 9 Aug 2007
Posts: 15
|
08-18-2007 11:06
I just tried setting a string variable to llDetectedName(i) prior to using the string function and it's ok now.
wtf?
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
08-18-2007 15:30
From: Gregerson Halderman I just tried setting a string variable to llDetectedName(i) prior to using the string function and it's ok now.
wtf? I was having a similar problem with llListFindList last night. I switched to using strings and it worked right. It didn't break for all lists, just some. (and I verified that the sublist was in the list too.) I don't know. Maybe something was up behind the scenes. Or maybe it was a memory issue.
|