bMotion uses a fairly simple output macro language for generating text.
It all starts with abstracts, which are lists of words or bits of text which express something. For example, there's a smiles abstract which contains various happy smilies. There's a colours one which contains the names of colours. You get the idea.
Plugins should (but don't have to) generate output using abstracts. bMotion then expands the abstracts to generate the final output. This is what gives bMotion the flexibility in output generation.
Simple Macros
These are the simple things you can put in output which bMotion will understand. They all start with %. Most of them use { and } to hold their parameters if necessary.
- %percent
- A literal %
- %|
- Start a new line on IRC. hello%|world will say "hello" and then say "world". The symbol after the % is a pipe, which is usually Shift-\.
- /<text>
- Do a /me <text>. /greets JamesOff will convert to /me greets JamesOff (i.e. * NoTopic greets JamesOff)
- %noun
- A shortcut for %VAR{sillyThings}. See below.
- %me
- Insert the bot's own ircnick
- %colen
- Inserts random "angry characters" (e.g. "#$*(($^*#")
- %hisher
- Inserts "his" or "her" based on the bot's gender
- %heshe
- Inserts "he" or "she"
- %hishers
- Inserts "his" or "hers"
- %himherself
- Inserts "himself" or "herself"
- %pronoun
- Alias for %himherself
- %%
- First parameter supplied by plugin
- %2
- Second parameter supplied by plugin
More advanced stuff
These macros take (optional) parameters
- %VAR{<name>}
- This is where it all happens. This macro is replaced with a random item chosen from the abstract <name>. Macros are expanded recursively, so any macros (including %VAR) in that one are also expanded. Nesting is limited to 10, else your bot will have a TremendousError while trying to sort something out. %VAR takes an optional parameter, {strip} after the name which removes a leading article (a/the). For example, %VAR{sillyThings} could return "a desk" but %VAR{sillyThings}{strip} will return "desk". The sillyThings abstract is the main list of random nouns in bMotion.
- %OWNER{<name>}
- Makes <name> posessive: NoTopic -> NoTopic's, James -> James'.
- %VERB{<word>}
- Tries to verbise <word>. Words ending "y" are changed to end "ies", everything else has "s" appended.
- %PLURAL{<word>}
- Tries to make <word> a plural.
- %REPEAT{<min>:<max>:<letters>}
- Inserts at least <min> and at most <max> repetitions of <letters>. To get "wheee" with a random number of "e" do wh%REPEAT{3:10:e}. To get a decent length "blblbl" do: %REPEAT{3:6:bl}.
- %NUMBER{<value>}
- bMotion thinks of a number between 1 and <value>
- %SETTING{<plugin>:<setting>:<channel>:<nick>}
- Fetches a value out of the bMotion plugin settings. Plugins generally use this if they have to pass more than two parameters to a output. (You can do two with %% and %2.)
Using people's names
Sometimes you'll want bMotion to use a name from the channel. Here's how:
- %ruser
- Selects a random user (not a bot) from the channel. Uses one of their IRLNames.
- %ruser{<query>}
- Selects a user from the channel based on your query. See below.
- %rbot
- Select a random user known to be a bot from the channel
- %rbot{<query>}
- Select a bot from the channel based on your query. See below.
%PICKUSER and %PICKBOT are deprecated in favour of the new %ruser and %rbot queries.
Querying for %ruser and %rbot is done by giving a word (only one) which will narrow the search. Valid queries are:
- male or female: Choose a user or bot of the given gender
- like or dislike: Choose a user or bot whose gender is attractive to ours (and our orientation). Male straight bots will choose females, etc.
- friend or enemy: (%ruser only) Choose a user who is our friend or not (see bMotionFriendship)
- prev: Choose the same user/bot as last time (use this if you want to refer to the same person multiple times in one output)
If you do not specify prev then a new user/bot is chosen each time the macro is encountered.
Sending output to another bot
If you have MultiplebMotions in a channel, you can cause other bots to say things for you. Note this isn't synchoronised or anything, so can go wrong sometimes (things appear in the wrong order).
Simple
The basic syntax is %BOT[<text>]. Note that that's square brackets not curly braces.
Any abstracts in <text> are expanded by the remote bot, but you must use ¬ not % to prefix them.
bMotion will pick a random bot and send it the text.
e.g. hello%|%BOT[hello]
Using a query
You can use a query to choose the bot you send to by prefixing <text> with @<query>,.
e.g. %BOT[@male,hello]
Randomly sending to a bot
You can tell bMotion to randomly send to a bot by using %bot (lowercase) and prefixing <text> with a percentage chance (e.g. 50 for a 50% chance). When bMotion encounters this, it will decide if it's going to send the output to the bot or not. If not, the entire abstract stops there. You can put a query after the chance and before the text.
e.g. %bot[50,@male,hello]
If you have hello%|%bot[50,¬VAR{smiles}]%|hehe, your bot will say "hello" and there will be a 50% chance another bot will do a random smiley. If it does, we'll say "hehe". If we decide not to send the ¬VAR{smiles} to the other bot, we won't say "hehe" either.
