Skip to main content

Dragonscript

In Starfinder the choices you make can have a wide variety of tangible effects on your character, creature companion, starship, mech, vehicle or NPC. For example, a racial trait may provide a bonus to Athletics, or a class feature may give your character proficiency in Heavy Weapons, or a theme benefit may provide a bonus feat which then subsequently increases your Will saving throw. Being Sickened penalizes attack and damage rolls, amongst other things. Grafts can give creature companions and NPCs Energy Resistance. Upgrades can increase your mech's HP. The list goes on.

Hephaistos encapsulates these effects by using a custom scripting language designed specifically for this purpose called Dragonscript.

caution

So far, the development of Dragonscript has been guided by the effects that are being implemented. While it should cover most of the common effects (bonus to ability score, setting a skill to be a "class skill" etc.), it's far from comprehensive, and you may encounter limitations when trying to code effects of your own.

Overview

Dragonscript can be divided into three parts, with each one building upon the parts that come before it.

Primitives

Primitives are the most basic building blocks in Dragonscript. There are two kinds of primitives:

  • Properties: Any aspect of a character (or other creation) that can be manipulated using Dragonscript.
  • Values: Literals including numbers, strings, true, false, as well as some Starfinder specific things like damage types.

Expressions

Expressions provide a way of combining and manipulating the Primitives to produce a new result. Dragonscript has three expression types:

  • Condition: Check whether a condition between Primitives and Values holds true. Mainly used for If statements and feat prerequisites.
  • Math: Calculate the result of simple arithmetic operators on Properties and Values.
  • Pick: Choose the closest item in a list of key-value pairs based on a Property. This can be useful, for example, when the value of a bonus depends on the character's level.

Statements

Statements use Expressions and Primitives to define the actual effect that a character (or other creation) will undergo. There are four types of statements in Dragonscript:

  • Append: Add items to a Property (eg. give a character a bonus feat).
  • Bonus: Add a numerical bonus (or penalty) to a Property or list of Properties
  • If: Execute a list of statements if a given Condition is true.
  • Set: Set a Property to a specific Value.