Difference between revisions of "Setting up the new Formula System"
Tom Parker (talk | contribs) (Created page with "{| align="right" | __TOC__ |} =The basics= The new formula system is designed to do a few things relative to data: * Validate formulas at LST load instead of runtime * D...") |
(No difference)
|
Revision as of 00:18, 21 January 2018
The basics
The new formula system is designed to do a few things relative to data:
- Validate formulas at LST load instead of runtime
- Dramatically increase flexibility
- It will replace many tokens, including all the BONUS tokens
Key concepts
To use the new system a few key things need to be remembered:
- It is possible to have local variables
- All variables must be defined prior to use
- Variables are not only numbers, but can be Strings, Dice, etc.
- We call this the variable FORMAT
Required Setup
Every format that needs to be used requires a default value. This value is shared throughout an entire system (it CANNOT be redefined). This is placed into a file referred to in a PCC file from the DATACONTROL: token.
The token used within that lst file is DEFAULTVARIABLEVALUE:
The format is DEFAULTVARIABLEVALUE:X|Y
- X is the format name
- Y is the default value
- Example: DEFAULTVARIABLEVALUE:NUMBER|0
How to define a variable
To define a variable, you need to add an LST file that is referred to in a PCC file from the VARIABLE: token.
There are 2 basic tokens for the VARIABLE file: GLOBAL and LOCAL.
- GLOBAL defines a global variable, usable from anywhere within the PlayerCharacter.
- LOCAL defines a local variable, usable only within the object on which the variable exists (or its children)
- The place where a local variable is usable is called the SCOPE. This could include a STAT (such as the stat's SCORE or STATMOD) or EQUIPMENT. The scopes possible in PCGen are hard-coded.
Both of those tokens can take an additional token on the line called EXPLANATION, which it is advisable to use to communicate to other data monkeys (and it is likely any future editor will also draw on this information)
The format of GLOBAL is GLOBAL:X=Y
- X is the format name
- Y is the variable name
- Example: GLOBAL:ORDEREDPAIR=Face
The format of LOCAL is LOCAL:W|X=Y
- W is the scope of the variable
- X is the format name
- Y is the variable name
- Example: LOCAL:STAT|NUMBER=Score
A few notes about the VARIABLE files: If you see an item without a leading token, e.g.:
- ORDEREDPAIR=Face
...then the system is using the default (GLOBAL). For now, the data standard is to avoid using this shortcut (as far as I know)
If you see an item without a leading format ("X" in both GLOBAL and LOCAL above), e.g.: LOCAL:STAT|Score ...then the format is a NUMBER. For now, the data standard is to avoid using this shortcut (as far as I know)