List syntax errors for !"£$%^&*()_-+= etc.
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
04-02-2007 13:02
EDIT
Ah I see - my fault
I actually had other characters in the list and was adding the special characters to the end of it, there is a 72 record limit, so the lists compile successfully seperatley (minus £) but not together...
I can then concatenate the two lists into one.
Problem solved.
Cheers guys!
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
04-02-2007 13:17
\ is a special character - try using \\ instead..
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
04-02-2007 13:23
Same with " being special charater, should be "\"" You can find the details at http://www.lslwiki.org/index.php/String
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
04-02-2007 13:29
I was just testing to make sure you were paying attention.. 
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
04-02-2007 13:41
From: Meade Paravane I was just testing to make sure you were paying attention..  lol guys thanks, it still can't cope with this howeveR: list chars = ["!", "\"", "£", "$", "%", "^", "&", "*", "  ", "  ", "-", "_", "+", "=", "{", "}", "[", "]", ":", ";", "'", "@", "#", "~", "<", ">", ",", ".", "?", "/", "\\", "|"]; cursor stops after "£", =(
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-02-2007 13:47
£ isnt a standard character in american fonts so its probably screwing up the parser.
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
04-02-2007 13:51
I thought that might be the case! So taking that out, we still get syntax errors, the cursor now stops after: "  ", escaping the character has no effect Cheers =D
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
04-02-2007 14:00
I'll follow that up and say that the only characters which successfully compile are: list char = ["!", "\"", "$", "%", "^", "&", "*", ":", "|"]; which means all these: list chars = ["£", "  ", "  ", "-", "_", "+", "=", "{", "}", "[", "]", ";", "'", "@", "#", "~", "<", ">", ",", ".", "?", "/", "\\"]; won't compile! That's pretty rubbish =( is there a way around this? String conversion to unicode, match against unicode list?
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
04-02-2007 14:03
I find it hard to believe that LSL won't take any of those. I don't know what the problem is but would bet that it's either another special character in there a typo - misplaced , or " or something..
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
04-02-2007 14:21
EDIT Ah I see - my fault I actually had other characters in the list and was adding the special characters to the end of it, there is a 72 record limit, so the lists compile successfully seperatley (minus £) but not together... I can then concatenate the two lists into one... though currently list chars = normal + special;
doesn't work =\
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-02-2007 16:06
One question, whats your reasoning for placing them in a list? A string would be more memory efficient.
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
04-02-2007 17:02
The reason is to get index from llListFindList() to nab an entry from another list of textures : ) i.e. something like this: function find(string find) { integer index = llListFindList(chracters,[find]); if(~index) { string tex = llList2String(textures,index); llSetTexture(0,tex); } }
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-02-2007 23:23
From: Diego Pannotia The reason is to get index from llListFindList() to nab an entry from another list of textures : ) i.e. something like this: function find(string find) { integer index = llListFindList(chracters,[find]); if(~index) { string tex = llList2String(textures,index); llSetTexture(0,tex); } }
Well in the case where the match is a single character string the string index will do just as well, hence my question.
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
04-02-2007 23:36
i agree one string with everything in it and substring index
smaller and faster
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
04-03-2007 08:38
From: Diego Pannotia The reason is to get index from llListFindList() to nab an entry from another list of textures : ) i.e. something like this: function find(string find) { integer index = llListFindList(chracters,[find]); if(~index) { string tex = llList2String(textures,index); llSetTexture(0,tex); } }
Equivalent function if using a single string. chracters = " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!,£$%^&*()-_+={}[]:;'@#~<>,.?/|+"\\"+"\""; function find(string find) { integer index = llSubStringIndex(chracters, find);
if(~index) { string tex = llList2String(textures,index); llSetTexture(tex,0); } }
Another trick is the name the textures name to the alpha character. Then you just have to worry about special characters, but this make the code more complicated. ie. function find(string find) { integer index = llGetInventoryType(find); if(index == 0) { llSetTexture(find,0); } else { index = llSubStringIndex(chracters, find);
if(~index) { string tex = llList2String(textures,index); llSetTexture(tex,0); } } }
|