From GM Forge

What is a macro?

In GM Forge macros are plaintext strings that are evaluated like mathematical equations. They are the foundation of how you can automate your experience in GM Forge, and have a variety of uses including checking if conditions are met, rolling dice, calculating bonuses and creating messages. Macros are powerful enough to reference all pieces of characters, items, skills and more! Macros are used plentifully throughout the tool, in the dice displays, in the actions menu, through the chat box and chat commands.

Using your first macro

The default screen in GM Forge

When you first join a session you will have the default view, which includes the session's chatbox. Macros can be executed in the chatbox.

To execute a macro simply type

/r <macro here>

and press enter

Macros executed in the chatbox have limited scope, meaning you can only use certain variables. Please see the Macro Variables for more information.

Example Macro

We will be writing a simple macro to roll some special dice for us. Our macro will simply roll 2 d8s and add 1d7 to it.

/r 2d8+1d7



This will result in a dice roll of

As you can see, as long as you specify the number of sides on your dice, you can roll any type of die.



You can optionally specify the quantity of die rolled, meaning the following are all valid macros :



/r d8

/r 2d20

/r 5d363

Dice Pools

In addition to basic dice rolling, you can also roll dice in 'pools'. This is especially useful for dice that require you to count different 'symbols' to determine the outcome. We have two dice in the default games called 'proficiency' and 'ability', you can reference any type of dice by name, as long as it is defined in the game you are playing.

For example

/r 4[proficiency]+2[ability]

If you are using numerical dice, you can filter dice pools based on their result. All dice have some discrete number of sides, so it is possible to apply this to the above pool, although it would be pointless to do so. 4B2[d20] This translates to "Roll a d20 4 times, and add the best two dice together"

4W2[d20+1] This translates to "Roll a d20+1 4 times, and add the worst two dice together"

Functional Math

Macros support all basic operators + - * / as well as order of operations with ().

Function Code Example And && 1 && 0 = 1 Or | | 0 | | 1 = 1 Less than < 1 < 0 = false Less than or Equal <= 1 <= 0 = false Equal == 1 == 0 = false Greater than or Equal >= 1 >= 0 = true Greater than > 1 > 0 = true

In case you need to do more 'advanced' math, we have some options for you.

Function Code Example Rounding Down (Flooring) (x)f (1.2)f = 1 Rounding (x)r (1.2)r = 1 Rounding Up (Ceiling) (x)c (1.2)c = 2 Exponential (x)^y (2)^3 = 8 Minimum Value (x)_y (3+5)_10 = (8)_10 = 10 Maximum Value (x)|y (3+5)|6 = (8)|6 = 6

Conditionals

You can execute 'Conditional' statements, that return the first value if the condition is met, and the second value if the condition isn't met.

(<statement>)?(<if true>):(<if false>)

Example

(1>0)?('1 is greater than 0'):('1 is not greater than 0')



This statement would evaluate to be

'1 is greater than 0'





More Examples

Flip a d100 result

#roll=d100;(@roll)*100-(@roll/10)f*1000)/10+(@roll/10)f

$roll=96;(96)*100-(96/10)f*1000)/10+(96/10)f

60+9

69

Check if your Stat Bonus (tens column) is greater than 3

$stat=42;((@stat/10)f)>=3

$stat=42;((42/10)f)>=3

4>=3

true

What's next?

Check out Macro Variables for more advanced macro training