This is my first time seriously diving deeper in manipulating a string. The following code cuts out a set of specified words from a range. The problem that I seem to be having, is that Blockland crashes whenever the following function is used. (executes fine)
function TC_lovetract(%msg, %phrase)
{
%dp = strpos(%phrase, "-");
%lw = getSubStr(%phrase, (%dp + 1), 1);
%fw = getSubStr(%phrase, 0, (%dp - 1));
%wc = getWordCount(%msg);
for(%a=0;%a<%wc;%a++)
{
if(getWord(%msg, %a) $= %fw)
%fwl = %a;
else if(getWord(%msg, %a) $= %lw)
%lwl = %a;
if(%a >= 30)
return error("Stopping endless loop!");
}
return getWords(%msg, 0, (%fwl - 1)) SPC getWords(%msg, (%lwl + 1), %wc);
}
If you don't mind, please tell me what I did wrong.