setWriteRegExp

setWriteRegExp

Synopsis: setWriteRegExp( writeAtOnce, dontWriteAtOnce )

Sets the $writeAtOnceRegExp and $dontWriteAtOnce variables
to the given values. To set only one, leave the other undef.

This mainly influences, how a string coming from the
server is parsed. The problem is: The server may send
a line in five parts, and it may send some lines at once,
just like it likes to. So now we mostly want to base
triggers on complete lines. For example a trigger for
"evil guy says: " will not be executed, if the server
sends "evil g" in one packet and "uy says: something\n"
in the next packet. Therefor xpertmud has the ability
to cache the output of a line until a complete line's
finished and call the triggers with the complete line.
The problem is now, that sometimes you want to see
and use triggers on lines, which are not complete
(for example prompts). Xpertmud can't solve this problem
by itself, so there are two variables: 
$writeAtOnceRegExp (default = ".?") and 
$dontWriteAtOnceRegExp (default = "^\$") 
which you can set according to your own needs. 
Xpertmud than does the following:
	if(<line is not complete> andand
	   ($line =~ /$writeAtOnceRegExp/) andand
	   ($line !~ /$dontWriteAtOnceRegExp/)) {
	  execute triggers on the line part;
	  print the line part;
	} else {
	  cache the line part without doing anything yet;
	}
This means that by default all text is written
to the status window even if it's not a full line.

There are two variables, so you can choose which to
set according to the mud you're playing. If you
mainly need full lines, you'll set $writeAtOnceRegExp
to match you're few prompts or whatever and 
$dontWriteAtOnceRegExp to "^\$". If you only occasionaly
want to cache lines, you'll set $writeAtOnceRegExp
to ".*" and $dontWriteAtOnceRegExp to match in occasions
where you want caching.


KDE Logo