Anonymous

In-game Functions: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
Line 127: Line 127:
The above code will result in 1000 experience being added to the skill with ID 10 (Thieving).
The above code will result in 1000 experience being added to the skill with ID 10 (Thieving).


== player.addMasteryXP ==
== addMasteryXP ==
The player.addMasteryXP function can be used to add experience to any specific Mastery in a skill. Note that the game will not visually show the updated Masterry experience until after refresh or 1 new action.  
The addMasteryXP function can be used to add experience to any specific Mastery in a skill. Note that the game will not visually show the updated Masterry experience until after refresh or 1 new action.  
  <nowiki>player.addMasteryXP(skillID, masteryID, timePerAction, spendingXP, xp, addToPool, offline)</nowiki>
  <nowiki>addMasteryXP(skillID, masteryID, timePerAction, spendingXP, xp, addToPool, offline)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 181: Line 181:


=== Examples ===
=== Examples ===
  <nowiki>player.addMasteryXP(11, 13, 0, true, 300);</nowiki>
  <nowiki>addMasteryXP(11, 13, 0, true, 300);</nowiki>
The above code will result in 300 Mastery XP being added to the skill with ID 11 (Farming) for Mastery ID 13 (Carrot Seeds).
The above code will result in 300 Mastery XP being added to the skill with ID 11 (Farming) for Mastery ID 13 (Carrot Seeds).


  <nowiki>player.addMasteryXP(2, 3, 3000);</nowiki>
  <nowiki>addMasteryXP(2, 3, 3000);</nowiki>
The above code will result in the calculation & addition of the amount of Mastery XP from an action in skill with ID 2 (Firemaking) for item with Mastery ID 3 (Teak Logs), supposing the action took 3,000 milliseconds.
The above code will result in the calculation & addition of the amount of Mastery XP from an action in skill with ID 2 (Firemaking) for item with Mastery ID 3 (Teak Logs), supposing the action took 3,000 milliseconds.


== player.addMasteryXpToPool ==
== addMasteryXpToPool ==
The player.addMasteryXpToPool function can be used to add mastery pool experience to a skill
The addMasteryXpToPool function can be used to add mastery pool experience to a skill
  <nowiki>player.addMasteryXP(skillID, xp, offline, token)</nowiki>
  <nowiki>addMasteryXP(skillID, xp, offline, token)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 204: Line 204:
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.addMasteryXpToPool(11, 600);</nowiki>
  <nowiki>addMasteryXpToPool(11, 600);</nowiki>
The above code will result in 150 Mastery Pool XP being added to the skill with ID 11 (Farming) if the player is under 99 in farming. Or 300 Mastery Pool XP being added if the player is over 99
The above code will result in 150 Mastery Pool XP being added to the skill with ID 11 (Farming) if the player is under 99 in farming. Or 300 Mastery Pool XP being added if the player is over 99


  <nowiki>player.addMasteryXP(11, 600, false, true);</nowiki>
  <nowiki>addMasteryXP(11, 600, false, true);</nowiki>
The above code will result in 600 Mastery Pool XP being added to the skill with ID 11 (Farming) regardless of the level of the player in the skill.
The above code will result in 600 Mastery Pool XP being added to the skill with ID 11 (Farming) regardless of the level of the player in the skill.


166

edits