GDF3 File and Data Specifications for GCA4
Root FileSpec Page |
GCA Site Home | Docs & Help Page |
Functions are feature of the math engine that provide you access to sometimes complex features, in a simple fashion. All functions start with the @ sign to tell GCA that it's a function.
Not yet done:
@itemhasmod - The level of the modifier specified, if the item specified has the modifier applied.The documentation below uses templates to demonstrate the structure of the various functions. The templates are meant to provide a quick way to see how the functions are formatted. Trying to do this, however, is not always easy, and we have made some formatting decisions that may take some getting used to. So here's an explanation of how things work.
monospaced font.
@fac |
|
Description: |
This function returns the factorial of a given number. |
Template: |
|
Detail: |
A factorial is the product of all positive integers less than or equal to |
Examples: | |
Example: |
This example will return a value of 120 (5*4*3*2*1 = 120). |
@fix |
|
Description: |
This function returns the integer part of a number. |
Template: |
|
Detail: |
The |
Examples: | |
Examples: |
Negative numbers are effectively rounded up (-8 is greater than -8.45). If you always want to round down, use @int. |
@hasmod |
|
Description: |
This function returns the level of the modifier specified, if 'owned' by the current item. |
Template: |
|
Detail: |
If the modifier name modifier has been applied to the trait being evaluated, then the level of that modifier will be returned. Otherwise, 0 will be returned. |
Examples: | |
Example: |
This example will return the level of XXXXXXXXXX, or 0 if it does not exist. |
@if |
|
Description: |
This function evaluates an expression and returns one of two possible results depending on the value of the expression. |
Template: |
|
Detail: |
The The |
Examples: | |
Example 1: |
In this case, if the character's IQ is more than 10, upto() would be 10, otherwise it would be 5. Watch those parens to make sure they match! |
Example 2: |
This example gives 0 to an item if IQ is less than 10, +1 if IQ is 11 or 12, and +2 if IQ is 13 or greater. Be very cautious when you nest one @if function within another. It can be very easy to loose track of the parens, and thereby crash GCA when loading your data file because of unmatched pairs. |
@indexedvalue |
|
Description: |
This function uses an index number to select a value from a list. |
Template: |
|
Detail: |
This function uses the value of
|
Examples: | |
Example: |
The system variable |
@int |
|
Description: |
This function returns the first integer less than or equal to a number. |
Template: |
|
Detail: |
The |
Examples: | |
Examples: |
This function always rounds down (-9 is less than -8.45). If you just want to remove the fractional part of a number, use @fix. |
@log |
|
Description: |
This function returns the base 10 log of a number. |
Template: |
|
Detail: |
When a number is expressed as a power of 10 ( |
Examples: | |
Examples: |
|
@max |
|
Description: |
This function returns the highest value from a list of values. |
Template: |
|
Detail: |
The list of values can contain any number of items. A value can be either a number or a numeric expression. When the function is part of a Skill definition, list items can include references to the Also see the related function @min, which works just like |
Examples: | |
Example 1: |
This example defines an upto() tag in a skill. GCA evaluates the expressions in the list, then selects the highest value among the three items. For example, if |
Example 2: |
This example gives a bonus to the Blacksmith skill if ST is greater than 13, but doesn't subtract anything from the skill if ST-13 is a negative number. |
@min |
|
Description: |
This function returns the lowest value from a list of values. |
Template: |
|
Detail: |
This function works exactly like @max except that it returns the lowest value in the list rather than the highest. |
Examples: | |
Example: |
This example uses |
@nlog |
|
Description: |
This function returns the natural log of a number. |
Template: |
|
Detail: |
The |
Examples: | |
Examples: |
Since GCA expressions don't use double precision arithmetic, small rounding errors are to be expected. For example, |
@power |
|
Description: |
This function returns a number raised to a given power. |
Template: |
|
Detail: |
|
Examples: | |
Example: |
|
@sqr |
|
Description: |
This function returns the square root of a number. |
Template: |
|
Detail: |
|
Examples: | |
Example: |
|