Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llUnescapeURL question

Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
01-12-2006 19:00
Hi,

I'm currently offline (can't run 2nd life) but looking as scripts.

Can anyone confirm whether the following line would ALWAYS produce a 1 character string only? (i.e. if not it may explain a problem I'm having)

CODE
   llUnescapeURL("%" + (string)((integer)llFrand(100) + 10))



Thanks
Greg
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
01-12-2006 19:24
Hmm... I would think not. That could generate unprintable characters which could screw up various functions of SL, so they probably constrained it to only printable characters.

If you want a random character, you might just have to make a string of all the printable characters.
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
01-12-2006 19:37
From: Keknehv Psaltery
Hmm... I would think not.
You mean you think it may produce sometimes a string with more than 1 character Keknehv? (just to clarify you response)
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
01-12-2006 20:29
Just tested it... Here are my results:

test code:
CODE

string test = llUnescapeURL("%0");
llOwnerSay(test);
test = llUnescapeURL("%20");
llOwnerSay(test);


When run, it results in the following output:
CODE

Object: %0
Object:


It would seem that if a code would generate a non-printable character, it simply doesn't translate. Further testing confirms this: 21, '!' works when unescaped.

Every escape code from 20 to 7E should work-- yes, 7E. You need to convert into hex to get the most from your random character function.
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
01-12-2006 20:45
thanks very much for clarifying/testing this Keknehv - that was very kind

cheers
Greg
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
01-12-2006 21:32
Good luck!

Or... here's a string containing all the printable characters.

"!\"#$%@&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"

It's 94 characters long. I shall leave a random function for it as an exercise for the reader. (~Laziness---sleepy)