contents.gifindex.gifprev1.gifnext1.gif

pueblo00000000.gif TinTin #substitute command

This command allows you to tell Pueblo to watch for a certain string of text from the world. If Pueblo finds that string, the then the line is replaced with the text you specify.

Note: #substitute is a more powerful version of the #gag command. Using #substitute you can list all substitutions created with both the #substitute and #gag commands.

Command syntax

#substitute

This format will list all defined substitutions.

#substitute {pattern}

This format will list all substitutions that match pattern. ‘*’ may be used as a wildcard character. For example, ‘*pickle*’ matches all substitutions that contain the word ‘pickle’.

#substitute {text to substitute} {replacement text}

This format will define a new substitution. Whenever the text to substitute is found in a line, the entire line is replaced with replacement text.

Parameter Substitution

The #substitute command also allows for parameter substitution. You may specify the variables %0, %1, …, %9 in the text to substitute. These variables may then be used in the replacement text. Here is an example:

#substitute {Stev0%0} {Stev0 of the Smurfs%0}

When the following text is sent by the world:

Stev0 has arrived.

Then the substitution will occur and you will see the following text on your display:

Stev0 of the Smurfs has arrived.

Anchored substitutions

If the text to substitute starts with a caret (^), then the match will occur against the beginning of the line. (This text to substitute is said to be ‘anchored’.) For example, assume the following substitution:

#substitute {^Devo%0} {Booji Boy%0}

This will substitute any of the following lines:

Devo has arrived.

Devo wears a flower pot on his head.

Devo says “Are we not men?”.

The substitution will not occur for any of the following lines:

Wizard says “Hi Devo!”

Confuse gets down to the subtle music of Devo.

Note: If a caret is encountered in the text to substitute in any position other than the beginning of the line, the caret is treated as a normal character for matching.

Also see

TinTin wildcards

#gag

#ungag

#unsubstitute