I did read your userpage, but is not proper for me comment upon such things. Your script had good bones, I wouldn't say mediocre, just inexperienced. Keep on scripting and you should get better.
I remember one of my first scripts... I've looked back upon it a few times and I can't read it; the logic is too weird.
You did pretty well with the string handling. You can use llParseString2List for most complex string handling. llGetSubString
are the main string functions and you can go far with them alone. Those three functions support both positive and negative indexes. Then there is llInsertString
, it does not support negative indexs which is a shame. Negative indexes work in all the list
functions. A negative index counts from the end of the string towards the beginning. so llGetSubString(a,0,-1) will return all of 'a'. To confuse things, if you swap the values... llGetSubString(a, -1, 0) it will just return the first followed by the last letters and nothing in between. When your first index is greater then your second (when an index is negative it is evaluated as llStringLength(str) + index; this results in it being less then the length of str) it returns all characters from the start to the first index, then from the second index to the end. Mixing negative indexs with positive indexs when overlapping them can have undesired consequences Example: llGetSubString("abcd", -2, 1)
"abcd"; llGetSubString("abc", -2, 1)
"b"; You need to consider this if you mix positive and negative indexs.
llDeleteSubString works exactly like llGetSubString except llDeleteSubString returns what llGetSubString does not. It is the mirror opposite.