Formula Operators

SGS uses a specific set of operators to define the stat formulas. These extend a small subset of typical mathematical operators with a couple new tricks.

Players need to know how to use these so they can calculate their Thresholds, Pools, and any other generated statistics when their stats change.

GMs need to know how to use these so that they can calculate the same stats when creating new entities or modifying existing ones.

If you're exclusively using one of the SGS software apps, you might not need to use these manually very much.


These operators don't have arguments, and don't need parentheses.


A number is any decimal or integer number, positive or negative. Fractions are not allowed, look at divide for that.

  • 1
  • 1.5
  • 312
  • 0.3333333
  • -9
  • -4.545454

Number Types

The programs handle numbers differently depending on whether they're whole numbers or decimals. When making formulas though, you don't really need to specify one or the other, just write your number, whether it's -23.123 or 6.


A stat ref is a reference to a stat. When calculating the formula by hand, find the stat with this name and use its value in this spot in the formula. When the formula is parsed by the program, it'll go fetch the value of the calculating entity's stat of that name.

  • Agility
  • Physical Graze
  • Armor

Unary Operators

These operators take exactly 1 argument.


The Best operator chooses the best value of a stat from the entity or any of its equipment. It's written with the name of the stat as its argument. Don't pass Best a number, it'll have no idea what you're talking about. If you want the best of multiple stats, do the Best of each stat separately inside a Max.

  • Best(Armor)
  • Best(Arcana)
  • Best(Health)


These operators take exactly 2 arguments. Binary operators have two ways to write them:

  • Function: Add(a, b)
    • The operator (+ etc) is not included here. Instead, the arguments are separated by commas (,).
  • Operator: (a + b)
    • Using the operator method still requires the use of parentheses; you'll get an error if you do something like 1+2+3+4. For our parser to handle that properly, you'd have to write ((1+2)+(3+4)), or use Sum(1, 2, 3, 4) instead.
    • When the program saves your file back out, it'll usually bias towards the operator notation, so if you write Add(Arcana, Knowledge), it'll probably show up in your .md file as (Arcana + Knowledge) instead, but they're logically the same thing.


Add takes one number and adds it to another. There are two ways to write it. See also Sum.

  • Add(5, 5)
  • (5 + 5)


Divide takes one number and divides it by another. There are two ways to write it.

  • Divide(1, 2)
  • (1 / 2)


Multiply takes one number and multiplies it by another. There are three ways to write it.

  • Multiply(3, 3)
  • (3 × 3)
  • (3 * 3)

Note that method 2 uses the actual multiplication character ×, not the letter x character. Since the × is hard to write, you can also use asterisk * like in a calculator app. The program will usually replace it with the technically correct ×.

This is for technical reasons. You could theoretically have a stat called (letter) "x", so we avoid using it for the multiplication symbol.


Subtract takes one number and subtracts the other from it. There are two ways to write it.

  • Subtract(10, 5)
  • (10 - 5)


These operators take one or more arguments. Arguments are always separated by a comma.


Average takes the average of all the arguments and returns that value as a decimal.

  • Average(5, 6, 7, 10)
  • Average(Agility, Creativity, Knowledge)


Max takes the largest value from the list of arguments.

  • Max(1, 10, 100, 1000)
  • Max(Agilty, Creativity, Knowledge)


Min takes the smallest value from the list of arguments.

  • Min(1, 10, 100, 1000)
  • Min(Agilty, Creativity, Knowledge)


Sum adds all the arguments together.

  • Sum(1, 10, 100, 1000)
  • Sum(Agilty, Creativity, Knowledge)