Tanith Rosenbaum
Registered User
Join date: 10 Sep 2008
Posts: 42
|
01-02-2010 05:40
Hi everyone, here's my problem: My script renames the object it is in on a regular basis, to a user-defined name, and then says something in local chat (it's an emoter-type script). But of course object names can't contain non-ASCII characters, so I have to check for that or else SL prints out a bunch of ?????? instead of the object name I set in chat. What I'm using right now is this: llSetObjectName(newname); if(llGetObjectName() != newname) llOwnerSay("The chosen name contains non-ASCII characters"  ; This works, but it strikes me as kinda inelegant, and inefficient, plus it relies on undocumented behaviour (I have no way of knowing if llGetObjectName() != newname will always be TRUE if newname contains non-ASCII chars, and always FALSE otherwise). Right now I could only think of checking once on change of newname and caching the result to improve efficiency, but that still doesn't deal with the using undocumented behavior problem. Is there a better way? Cheers T.
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
01-02-2010 07:45
I don't see the problem. The test works because names can't have non-ascii characters in them. If they fix that, the test will break, but then the name won't be a problem any more.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-02-2010 08:20
actually that seems much more brilliant than the parse drop I was going to suggest (parse out all ascii chars and test for length = 0)... and this way if they DO change the field to accept new characters then it should upgrade gracefully.
_____________________
| | . "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... | - 
|