Math: Difference between revisions
Created page with "The math system!" |
No edit summary |
||
Line 1: | Line 1: | ||
The math system! | The math system in FQ is pretty powerful, and is gradually receiving additional functions which allows you to use it for custom scripts. If a field states that it's a formula, then it uses the math system. The system is based on [https://mathjs.org/ math.js] and all features are supported in FQ, plus a few extras. For an instance, if a field supports a formula, then typing 3+2 into the field would evaluate to 5. Not very useful, but it becomes useful when you use math vars. | ||
== Math Vars == | |||
Math vars are variables you can reference. The available vars depend on the game event that caused the formula to be evaluated (if any). For an instance, you could use 5/g_team_1 as a formula to divide 5 by the nr of players on team 1. | |||
=== Game vars (always available): === | |||
{| class="wikitable" | |||
|+ | |||
!Var | |||
!Explanation | |||
|- | |||
|g_rain | |||
|Amount of rain, between 0 and 100. | |||
|- | |||
|g_sod | |||
|Nr of seconds into the current day. | |||
|- | |||
|g_team_n | |||
|Nr of players on team n (like g_team_0 etc) | |||
|- | |||
|g_time | |||
|Time in seconds since the game started (in-game time, any action will affect time) | |||
|} | |||
=== Dungeon vars (Always available): === | |||
Dungeon vars all use the formula: <code>d_<dungeonLabel>_<dVarLabel></code> | |||
For an instance: the dungeon yuug_portswood_cave has the dungeon var exit_found. You'd reference it by d_yuug_portswood_cave_exit_found. | |||
=== Factions === | |||
Factions all use the formula: <code>f_<factionLabel></code> such as fac_rattani for the rattani faction value. See the faction help in the editor for more info. | |||
{| class="wikitable" | |||
|+ | |||
! | |||
! | |||
! | |||
! | |||
|- | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| | |||
| | |||
| | |||
| | |||
|} |
Revision as of 22:23, 18 February 2024
The math system in FQ is pretty powerful, and is gradually receiving additional functions which allows you to use it for custom scripts. If a field states that it's a formula, then it uses the math system. The system is based on math.js and all features are supported in FQ, plus a few extras. For an instance, if a field supports a formula, then typing 3+2 into the field would evaluate to 5. Not very useful, but it becomes useful when you use math vars.
Math Vars
Math vars are variables you can reference. The available vars depend on the game event that caused the formula to be evaluated (if any). For an instance, you could use 5/g_team_1 as a formula to divide 5 by the nr of players on team 1.
Game vars (always available):
Var | Explanation |
---|---|
g_rain | Amount of rain, between 0 and 100. |
g_sod | Nr of seconds into the current day. |
g_team_n | Nr of players on team n (like g_team_0 etc) |
g_time | Time in seconds since the game started (in-game time, any action will affect time) |
Dungeon vars (Always available):
Dungeon vars all use the formula: d_<dungeonLabel>_<dVarLabel>
For an instance: the dungeon yuug_portswood_cave has the dungeon var exit_found. You'd reference it by d_yuug_portswood_cave_exit_found.
Factions
Factions all use the formula: f_<factionLabel>
such as fac_rattani for the rattani faction value. See the faction help in the editor for more info.