Math: Difference between revisions
No edit summary |
No edit summary |
||
Line 51: | Line 51: | ||
=== Players === | === Players === | ||
If a sender is in the event, | If a sender is in the event, their mathvars (see Player.js function appendMathVars for a full list) are added with the prefix se_ - If there's a target, they're added with the prefix ta_ | ||
Here's a list of mathvars for the players, though don't expect this to be up to date, check the code! | |||
{| class="wikitable" | |||
|+se_ or ta_ is prepended to the var | |||
!Var | |||
!Explanation | |||
|- | |||
|SvPhysical | |||
|Physical avoidance. | |||
|- | |||
|SvArcane | |||
|Arcane avoidance. | |||
|- | |||
|SvCorruption | |||
|Corruption avoidance. | |||
|} | |||
== Advanced Formulas == | == Advanced Formulas == | ||
== Functions == | == Functions == |
Revision as of 00:03, 19 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 1. |
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.
You can also use %d to automatically target the current dungeon, like %d_exit_found instead of 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.
Quests
Currently quest vars only store information about when they were completed (game time): q_<questLabel>__time
RP
Var | Explation |
---|---|
rp_targs | Nr of RP targs in active roleplay. |
rp_<rpLabel>_<rpVar> | Fetch an RP var from any RP. Note: To use this, the RP must be set as rpVars Persistent. |
You can also use %rp for short to target the currently active roleplay. Such as %rp_var instead of rp_borm_tavern_mayah_var
Players
If a sender is in the event, their mathvars (see Player.js function appendMathVars for a full list) are added with the prefix se_ - If there's a target, they're added with the prefix ta_
Here's a list of mathvars for the players, though don't expect this to be up to date, check the code!
Var | Explanation |
---|---|
SvPhysical | Physical avoidance. |
SvArcane | Arcane avoidance. |
SvCorruption | Corruption avoidance. |