The issue seems to be the (str = "") in strReplace - not sure what that does, maybe some kind of SL-specific memory optimisation? Removing that made it work for me.<div><br></div><div>Neil Canham</div><div>CTO vComm Solutions GmbH<br>
<br><div class="gmail_quote">On Wed, Jul 27, 2011 at 5:17 PM, Ai Austin <span dir="ltr"><<a href="mailto:ai.ai.austin@gmail.com">ai.ai.austin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I seem to be having a problem with some utility functions in LSL in a script I am trying to bringing over from a Second Life display screen... This strReplace function from <a href="http://wiki.secondlife.com/wiki/Combined_Library" target="_blank">http://wiki.secondlife.com/<u></u>wiki/Combined_Library</a> which we have used seems to be the problem:<br>
<br>
I wonder if someone knows the problem, as the two routines used are indicated as implemented in OpenSim.<br>
<br>
For these tests I was using OpenSim 0.7.1.1 and 0.7.2 dev master and Imprudence and SL 2.8.0 viewers, so I think its not a specifuc version or viewer issue.<br>
<br>
------------------------------<u></u>-----------<br>
<br>
string strReplace(string str, string search, string replace) {<br>
return llDumpList2String(<u></u>llParseStringKeepNulls((str = "") + str, [search], []), replace);<br>
}<br>
<br>
default {<br>
touch_start(integer num){<br>
llSay(0,"avatar="+<u></u>llDetectedName(0));<br>
llSay(0,"avatar_mod="+<u></u>strReplace(llDetectedName(0)," ","_"));<br>
}<br>
}<br>
<br>
------------------------------<u></u>------------------<br>
The first line works, the second just lists when touched by an avatar with a name like "Ai Austin" it is meant to be able to replace the spaces with underscores and produce "Ai_Austin" but it actually seems to return the null string in OpenSim 0.7.2 dev master r/16364 anyway.<br>
<br>
avatar=Ai Austin<br>
avatar_mod=<br>
<br>
<br>
______________________________<u></u>_________________<br>
Opensim-users mailing list<br>
<a href="mailto:Opensim-users@lists.berlios.de" target="_blank">Opensim-users@lists.berlios.de</a><br>
<a href="https://lists.berlios.de/mailman/listinfo/opensim-users" target="_blank">https://lists.berlios.de/<u></u>mailman/listinfo/opensim-users</a><br>
</blockquote></div><br></div>