MathScript Snippets

From FetishQuest Wiki
Revision as of 17:41, 25 September 2025 by JasX (talk | contribs) (Created page with "A collection of snippets you can use in math scripts. === Update a dvar array on new day. === In this example, we use a dungeon with the label <code>sfq_town</code> . We have the following dVars: * <code>last_trainer_reset</code> Which we store the day when this math script was run last. * <code>trainer_skills</code> Where we store an array of 4 action labels that we'll use in conditions to decide which skills are available at a trainer. <pre>setDvar("sfq_town","last_t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A collection of snippets you can use in math scripts.

Update a dvar array on new day.

In this example, we use a dungeon with the label sfq_town . We have the following dVars:

  • last_trainer_reset Which we store the day when this math script was run last.
  • trainer_skills Where we store an array of 4 action labels that we'll use in conditions to decide which skills are available at a trainer.
setDvar("sfq_town","last_trainer_reset","!$g_day")
actions = getAssetLabelsRegex('Action', '^sfq_pc')
shuffle(actions)
actions = arraySlice(actions, 0,4)
setDvar("sfq_town", "trainer_skills", actions)

Explanation:

  • setDvar("sfq_town","last_trainer_reset","!$g_day") Sets a dvar called last_trainer_reset in the dungeon labeled sfq_town to the current day.