This function will return an array containing all the indexes of characters in @text that can be modified such that colour tags and ANSI escape sequences are preserved. These indexes can then be used to modify the text in a safe way. For instance, the %stringSmokey() function uses the internal version of this function to make content look "smokey" by replacing modifiable characters with periods.
Example: --------------------------------------------------------------------------
%mobSendBufferOpen( @actor ) %do( @actor, "look" ) @buffer = %mobSendBufferGetContents( @actor ) %mobSendBufferClose( @actor )
@indexes = %stringGetModifiableIndexes( @buffer ) @indexes = %arrayShuffle( @indexes )
// 30% character replacement. @maxChars = (%arrayGetSize( @indexes ) * 30) / 100;
for( @i = 0; @i < @maxChars; @i += 1 ) { if( @buffer->(@indexes->@i) != "\n" \ && \ @buffer->(@indexes->@i) != ' ' ) { @buffer->(@indexes->@i) = '.'; } endif } endfor
%echoTo( @buffer, @actor, allowSleeping, noFormat ) |