In-game Functions: Difference between revisions

→‎Examples: Changed up the examples a bit
(→‎Examples: Changed up the examples a bit)
(→‎Examples: Changed up the examples a bit)
Line 202: Line 202:
  <syntaxhighlight lang="js">
  <syntaxhighlight lang="js">
  game.farming.addMasteryXP(game.farming.actions.getObjectByID('melvorD:Carrot'), 300);
  game.farming.addMasteryXP(game.farming.actions.getObjectByID('melvorD:Carrot'), 300);
  game.farming.addMasteryXP(game.farming.actions.getObjectByID('melvorD:Carrot'), -500);
  game.farming.addMasteryXP(game.farming.actions.getObjectByID('melvorTotH:Starfruit'), -500);
  </syntaxhighlight>
  </syntaxhighlight>
The first line will result in 300 {{Icon|Mastery}} XP being added to {{Skill|Farming}} for {{ItemIcon|Carrot Seeds}} whereas the second line will remove 500 Mastery XP from Carrot Seeds.
The first line will result in 300 {{Icon|Mastery}} XP being added to {{Skill|Farming}} for {{ItemIcon|Carrot Seeds}} whereas the second line will remove 500 Mastery XP from {{ItemIcon|Starfruit}}.


  <syntaxhighlight lang="js">game.masterySkills.forEach(skill => skill.actions.forEach(action => skill.addMasteryXP(action, 5000)));</syntaxhighlight>
  <syntaxhighlight lang="js">game.masterySkills.forEach(skill => skill.actions.forEach(action => skill.addMasteryXP(action, 5000)));</syntaxhighlight>