In-game Functions: Difference between revisions

From Melvor Idle
(Update for v1.0.5 & document discoverMark)
(Updated the functions to the new game object format.)
Line 1: Line 1:
{{V|1.0.5}}
{{V|1.1}}
{| class="warningbox"
| '''Various sections of this page are incomplete or reference pages which have not been updated. Due to this, certain functions may not have all the information easily available on the wiki at this time.'''
|}
In-game functions are responsible for most things in the game. It is possible to interact directly with them through the console. This can be used to add items, levels, GP and more. These functions can be executed though the console. To access the console open Developer Tools (usually by pressing F12) in your browser and navigate to the console. Then, simply paste the code in the input field and press enter. Most functions will require you to fill out variables in the code before executing them. Note that all code is case sensitive.
In-game functions are responsible for most things in the game. It is possible to interact directly with them through the console. This can be used to add items, levels, GP and more. These functions can be executed though the console. To access the console open Developer Tools (usually by pressing F12) in your browser and navigate to the console. Then, simply paste the code in the input field and press enter. Most functions will require you to fill out variables in the code before executing them. Note that all code is case sensitive.


Line 11: Line 14:
Players should refer to the [[Scripting and Extensions Instructions#Steam Console and Scripts|Scripting and Extensions Instructions]] page for a step-by-step guide on using these functions with the Steam version of Melvor Idle.
Players should refer to the [[Scripting and Extensions Instructions#Steam Console and Scripts|Scripting and Extensions Instructions]] page for a step-by-step guide on using these functions with the Steam version of Melvor Idle.


== addItemToBank ==
== Add Item to Bank ==
The addItemToBank function can be used to add any item in the game to the bank.
The addItemByID function can be used to add any item in the game to the bank.
  <nowiki>addItemToBank(itemID, quantity, found, showNotification, ignoreBankSpace)</nowiki>
  <nowiki>game.bank.addItemByID(itemID, quantity, found, showNotification, ignoreBankSpace)</nowiki>


=== Attributes ===
=== Attributes ===
Line 20: Line 23:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| itemID || int || No || || The ID of the item.<br />For a complete list of items and their IDs, see: [[Table of Items]]
| itemID || string || No || || The ID of the item.<br />For a complete list of items and their IDs, see: [[Table of Items]]
|-
|-
| quantity || int || No || || Quantity of item to add. Will remove items from the bank if a negative value is specified
| quantity || int || No || || Quantity of item to add. Will remove items from the bank if a negative value is specified
Line 32: Line 35:


=== Examples ===
=== Examples ===
  <nowiki>addItemToBank(1, 10, false);</nowiki>
  <nowiki>game.bank.addItemByID("melvorD:Oak_Logs", 10, false);</nowiki>
The above code will result in 10 items with item ID 1 (Oak Logs) being added to the Bank without them appearing in the item completion log, but with notification.
The above code will result in 10 items with item ID melvorD:Oak_Logs being added to the Bank without them appearing in the item completion log, but with notification.


== removeItemFromBank ==
== Remove Item from Bank ==
The removeItemFromBank function can be used to remove any item from the bank
The removeItemQuantity function can be used to remove any item from the bank
  <nowiki>removeItemFromBank(itemID, deactiveGloves)</nowiki>
  <nowiki>game.bank.removeItemQuantity(itemID, quantity, removeItemCharges)</nowiki>


=== Attributes ===
=== Attributes ===
Line 44: Line 47:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| itemID || int || No || || The ID of the item.<br />For a complete list of items and their IDs, see: [[Table of Items]]
| itemID || string || No || || The ID of the item.<br />For a complete list of items and their IDs, see: [[Table of Items]]
|-
| quantity || int || No || || The number of items to remove.
|-
|-
| deactiveGloves || boolean || Yes || true || If <code>true</code>, the count of glove charges will be set to 0 if the itemID is for a pair of gloves with charges.
| removeItemCharges || boolean || Yes || true || If <code>true</code>, the count of glove charges will be set to 0 if the itemID is for a pair of gloves with charges.
|}
|}


=== Examples ===
=== Examples ===
  <nowiki>removeItemFromBank(1);</nowiki>
  <nowiki>game.bank.removeItemQuantity("melvorD:Oak_Logs", 10);</nowiki>
The above code will result in item ID 1 (Oak Logs) being removed from the bank.
The above code will result in 10 of item ID "melvorD:Oak_Logs" being removed from the bank.


== player.addGP ==
== Add GP ==
The player.addGP function can be used to add [[Currency#Gold Pieces|GP]] to a player.
The gp.add function can be used to add [[Currency#Gold Pieces|GP]] to a player.
  <nowiki>player.addGP(amount, source)</nowiki>
  <nowiki>game.gp.add(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 62: Line 67:
|-
|-
| amount|| int || No || || The quantity of GP to add
| amount|| int || No || || The quantity of GP to add
|-
| source || string || No || || The source of the GP being added. If set to "Combat" it will add the GP to the players "GP received in combat" stat for tracking.
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.addGP(1,"");</nowiki>
  <nowiki>game.gp.add(1);</nowiki>
The above code will add 1 gp to the player, and not place the info into the players stats for tracking.
The above code will add 1 gp to the player.
<nowiki>player.addGP(1,"Combat");</nowiki>
The above code will add 1 gp to the player, and place the info into the players stats for tracking.


== player.removeGP ==
== Remove GP ==
The player.removeGP function can be used to remove [[Currency#Gold Pieces|GP]] from a player. If the amount specified is greater than the amount the player currently has, then no GP will be removed.
The gp.remove function can be used to remove [[Currency#Gold Pieces|GP]] from a player. If the amount specified is greater than the amount the player currently has, then GP will go into the negatives.
  <nowiki>player.removeGP(amount)</nowiki>
  <nowiki>game.gp.remove(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 82: Line 83:
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.removeGP(1);</nowiki>
  <nowiki>game.gp.remove(1);</nowiki>
The above code will remove 1 GP from the player.
The above code will remove 1 GP from the player.


== player.addSlayerCoins ==
== Add Slayer Coins ==
The player.addSlayerCoins function can be used to add slayer coins to a player.
The slayerCoins.add function can be used to add slayer coins to a player.
  <nowiki>player.addSlayerCoins(amount)</nowiki>
  <nowiki>game.slayerCoins.add(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 93: Line 94:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| amount || int || No || || The quantity of slayer coins to add. This amount can be increased or decreased if the player is currently affected by any +/-% Slayer coins bonuses.
| amount || int || No || || The quantity of slayer coins to add.
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.addSlayerCoins(1);</nowiki>
  <nowiki>game.slayerCoins.add(1);</nowiki>
The above code will add 1 slayer coin to the player, and update player stats.
The above code will add 1 slayer coin to the player.


== player.removeSlayerCoins ==
== Remove Slayer Coins ==
The player.removeSlayerCoins function can be used to remove slayer coins from a player. If the amount specified is greater than the amount the player currently has, then no slayer coins will be removed.
The slayerCoins.remove function can be used to remove slayer coins from a player. If the amount specified is greater than the amount the player currently has, then slayer coins will go into the negatives.
  <nowiki>player.removeSlayerCoins(amount, render)</nowiki>
  <nowiki>game.slayerCoins.remove(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 108: Line 109:
|-
|-
| amount || int || No || || The quantity of slayer coins to remove
| amount || int || No || || The quantity of slayer coins to remove
|-
| render || boolean || Yes || true || If <code>true</code>, spawns a notification showing the quantity of coins removed and immediately updates the UI
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.removeSlayerCoins(1);</nowiki>
  <nowiki>game.slayerCoins.remove(1);</nowiki>
The above code will remove 1 slayer coin from the player, and immediately update the UI.
The above code will remove 1 slayer coin from the player.


== updateRaidCoins ==
== Add Raid Coins==
The updateRaidCoins function can be used to add or remove [[Currency#Raid Coins|raid coins]] from a player.
The raidCoins.add function can be used to add [[Currency#Raid Coins|raid coins]] to a player.
  <nowiki>updateRaidCoins(amount)</nowiki>
  <nowiki>game.raidCoins.add(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 123: Line 122:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| amount || int || Yes || 0 || The quantity of raid coins to be added. Coins can also be removed if a negative number is specified.
| amount || int || Yes || 0 || The quantity of raid coins to be added.
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>updateRaidCoins(1);</nowiki>
  <nowiki>game.raidCoins.add(1);</nowiki>
The above will add 1 raid coin to the player.
The above will add 1 raid coin to the player.


== player.addPrayerPoints ==
== Remove Raid Coins==
The player.addPrayerPoints function can be used to add prayer points to a player.
The raidCoins.remove function can be used to remove [[Currency#Raid Coins|raid coins]] from a player.
  <nowiki>player.addPrayerPoints(amount)</nowiki>
  <nowiki>game.raidCoins.remove(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 137: Line 136:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| amount || int || No || || The quantity of prayer points to add.
| amount || int || Yes || 0 || The quantity of raid coins to be removed.
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.addPrayerPoints(1);</nowiki>
  <nowiki>game.raidCoins.remvoe(1);</nowiki>
The above code will add 1 prayer point to the player, and update player stats.
The above will remove 1 raid coin from the player.


== player.addXP ==
== Add Prayer Points ==
The player.addXP function can be used to add experience to any skill. Note that the game will not visually show the updated XP until after refresh or 1 new action.
The combat.player.addPrayerPoints function can be used to add prayer points to a player.
  <nowiki>player.addXP(skillID, xp)</nowiki>
  <nowiki>game.combat.player.addPrayerPoints(amount)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 151: Line 150:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| skillID || int || No || || The ID of the skill, see: [[#Skill ID|Skill ID]]
| amount || int || No || || The quantity of prayer points to add.
|-
| xp || int || No || || Amount of experience to add. Note that this is the amount of experience added before bonuses such as that from the {{ItemIcon|Firemaking Skillcape}} or {{PetIcon|Pyro}}
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>player.addXP(10, 1000);</nowiki>
  <nowiki>game.combat.player.addPrayerPoints(1);</nowiki>
The above code will result in 1000 experience being added to the skill with ID 10 (Thieving).
The above code will add 1 prayer point to the player, and update player stats.


== addMasteryXP ==
== Add XP ==
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 Mastery experience until after refresh or 1 new action.  
The addXP function can be used to add experience to any skill.
  <nowiki>addMasteryXP(skillID, masteryID, timePerAction, spendingXP, xp, addToPool, offline)</nowiki>
  <nowiki>game.skill.addXP(xp)</nowiki>
where <code>skill</code> is the lowercase name of the skill you are adding experience to.
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 167: Line 165:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| skillID || int || No || || The ID of the skill, see: [[#Skill ID|Skill ID]]
| xp || int || No || || Amount of experience to add.
|-
| masteryID || int || No || || The skill specific Mastery ID. See [[#Mastery IDs|below]] for information on how to identify Mastery ID values
|-
| timePerAction || int || No || || The interval (in milliseconds) of the action granting mastery experience. Has no effect on the result if <code>spendingXP</code> is <code>true</code>
|-
| spendingXP || boolean || Yes || false || <code>true</code>: The amount of experience specified with <code>xp</code> is added, <code>timePerAction</code> is ignored<br /><code>false</code>: The amount of experience added is determined by the [[Mastery#Earning Mastery XP|Mastery experience per action calculation]], <code>xp</code> is ignored
|-
| xp || int || Yes || 0 || Amount of experience to add. Has no effect on the result if <code>spendingXP</code> is <code>false</code>
|-
| addToPool || boolean || Yes || true || Determines whether a portion of the specified experience amount is added to the mastery pool for the relevant skill or not
|-
| offline || boolean || Yes || false || Determines if various UI elements are immediately updated to reflect the experience gain. Should usually be left as the default value
|}
|}
=== Mastery IDs ===
=== Examples ===
Below is a reference of how the various mastery ID values may be identified.
<nowiki>game.thieving.addXP(1000);</nowiki>
The above code will result in 1000 experience being added to Theiving.
 
== Add Mastery XP ==
The addMasteryXP function can be used to add experience to any specific Mastery in a skill.
<nowiki>game.skill.addMasteryXP(masteryAction, xp)</nowiki>
where <code>skill</code> is the lowercase name of the skill you are adding mastery experience to.
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Skill !! Mastery ID
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
| {{Skill|Woodcutting}} || Index of the required tree within the <code>Trees</code> enum
|-
| {{Skill|Thieving}} || Index of the required NPC within the <code>ThievingNPCs</code> enum
|-
| {{Skill|Agility}} || Index of the required obstacle within the <code>AgilityObstacles</code> enum
|-
| {{Skill|Astrology}} || Index of the required constellation within the <code>ASTROLOGY</code> constant
|-
| {{Skill|Farming}} || <code>items[itemID].masteryID[1]</code> replacing <code>itemID</code> with the ID of the planted seed
|-
| {{Skill|Fishing}} || rowspan="10" | <code>items[itemID].masteryID[1]</code>, replacing <code>itemID</code> with the ID of the item produced by the action
|-
| {{Skill|Firemaking}}
|-
| {{Skill|Cooking}}
|-
| {{Skill|Mining}}
|-
| {{Skill|Smithing}}
|-
| {{Skill|Fletching}}
|-
| {{Skill|Crafting}}
|-
| {{Skill|Runecrafting}}
|-
|-
| {{Skill|Herblore}}
| masteryAction || object || No || || The action to add Mastery XP to. Obtained with <code>game.skill.actions.allObjects[n]</code> where n is the ID of the action, starting at 0. Also obtainable with <code>game.skill.actions.getObjectByID(id)</code> where id is the string ID of the action.
|-
|-
| {{Skill|Summoning}}
| xp || int || Yes || 0 || Amount of experience to add.
|}
|}


=== Examples ===
=== Examples ===
  <nowiki>addMasteryXP(11, 13, 0, true, 300);</nowiki>
  <nowiki>game.farming.addMasteryXP(game.farming.actions.allObjects[13], 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 Farming for Mastery ID 13 (Carrot Seeds).


  <nowiki>addMasteryXP(2, 3, 3000);</nowiki>
  <nowiki>game.firemaking.addMasteryXP(game.firemaking.actions.allObjects[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 3000 Mastery XP being added to Firemaking for Mastery ID 3 (Teak Logs).


== addMasteryXPToPool ==
== Add Mastery XP to Pool==
The addMasteryXpToPool function can be used to add mastery pool experience to a skill
The addMasteryPoolXP function can be used to add mastery pool experience to a skill
  <nowiki>addMasteryXPToPool(skillID, xp, offline, token)</nowiki>
  <nowiki>game.skill.addMasteryPoolXP(xp)</nowiki>
where <code>skill</code> is the lowercase name of the skill you are adding mastery experience to.
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 233: Line 201:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| skillID || int || No || || The ID of the skill, see: [[#Skill ID|Skill ID]]
| xp || int || Yes || 0 || Amount of experience to add.
|-
| xp || int || Yes || 0 || Amount of experience to add. One quarter of this value will be added if the player is under level 99 in that skill. One half of the value will be added if the player is level 99 in that skill.
|-
| offline || boolean || Yes || false || Determines if various UI elements are immediately updated to reflect the experience gain. Should usually be left as the default value
|-
| token || boolean || Yes || false || Forces forces 100% of the <code>xp</code> value to be added to the pool, ignoring player's level within the skill.
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>addMasteryXPToPool(11, 600);</nowiki>
  <nowiki>game.woodcutting.addMasterPoolXP(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 600 Mastery Pool XP being added to Woodcutting.


== unlockPet ==
== Unlock Pet ==
The unlockPet function is used to unlock [[Pets]]. Note that unlocking a pet is permanent - there is no supported method to lock a pet once again.
The petManager.unlockPetByID function is used to unlock [[Pets]]. Note that unlocking a pet is permanent - there is no supported method to lock a pet once again.
  <nowiki>unlockPet(petID, offline)</nowiki>
  <nowiki>game.petManager.unlockPetByID(petID)</nowiki>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
Line 253: Line 215:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| petID || int || No || || The ID of the pet, which can be found on the individual pet pages (such as {{PetIcon|Ty}} for example).
| petID || string || No || || The ID of the pet, which can be found on the individual pet pages (such as {{PetIcon|Ty}} for example).
|-
| offline || boolean || Yes || false || Determines if various UI elements are immediately updated to reflect the experience gain. Should usually be left as the default value
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>unlockPet(4);</nowiki>
  <nowiki>game.petManager.unlockPetByID("melvorD:CoolRock");</nowiki>
The above code will result in the unlocking of {{PetIcon|Cool Rock}}.
The above code will result in the unlocking of {{PetIcon|Cool Rock}}.


Line 269: Line 229:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| mark || object || No || || A mark object, representing the mark to be discovered.<br/>An array of all available marks can be accessed at <code>Summoning.marks</code>, and the IDs of each mark can be easily identified using the <code>Summons</code> enum.
| mark || object || No || || The mark to discover. Obtained with <code>game.summoning.actions.allObjects[n]</code> where n is the ID of the mark, starting at 0. Also obtainable with <code>game.summoning.actions.getObjectByID(id)</code> where id is the string ID of the action.
|}
|}
=== Examples ===
=== Examples ===
  <nowiki>game.summoning.discoverMark(Summoning.marks[Summons.Dragon]);</nowiki>
  <nowiki>game.summoning.discoverMark(game.summoning.actions.allObjects[15]);</nowiki>
The above code discovers a single mark for the {{ItemIcon|Dragon}} familiar. Marks may be found for other familiars by changing <code>Summons.Dragon</code> as required.
The above code discovers a single mark for the {{ItemIcon|Dragon}} familiar.
 
== Reference Tables ==
=== Skill ID ===
{| class="wikitable sortable"
|-
! ID !! Skill
|-
| 0 || {{Skill|Woodcutting}}
|-
| 1 || {{Skill|Fishing}}
|-
| 2 || {{Skill|Firemaking}}
|-
| 3 || {{Skill|Cooking}}
|-
| 4 || {{Skill|Mining}}
|-
| 5 || {{Skill|Smithing}}
|-
| 6 || {{Skill|Attack}}
|-
| 7 || {{Skill|Strength}}
|-
| 8 || {{Skill|Defence}}
|-
| 9 || {{Skill|Hitpoints}}
|-
| 10 || {{Skill|Thieving}}
|-
| 11 || {{Skill|Farming}}
|-
| 12 || {{Skill|Ranged}}
|-
| 13 || {{Skill|Fletching}}
|-
| 14 || {{Skill|Crafting}}
|-
| 15 || {{Skill|Runecrafting}}
|-
| 16 || {{Skill|Magic}}
|-
| 17 || {{Skill|Prayer}}
|-
| 18 || {{Skill|Slayer}}
|-
| 19 || {{Skill|Herblore}}
|-
| 20 || {{Skill|Agility}}
|-
| 21 || {{Skill|Summoning}}
|-
|22 || {{Skill|Astrology}}
|}

Revision as of 16:30, 18 October 2022

This page was last updated for (v1.1).
Various sections of this page are incomplete or reference pages which have not been updated. Due to this, certain functions may not have all the information easily available on the wiki at this time.

In-game functions are responsible for most things in the game. It is possible to interact directly with them through the console. This can be used to add items, levels, GP and more. These functions can be executed though the console. To access the console open Developer Tools (usually by pressing F12) in your browser and navigate to the console. Then, simply paste the code in the input field and press enter. Most functions will require you to fill out variables in the code before executing them. Note that all code is case sensitive.

Disclaimer: Blindly adding items and experience will most likely take away game enjoyment. It is highly encouraged only to use this to either test things or recoup lost items/progress due to lost saves.

You are playing around with the code of the game if you make mistakes, it is possible that could corrupt your game. It is highly recommended to BACKUP YOUR SAVE before running any in-game functions.

Using In-game Functions On Steam

Players should refer to the Scripting and Extensions Instructions page for a step-by-step guide on using these functions with the Steam version of Melvor Idle.

Add Item to Bank

The addItemByID function can be used to add any item in the game to the bank.

game.bank.addItemByID(itemID, quantity, found, showNotification, ignoreBankSpace)

Attributes

Attribute Type Optional? Default Value Description
itemID string No The ID of the item.
For a complete list of items and their IDs, see: Table of Items
quantity int No Quantity of item to add. Will remove items from the bank if a negative value is specified
found boolean Yes true Determines if it will show in item completion log
showNotification boolean Yes true Determines if it will show notification
ignoreBankSpace boolean Yes false If true, the item will be added to the bank even if the bank is already full

Examples

game.bank.addItemByID("melvorD:Oak_Logs", 10, false);

The above code will result in 10 items with item ID melvorD:Oak_Logs being added to the Bank without them appearing in the item completion log, but with notification.

Remove Item from Bank

The removeItemQuantity function can be used to remove any item from the bank

game.bank.removeItemQuantity(itemID, quantity, removeItemCharges)

Attributes

Attribute Type Optional? Default Value Description
itemID string No The ID of the item.
For a complete list of items and their IDs, see: Table of Items
quantity int No The number of items to remove.
removeItemCharges boolean Yes true If true, the count of glove charges will be set to 0 if the itemID is for a pair of gloves with charges.

Examples

game.bank.removeItemQuantity("melvorD:Oak_Logs", 10);

The above code will result in 10 of item ID "melvorD:Oak_Logs" being removed from the bank.

Add GP

The gp.add function can be used to add GP to a player.

game.gp.add(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int No The quantity of GP to add

Examples

game.gp.add(1);

The above code will add 1 gp to the player.

Remove GP

The gp.remove function can be used to remove GP from a player. If the amount specified is greater than the amount the player currently has, then GP will go into the negatives.

game.gp.remove(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int No The quantity of GP to remove

Examples

game.gp.remove(1);

The above code will remove 1 GP from the player.

Add Slayer Coins

The slayerCoins.add function can be used to add slayer coins to a player.

game.slayerCoins.add(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int No The quantity of slayer coins to add.

Examples

game.slayerCoins.add(1);

The above code will add 1 slayer coin to the player.

Remove Slayer Coins

The slayerCoins.remove function can be used to remove slayer coins from a player. If the amount specified is greater than the amount the player currently has, then slayer coins will go into the negatives.

game.slayerCoins.remove(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int No The quantity of slayer coins to remove

Examples

game.slayerCoins.remove(1);

The above code will remove 1 slayer coin from the player.

Add Raid Coins

The raidCoins.add function can be used to add raid coins to a player.

game.raidCoins.add(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int Yes 0 The quantity of raid coins to be added.

Examples

game.raidCoins.add(1);

The above will add 1 raid coin to the player.

Remove Raid Coins

The raidCoins.remove function can be used to remove raid coins from a player.

game.raidCoins.remove(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int Yes 0 The quantity of raid coins to be removed.

Examples

game.raidCoins.remvoe(1);

The above will remove 1 raid coin from the player.

Add Prayer Points

The combat.player.addPrayerPoints function can be used to add prayer points to a player.

game.combat.player.addPrayerPoints(amount)

Attributes

Attribute Type Optional? Default Value Description
amount int No The quantity of prayer points to add.

Examples

game.combat.player.addPrayerPoints(1);

The above code will add 1 prayer point to the player, and update player stats.

Add XP

The addXP function can be used to add experience to any skill.

game.skill.addXP(xp)

where skill is the lowercase name of the skill you are adding experience to.

Attributes

Attribute Type Optional? Default Value Description
xp int No Amount of experience to add.

Examples

game.thieving.addXP(1000);

The above code will result in 1000 experience being added to Theiving.

Add Mastery XP

The addMasteryXP function can be used to add experience to any specific Mastery in a skill.

game.skill.addMasteryXP(masteryAction, xp)

where skill is the lowercase name of the skill you are adding mastery experience to.

Attributes

Attribute Type Optional? Default Value Description
masteryAction object No The action to add Mastery XP to. Obtained with game.skill.actions.allObjects[n] where n is the ID of the action, starting at 0. Also obtainable with game.skill.actions.getObjectByID(id) where id is the string ID of the action.
xp int Yes 0 Amount of experience to add.

Examples

game.farming.addMasteryXP(game.farming.actions.allObjects[13], 300);

The above code will result in 300 Mastery XP being added to Farming for Mastery ID 13 (Carrot Seeds).

game.firemaking.addMasteryXP(game.firemaking.actions.allObjects[3], 3000);

The above code will result in 3000 Mastery XP being added to Firemaking for Mastery ID 3 (Teak Logs).

Add Mastery XP to Pool

The addMasteryPoolXP function can be used to add mastery pool experience to a skill

game.skill.addMasteryPoolXP(xp)

where skill is the lowercase name of the skill you are adding mastery experience to.

Attributes

Attribute Type Optional? Default Value Description
xp int Yes 0 Amount of experience to add.

Examples

game.woodcutting.addMasterPoolXP(600);

The above code will result in 600 Mastery Pool XP being added to Woodcutting.

Unlock Pet

The petManager.unlockPetByID function is used to unlock Pets. Note that unlocking a pet is permanent - there is no supported method to lock a pet once again.

game.petManager.unlockPetByID(petID)

Attributes

Attribute Type Optional? Default Value Description
petID string No The ID of the pet, which can be found on the individual pet pages (such as
Error creating thumbnail: File missing
Ty
for example).

Examples

game.petManager.unlockPetByID("melvorD:CoolRock");

The above code will result in the unlocking of

Error creating thumbnail: File missing
Cool Rock

.

game.summoning.discoverMark

The discoverMark function is used to discover Summoning Marks. Once discovered, there is no supported method to allow a mark to become undiscovered again.

game.summoning.discoverMark(mark)

Attributes

Attribute Type Optional? Default Value Description
mark object No The mark to discover. Obtained with game.summoning.actions.allObjects[n] where n is the ID of the mark, starting at 0. Also obtainable with game.summoning.actions.getObjectByID(id) where id is the string ID of the action.

Examples

game.summoning.discoverMark(game.summoning.actions.allObjects[15]);

The above code discovers a single mark for the

Error creating thumbnail: File missing
Dragon

familiar.