In-game Functions

From Melvor Idle
(Redirected from Console)
This page is up to date (v1.0.5).

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.

addItemToBank

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

addItemToBank(itemID, quantity, found, showNotification, ignoreBankSpace)

Attributes

Attribute Type Optional? Default Value Description
itemID int 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

addItemToBank(1, 10, false);

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.

removeItemFromBank

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

removeItemFromBank(itemID, deactiveGloves)

Attributes

Attribute Type Optional? Default Value Description
itemID int No The ID of the item.
For a complete list of items and their IDs, see: Table of Items
deactiveGloves 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

removeItemFromBank(1);

The above code will result in item ID 1 (Oak Logs) being removed from the bank.

player.addGP

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

player.addGP(amount, source)

Attributes

Attribute Type Optional? Default Value Description
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

player.addGP(1,"");

The above code will add 1 gp to the player, and not place the info into the players stats for tracking.

player.addGP(1,"Combat");

The above code will add 1 gp to the player, and place the info into the players stats for tracking.

player.removeGP

The player.removeGP function can be used to remove GP from a player. If the amount specified is greater than the amount the player currently has, then no GP will be removed.

player.removeGP(amount)

Attributes

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

Examples

player.removeGP(1);

The above code will remove 1 GP from the player.

player.addSlayerCoins

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

player.addSlayerCoins(amount)

Attributes

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.

Examples

player.addSlayerCoins(1);

The above code will add 1 slayer coin to the player, and update player stats.

player.removeSlayerCoins

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.

player.removeSlayerCoins(amount, render)

Attributes

Attribute Type Optional? Default Value Description
amount int No The quantity of slayer coins to remove
render boolean Yes true If true, spawns a notification showing the quantity of coins removed and immediately updates the UI

Examples

player.removeSlayerCoins(1);

The above code will remove 1 slayer coin from the player, and immediately update the UI.

updateRaidCoins

The updateRaidCoins function can be used to add or remove raid coins from a player.

updateRaidCoins(amount)

Attributes

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.

Examples

updateRaidCoins(1);

The above will add 1 raid coin to the player.

player.addPrayerPoints

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

player.addPrayerPoints(amount)

Attributes

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

Examples

player.addPrayerPoints(1);

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

player.addXP

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.

player.addXP(skillID, xp)

Attributes

Attribute Type Optional? Default Value Description
skillID int No The ID of the skill, see: Skill ID
xp int No Amount of experience to add. Note that this is the amount of experience added before bonuses such as that from the Firemaking Skillcape (item).svg Firemaking Skillcape or Pyro (pet).png Pyro

Examples

player.addXP(10, 1000);

The above code will result in 1000 experience being added to the skill with ID 10 (Thieving).

addMasteryXP

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.

addMasteryXP(skillID, masteryID, timePerAction, spendingXP, xp, addToPool, offline)

Attributes

Attribute Type Optional? Default Value Description
skillID int No The ID of the skill, see: Skill ID
masteryID int No The skill specific Mastery ID. See 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 spendingXP is true
spendingXP boolean Yes false true: The amount of experience specified with xp is added, timePerAction is ignored
false: The amount of experience added is determined by the Mastery experience per action calculation, xp is ignored
xp int Yes 0 Amount of experience to add. Has no effect on the result if spendingXP is false
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

Below is a reference of how the various mastery ID values may be identified.

Skill Mastery ID
Woodcutting (skill).svg Woodcutting Index of the required tree within the Trees enum
Thieving (skill).svg Thieving Index of the required NPC within the ThievingNPCs enum
Agility (skill).svg Agility Index of the required obstacle within the AgilityObstacles enum
Astrology (skill).svg Astrology Index of the required constellation within the ASTROLOGY constant
Farming (skill).svg Farming items[itemID].masteryID[1] replacing itemID with the ID of the planted seed
Fishing (skill).svg Fishing items[itemID].masteryID[1], replacing itemID with the ID of the item produced by the action
Firemaking (skill).svg Firemaking
Cooking (skill).svg Cooking
Mining (skill).svg Mining
Smithing (skill).svg Smithing
Fletching (skill).svg Fletching
Crafting (skill).svg Crafting
Runecrafting (skill).svg Runecrafting
Herblore (skill).svg Herblore
Summoning (skill).svg Summoning

Examples

addMasteryXP(11, 13, 0, true, 300);

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

addMasteryXP(2, 3, 3000);

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.

addMasteryXPToPool

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

addMasteryXPToPool(skillID, xp, offline, token)

Attributes

Attribute Type Optional? Default Value Description
skillID int No The ID of the skill, see: Skill ID
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 xp value to be added to the pool, ignoring player's level within the skill.

Examples

addMasteryXPToPool(11, 600);

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

unlockPet

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.

unlockPet(petID, offline)

Attributes

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 Ty (pet).svg 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

unlockPet(4);

The above code will result in the unlocking of Cool Rock (pet).svg 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 A mark object, representing the mark to be discovered.
An array of all available marks can be accessed at Summoning.marks, and the IDs of each mark can be easily identified using the Summons enum.

Examples

game.summoning.discoverMark(Summoning.marks[Summons.Dragon]);

The above code discovers a single mark for the Dragon (item).svg Dragon familiar. Marks may be found for other familiars by changing Summons.Dragon as required.

Reference Tables

Skill ID

ID Skill
0 Woodcutting (skill).svg Woodcutting
1 Fishing (skill).svg Fishing
2 Firemaking (skill).svg Firemaking
3 Cooking (skill).svg Cooking
4 Mining (skill).svg Mining
5 Smithing (skill).svg Smithing
6 Attack (skill).svg Attack
7 Strength (skill).svg Strength
8 Defence (skill).svg Defence
9 Hitpoints (skill).svg Hitpoints
10 Thieving (skill).svg Thieving
11 Farming (skill).svg Farming
12 Ranged (skill).svg Ranged
13 Fletching (skill).svg Fletching
14 Crafting (skill).svg Crafting
15 Runecrafting (skill).svg Runecrafting
16 Magic (skill).svg Magic
17 Prayer (skill).svg Prayer
18 Slayer (skill).svg Slayer
19 Herblore (skill).svg Herblore
20 Agility (skill).svg Agility
21 Summoning (skill).svg Summoning
22 Astrology (skill).svg Astrology