BRF-commands manual

This manual explains all the brf-commands, how they work, and how you can use them to create random effects to your own BVE-route, whether it is of RW- or CSV-base.

First you have to understand how BRR works:

BRR only reads the brf-route you have written (input file), and creates the processed route in a temporary file (output file), which it then passes to BVE. BRR starts reading the input file from the beginning, searching for BRF-commands. When it finds one, it does something, depending on the command of course. There are two types of commands: text-returning commands, and controlling commands.

When BRR finds a text-returning command, the command returns some kind of text to BRR. BRR then writes this text to the output file, or passes it as a parameter for another command. Controlling commands don't return any text to BRR, but e.g. control how BRR proceeds in reading the input file.

All commands start with hash character "#" and have brackets at the end, even if they don't use any parameters. You can either use "{" and "}" as the brackets, or "<" and ">". For html-technical reasons, "{}" are used in this document.

Examples codes and theory

Controlling commands

#notes{} and #endnotes{}

BRR reads the route description from between these two commands. Only the first #notes block is shown as the description. When BRR finds a #notes block, it excludes it from the output file. This way you can add comment out some parts of the route code.

#if{[boolean]} , #elseif{[boolean]} , #else{} and #endif{}

You can use these commands to make BRR skip or choose between some parts of the file. If [boolean] is "1", it means that it's true. "0" means false. To make #if structures useful, you should use a text-returning command (which returns either "1" or "0") as the [boolean]. Each #if structure must have #if and #endif commands, #elseif and #else are optional.

Example:

#if{#chance{30}}
There's a 30% chance that this text will be processed by BRR.
Everything else before #endif will be skipped.
#elseif{#train{cl313}}
If the [boolean] in the #if wasn't true, then BRR checks if the selected
train is "cl313". If it is, this text will be processed.
#else{}
If the train wasn't "cl313", this text will be processed.
#endif{}

#setvalue{[name],[number]}

Stores [number] to a value called [name]. You can use up to 64 values with different names. [name] can be up to 31 characters long.

#setword{[name],[text]}

Stores [text] to a word called [name]. You can use up to 64 words with different names. [name] can be up to 31 characters long.

#definerndset{[name],[text1],[text2],...,}

Stores [text1], [text2] and so on to a randomset called [name]. You can store 1 - 32 pieces of text. Each piece of text can be up to 15 characters long. [name] can be up to 31 characters long.

#repeat{} , #endrepeat{} and #breakrepeat{}

BRR repeats processing a part of the file, defined with #repeat and #endrepeat commands. #breakrepeat stops this repeat.

Example (adds trees until the repeat stops, 10% chance on every add to stop):

#repeat{}
(Add tree)
#if{#chance{10}}
#breakrepeat{}
#endif{}
#endrepeat{}

#definemacro{[name]} and #endmacro{}

A macro called [name] is defined between #definemacro and #endmacro commands. Up to 8191 characters long text can be stored.

Text-returning commands

#chance{[percent]}

There's a [percent] chance, that "1" is returned. If not, "0" is returned instead. [percent] can be 0 - 100.

#rnd{[number1],[number2]}

Returns a random (integer) number between [number1] and [number2]. Both [numbers] must be 0 or greater.

#rnd25{[number1],[number2]}

Same as #rnd, but the number is divisible by 25, like 0, 25, 50, 75, 100...

#train{[train]}

If the selected train is [train] (the folder name), "1" is returned. "0" is returned otherwise.

#value{[name]}

Returns the number that is stored in the value called [name].

#word{[name]}

Returns the text that is stored in the word called [name].

#dv{[name],[number]}

Returns the sum of [number] and the value stored in [name].

#time{[hours],[minutes],[seconds]}

Returns a clock time, that is understood by BVE.

Example:

#time{14,30,120}
Returns "14.3200", note how 120 seconds is converted to 2 minutes.

#rndset{[name]}

Returns a randomly-selected piece of text from those stored in the randomset called [name].

#add{[number1],[number2]}

Returns the sum of [number1] and [number2].

#sub{[number1],[number2]}

Returns the remainder of [number1] and [number2].

#mul{[number1],[number2]}

Returns the product of [number1] and [number2].

#div{[number1],[number2]}

Returns the quotient of [number1] and [number2].

#equal{[number1],[number2]}

Returns "1", if [number1] is equal to [number2], else returns "0".

#not{[number1],[number2]}

Returns "1", if [number1] isn't equal to [number2], else returns "0".

#greater{[number1],[number2]}

Returns "1", if [number1] is greater than [number2], else returns "0".

#less{[number1],[number2]}

Returns "1", if [number1] is less than [number2], else returns "0".

#macro{[name]}

Returns the text stored to macro [name].

#include{[name]}

Same as #macro, but the text is retrieved from file called [name]. [name] can also contain folder names, like myfolder\myfile.txt.

#choice{[question]}

Asks the user a [question]. If user responds "Yes", command returns "1", otherwise "0".

Back to main page