Macro Basics

From GM Forge
Jump to: navigation, search

What is a macro?

A macro is basically an equation you can put somewhere that will automatically pull data from your character sheets or items so that you can automate away basic math.

Writing a macro is pretty easy, but there are some things you should know about them, and the more advanced you want your macro to be, the uglier its going to get. Here's a basic macro for you to look at

d20 + #:Dex + @i.weapon.damage

You can probably make out that this will roll a d20, then add both Dex and weapon damage to the roll.

Basic Math

Basic Operators + - / * ()

All basic math is supported in GM Forge macros



Clamping to a minimum value [3, ∞)

( )_#

Example : Gets the Dex modifier but it can't be less than 0


Clamping to a maximum value (∞,4]

( )|#

Example : Gets the Str modifier but it can't be higher than 3


Minimum and Maximum Value

( )_0|4

Keeps the values between Value Between [0,4]


You can Wrap your text in or "" to use text in macros. Then you can add the text together to make larger text


" attacked with a!"


" attacked with a " + "" + "!"

"Bobby attacked with a Shotgun!"


You can do simple conditional checks using the following format

( [Condition] )?( [True Result] ):( [False Result] )

Example : Adds a strength bonus to 10, but only if it is positive


Condition Logic

Equality !=, !==, ==, ===, <=, >=, <, > And && Or ||

Dice Rolling

Traditional Dice [dice count] d [Sides], ex.

Rolling normal dice is as simple as putting in the dice 1d20 or 5d29

Dropping Rolls

Drop (d/dl) : Keep the highest # results ex. 4d6d3 = Roll 4 d6's and drop the lowest 3

ex. 2d20dl1 = Roll 2 d20's and drop the lowest one

Drop Highest (dh) : Drop the Highest # results ex. 5d20dh3 = Roll 5 d20's and drop the highest 3

Keeping Rolls

Keep (k/kh) : Keep the highest # results ex. 4d6k3 = Roll 4 d6's and keep the highest 3

ex. 2d20kl1 = Roll 2 d20's and keep the lowest one

Keep lowest (kl) : Keep the lowest # results ex. 2d20kl1 = Roll 2 d20's and keep the lowest one


1d20r = re-roll 1s

1d20r=2 = re-roll 2s

1d20r<2 = re-roll results less than 2

1d20r<=2 = re-roll results less than or equal to 2

4d20r2=2 = re-roll up to 2 dice that result in 2

Exploding Dice

1d20e10 = explode on a result of 10

1d20e<=2 = explode on a result less than 2

Unique Dice (Chat and Actions Only)

You can roll unique dice in chat and also in actions. This is used in the "Empire" system to roll dice with symbols on them. You can add custom dice in the system builder, but that will be left for another guide.


[#dice] [ [dice Type] ] : ex. 1[proficiency], 4[fate],

Rolls a dice pool of 4 "fate" dice



Rolls a dice pool of 3 "proficiency" dice and 2 "challenge" dice



Set the value of a specific face on a custom die



You can look up various attributes from your characters and items when using macros, almost all attributes are structured in the same way, which allows you to look up the "Total Modifiers" "Raw Value", or Just the "Value" with its modifiers added onto it.

Referencing Attributes

A Character has rolled a 15 for their Dexterity stat, so they have a 'Stat-Bonus' modifier of +2

M@c.stats.Dex = +2 : Modified Value, The total of the modifiers only R@c.stats.Dex = 15 : Raw Value, only the current value @c.stats.Dex = 15+2 = 17 : Total Value, Adds the current and modifiers

You can short hand certain values if their keys are unique (Only used once in the character sheet) @Dex, R@Dex, M@Dex

Referencing Item attributes

You can reference item values by using @i.[category].[key] ex. @i.weapon.damage ex. @i.spell.level

Attributes Structure

Basic attributes can be referenced like this

@[attribute].name : The name of value

@[attribute].current : The current value

@[attribute].modifiers : The modifiers that are added to .current when referencing this value

Custom Functions

You can get more advanced commands to roll by "invoking" the command.

Here is a list of functions that ship with GM Forge (You can add more via mods)

[b]@:sign([macro])[/b] returns text with a "+" or "-" depending on if the value is postive or negative (0 = +0) [i]TODO : Example[/i]

[b]@:gm()[/b] returns 1 if the local user is a GM and 0 if they are a player

[i]Example : A GM Always rolls a 20, but players have to actually roll a d20[/i] [code] (@:gm()==1)?(20):(d20) [/code]

[b]@:armor()[/b] returns the total of all equipped armor

[b]@:weight()[/b] returns the total weight of all items in characters inventory

[b]@:t([tag])[/b] returns 1 if the asset has the [tag] in question [code] @:t(cleric) [/code]

you can alternatively do [code] @c.tags.cleric @i.tags.spell [/code]

[b]@:table([name macro], [key macro])[/b] References a table [name macro]'s [key macro] and returns the evaluated result Short hand #:[name]([key])

[code] @:table(Hit_Table, "Head")

  1. Hit_Table("Head")


[b]@:constant([key])[/b] References a constant [key] and returns the evaluated result Short hand #:[constant]

[code] @:constant(Dex)+@:constant(prof)

  1. Dex + #:prof


[b]@:int([macro])[/b] turns the result of a macro into an integer [i]TODO : Example[/i]

[b]@:num([macro])[/b] turns the result of a macro into a number [i]TODO : Example[/i]

[b]@:text([macro])[/b] turns the result of a macro into text [i]TODO : Example[/i]

[b]@:raw([macro])[/b] returns a macro as text, without evaluating [i]TODO : Example (This is used for labeling)[/i]

[b]@:equip([key])[/b] returns the total of all equipped items [key] value [i]TODO : Example[/i]