GM Forge - Virtual Tabletop

GM Forge - Virtual Tabletop

Not enough ratings
Macro Overview
By Mythic Archive and 1 collaborators
How do macros work? Where can you use them? How much can they do?

All these questions should be answered or at least touched upon in this guide
   
Award
Favorite
Favorited
Unfavorite
Macros Basics
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
1+1 3+2 2*4 10/2 (10+2*(3-4))/5

Clamping to a minimum value [3, ∞)
( )_#
Example : Gets the Dex modifier but it can't be less than 0
(M@Dex)_0

Clamping to a maximum value (∞,4]
( )|#
Example : Gets the Str modifier but it can't be higher than 3
(M@Str)|3

Minimum and Maximum Value
( )_0|4
Keeps the values between Value Between [0,4]

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

Example
or
"@c.info.name attacked with a " + "@i.info.name" + "!"

"Bobby attacked with a Shotgun!"


Conditions
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
10+(M@Str>0)?(M@Str):(0)


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


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.

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

Rolls a dice pool of 4 "fate" dice
4[fate]

Rolls a dice pool of 3 "proficiency" dice and 2 "challenge" dice
3[proficiency]+2[challenge]

Set the value of a specific face on a custom die
4[$die=proficiency;4]
Referencing
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


Total Armor
@:armor() : Will return the total armor value of all equipped items


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)

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

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

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

@:armor()
returns the total of all equipped armor


@:weight()
returns the total weight of all items in characters inventory


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

you can alternatively do
@c.tags.cleric @i.tags.spell

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

@:table(Hit_Table, "Head") #:Hit_Table("Head")

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

@:constant(Dex)+@:constant(prof) #:Dex + #:prof


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


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


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


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


@:equip([key])
returns the total of all equipped items [key] value
TODO : Example
2 Comments
Mythic Archive  [author] 19 Jun, 2018 @ 11:12am 
Tendon-Cobar you can only do that from the actions tabs, and you have to build it into the raw JSON. But yes its possible :)
J0RHAN 9 Jun, 2018 @ 4:06am 
hello, thank you for the guide. I would like to know if there is a way to collect stats from a target actor ? for example if i do an attack i would like to know if the result is higher than the armor stat of the target. Would it be like that : @target.counters.armor ?