Jump to content

User:ClueBot II/ClueBot Script

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by CO (talk | contribs) at 21:17, 23 August 2007 (Example: okay, fix). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

ClueBot Script is a trivial scripting language designed specifically for very basic Wikipedia bot tasks.

Syntax

The syntax is very similar to that of PHP. Each statement must end in a semicolon (";"). Conditionals are grouped in parenthesis ("()"). Groups of statements are grouped in braces ("{}"). Variables are prefixed with a percent sign ("%").

Statements

if

Syntax

if conditional statement

Description

Executes statement if conditional is satisfied.

set

Syntax

set %variable conditional/value

Description

Sets %variable to the value of conditional/value.

unset

Syntax

unset %variable

Description

Unsets %variable.

while

Syntax

while conditional statement

Description

Execute statement until conditional is no longer satisfied.

pagereplace

Syntax

pagereplaceTemplate:Fn %page %search %replace

Description

Replaces all instances of the value of %search with the value of %replace on the page name stored in %page.

pagepregreplace

Syntax

pagepregreplaceTemplate:Fn %page %search %replace

Description

Replaces all instances of the regular expression stored in %search with the value of %replace on the page name stored in %page.

pageappend

Syntax

pageappendTemplate:Fn %page %data

Description

Appends the data stored in %data to the end of the page name stored in %page.

pageset

Syntax

pagesetTemplate:Fn %page %data

Description

Sets the content of the page name stored in %page to the data stored in %data.

pageget

Syntax

pageget %page %data

Description

Retrieves the page name stored in %page into the variable %data.

Example

set %page "User:ClueBot II/Sandbox"; 
set %data "{{db-user}}"; 
set %reason "And now we mark it for deletion. (bot)";
pageset %page %data %reason;

Footnotes

  • Template:Fnb This command has an optional parameter %editsummary which can be used to set an edit summary. Otherwise, one is automatically generated.