In-game Functions: Difference between revisions

Add shop purchases; Adjust dungeons code to prevent entering an invalid dungeon; Some minor page cleanup/adjustments
(Use toclimit-ex class to limit TOC entries)
(Add shop purchases; Adjust dungeons code to prevent entering an invalid dungeon; Some minor page cleanup/adjustments)
Line 4: Line 4:
'''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.
'''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.


<div class="warningbox">You are playing around with the code of the game, as such 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.</div>
{{Disclaimer|You are playing around with the code of the game, as such 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.}}


<div class="toclimit-ex">__TOC__</div>
<div class="toclimit-ex">__TOC__</div>


==Using In-game Functions==
==Using In-game Functions==
Players can use the [https://mod.io/g/melvoridle/m/devconsole dev.Console mod] to execute these commands within the Steam, Epic, Android, and iOS versions of Melvor Idle.
Players can use the [https://mod.io/g/melvoridle/m/devconsole dev.Console mod] to execute these functions within the Steam, Epic, Android, and iOS versions of Melvor Idle.


On Web, Steam, and Epic, the console can be opened with F12. If using Steam or Epic, you must [[Mod_Creation/Enabling_DevTools_for_the_Steam_and_Epic_Clients|enable the dev console first]] before you are able to open it.
On Web, Steam, and Epic, the console can be opened with F12. If using Steam or Epic, you must [[Mod_Creation/Enabling_DevTools_for_the_Steam_and_Epic_Clients|enable the dev console first]] before you are able to open it.
Line 15: Line 15:
== Add Item to Bank ==
== Add Item to Bank ==
The <code>addItemByID</code> function can be used to add any item in the game to the bank.
The <code>addItemByID</code> function can be used to add any item in the game to the bank.
<syntaxhighlight lang="js">game.bank.addItemByID(itemID, quantity, logLost, found, ignoreSpace, notify)</syntaxhighlight>
<syntaxhighlight lang="js">game.bank.addItemByID(itemID, quantity, logLost, found, ignoreSpace, notify)</syntaxhighlight>


=== Attributes ===
=== Attributes ===
Line 26: Line 26:
For a complete list of items, see: [[Table of Items]]. Item IDs are on their respective wiki page.
For a complete list of items, see: [[Table of Items]]. Item IDs are on their respective wiki page.


Item IDs can also be searched through the console with the following command: <code>console.log(game.items.filter(x => x.name.toLowerCase().includes('SEARCHTERM'.toLowerCase())).map((a) => a.id + ' - ' + a.name).join('\n'))</code>. Replace <code>SEARCHTERM</code> with any part of the item's name.
To search for a specific item by name, the following can be used. Replace <code>REPLACEME</code> with the full or partial name of the item (case insensitive).
<syntaxhighlight lang="js">
let searchTerm = 'REPLACEME';
console.log(game.items.filter(x => x.name.toLowerCase().includes(searchTerm.toLowerCase())).map((a) => a.id + ' - ' + a.name).join('\n'))
</syntaxhighlight>
|-
|-
| quantity || int || No || || Quantity of item to add.
| quantity || int || No || || Quantity of item to add.
Line 41: Line 45:


=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">game.bank.addItemByID("melvorD:Oak_Logs", 10, true, true, false);</syntaxhighlight>
<syntaxhighlight lang="js">game.bank.addItemByID("melvorD:Oak_Logs", 10, true, true, false);</syntaxhighlight>
The above code will result in attempting to add 10 {{ItemIcon|Oak Logs}} to the Bank. If they do not fit, 10 will be added to the # of Oak Logs lost on the item's stats. Additionally, Oak Logs will be marked as discovered in the Completion Log.
The above code will result in attempting to add 10 {{ItemIcon|Oak Logs}} to the Bank. If they do not fit, 10 will be added to the # of Oak Logs lost on the item's stats. Additionally, Oak Logs will be marked as discovered in the Completion Log.
<syntaxhighlight lang="js">game.items.forEach((item) => game.bank.addItem(item, 1000000, false, true, true, false));</syntaxhighlight>
<syntaxhighlight lang="js">game.items.forEach((item) => game.bank.addItem(item, 1000000, false, true, true, false));</syntaxhighlight>
The above code will add 1,000,000 of every item in the game. The items will be forced into the bank even if you do not have room and there will be no notifications upon adding the items.
The above code will add 1,000,000 of every item in the game. The items will be forced into the bank even if you do not have room and there will be no notifications upon adding the items.


== Remove Item from Bank ==
== Remove Item from Bank ==
The <code>removeItemQuantityByID</code> function can be used to remove any item from the bank
The <code>removeItemQuantityByID</code> function can be used to remove any item from the bank
<syntaxhighlight lang="js">game.bank.removeItemQuantityByID(itemID, quantity, removeItemCharges)</syntaxhighlight>
<syntaxhighlight lang="js">game.bank.removeItemQuantityByID(itemID, quantity, removeItemCharges)</syntaxhighlight>


Note that if an item's quantity is in an invalid state, such as <syntaxhighlight lang="js" inline>NaN</syntaxhighlight> or <syntaxhighlight lang="js" inline>Infinity</syntaxhighlight>, then this function will not be able to remove that item from the bank. For any such items, use the below snippet instead:
Note that if an item's quantity is in an invalid state, such as <syntaxhighlight lang="js" inline>NaN</syntaxhighlight> or <syntaxhighlight lang="js" inline>Infinity</syntaxhighlight>, then this function will not be able to remove that item from the bank. For any such items, use the below snippet instead:
Line 85: Line 89:


=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">game.bank.removeItemQuantityByID('melvorD:Oak_Logs', 10);</syntaxhighlight>
<syntaxhighlight lang="js">game.bank.removeItemQuantityByID('melvorD:Oak_Logs', 10);</syntaxhighlight>
The above code will result in 10 {{ItemIcon|Oak Logs}} being removed from the bank.
The above code will result in 10 {{ItemIcon|Oak Logs}} being removed from the bank.


== Adjust Currencies (GP, AP, Slayer Coins, Abyssal Slayer Coins, and Raid Coins) ==
== Adjust Shop Purchases ==
All [[Currency|Currencies]] within the game, being {{GP}} [[GP]], {{AP}} [[Abyssal Pieces]] (AP), {{SC}} [[Slayer Coins]] (SC), {{ASC}} [[Abyssal Slayer Coins]] (ASC), and {{RC}} [[Raid Coins]] (RC) can be adjusted using the same set of functions:
The below script will add a shop purchase into <code>upgradesPurchased</code> which is where all purchases are stored. Alternatively, <code>game.shop.buyItemOnClick(purchase, true);</code> can be used however using this function will remove the costs of the purchase as well.
* To adjust GP, use <syntaxhighlight lang="js" inline>game.gp</syntaxhighlight>
* To adjust AP, use <syntaxhighlight lang="js" inline>game.abyssalPieces</syntaxhighlight>
* To adjust SC, use <syntaxhighlight lang="js" inline>game.slayerCoins</syntaxhighlight>
* To adjust ASC, use <syntaxhighlight lang="js" inline>game.abyssalSlayerCoins</syntaxhighlight>
* To adjust RC, use <syntaxhighlight lang="js" inline>game.raidCoins</syntaxhighlight>


=== Add Currency ===
=== Attributes ===
The game.<currency>.add function can be used to add to the player's current balance of that currency.
<syntaxhighlight lang="js">game.<currency>.add(amount)</syntaxhighlight>
 
==== Attributes ====
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| amount || int || No || || The amount to increase the specified currency's balance by
| purchaseID || string || No || The ID of the Purchase. A complete list of purchase IDs can be generated with: <syntaxhighlight lang="js" inline>console.log(game.shop.purchases.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>
|}


==== Examples ====
To search for a specific purchase by name, the following can be used. Replace <code>REPLACEME</code> with the full or partial name of the purchase (case insensitive).
<nowiki>game.gp.add(1);</nowiki>
<syntaxhighlight lang="js">
The above code will add 1 [[Currency#Gold Pieces|GP]] to the player.
let searchTerm = 'REPLACEME';
 
console.log(game.shop.purchases.filter(x => x.name.toLowerCase().includes(searchTerm.toLowerCase())).map((a) => a.id + ' - ' + a.name).join('\n'))
=== Remove Currency ===
</syntaxhighlight>
The game.<currency>.remove function can be used to subtract from the player's current balance of that currency. If the amount specified is greater than the amount the player currently has, then the currency's balance will become negative.
<syntaxhighlight lang="js">game.<currency>.remove(amount)</syntaxhighlight>
 
==== Attributes ====
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
| quantity || int || No || The number of purchases to buy
|-
| amount || int || No || || The quantity to decrease the specified currency's balance by
|}
|}


==== Examples ====
==== Examples ====
<syntaxhighlight lang="js">game.abyssalSlayerCoins.remove(2);</syntaxhighlight>
<syntaxhighlight lang="js">
The above code will remove 2 [[Abyssal Slayer Coins]] from the player.
let purchase = game.shop.purchases.getObjectByID('melvorD:Extra_Bank_Slot');
let quantity = 100;
if (purchase) {
game.shop.upgradesPurchased.set(purchase, (game.shop.upgradesPurchased.get(purchase) || 0) + quantity);
game.shop.computeProvidedStats();
shopMenu.tabs.get(purchase.category).menu.updateItemSelection();
game.shop.renderQueue.costs = true;
} else {
console.error(`Purchase ID is invalid`);
}
</syntaxhighlight>
The above will add 100 Bank Slot purchases then do the necessary render.


=== Set Currency ===
== Adjust Currencies ==
The game.<currency>.set function can be used to set the player's balance of that currency to the specified amount. This function may be of particular use to players who have inadvertently found their GP or SC balance is set to an invalid value such as <code>NaN</code>.
All [[Currency|Currencies]] within the game, being {{GP}} [[GP]], {{AP}} [[Abyssal Pieces]] (AP), {{SC}} [[Slayer Coins]] (SC), {{ASC}} [[Abyssal Slayer Coins]] (ASC), and {{RC}} [[Raid Coins]] (RC) can be adjusted using the same set of functions:
<syntaxhighlight lang="js">game.<currency>.set(amount)</syntaxhighlight>
* To adjust GP, use <syntaxhighlight lang="js" inline>game.gp</syntaxhighlight>
* To adjust AP, use <syntaxhighlight lang="js" inline>game.abyssalPieces</syntaxhighlight>
* To adjust SC, use <syntaxhighlight lang="js" inline>game.slayerCoins</syntaxhighlight>
* To adjust ASC, use <syntaxhighlight lang="js" inline>game.abyssalSlayerCoins</syntaxhighlight>
* To adjust RC, use <syntaxhighlight lang="js" inline>game.raidCoins</syntaxhighlight>
 
The following functions are used to add, remove, and set currencies. <code>set</code> may be of particular use to players who have inadvertently found their currency balance is set to an invalid value such as <code>NaN</code>.
<syntaxhighlight lang="js">
game.<currency>.add(amount);
game.<currency>.remove(amount);
game.<currency>.set(amount);
</syntaxhighlight>


==== Attributes ====
==== Attributes ====
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| amount || int || No || || The amount to set the specified currency's balance to
| amount || int || No || The amount to adjust the specified currency's balance by
|}
|}


==== Examples ====
==== Examples ====
<syntaxhighlight lang="js">game.raidCoins.set(999);</syntaxhighlight>
<syntaxhighlight lang="js">
The above code will set the player's [[Raid Coins|Raid Coin]] balance to 999, regardless of what the previous balance of raid coins owned was.
game.gp.add(1000);
game.abyssalSlayerCoins.remove(2500);
game.raidCoins.set(10000);
</syntaxhighlight>
The first function will add {{GP|1000}}, the second function will remove {{ASC|2500}} and lastly, the third function will set the balance of {{RC}} [[Raid Coins]] to 10,000.


== Add or Remove Prayer Points or Soul Points ==
== Adjust Prayer Points or Soul Points ==
The <code>addPrayerPoints</code> and <code>addSoulPoints</code> functions can be used to add prayer points or soul points to a player.
The <code>addPrayerPoints</code> and <code>addSoulPoints</code> functions can be used to add prayer points or soul points to a player.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.combat.player.addPrayerPoints(amount);
  game.combat.player.addPrayerPoints(amount);
  game.combat.player.addSoulPoints(amount);
  game.combat.player.addSoulPoints(amount);
Line 153: Line 166:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| amount || int || No || || The quantity of prayer or soul points to add. A negative value will remove points.
| amount || int || No || The quantity of prayer or soul points to add. A negative value will remove points.
|}
|}
=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.combat.player.addPrayerPoints(1);
  game.combat.player.addPrayerPoints(1);
  game.combat.player.addSoulPoints(-50);
  game.combat.player.addSoulPoints(-50);
Line 164: Line 177:
The first line will add 1 prayer point to the player while the second will remove 50 soul points.
The first line will add 1 prayer point to the player while the second will remove 50 soul points.


== Add, Remove or Set XP or Abyssal XP ==
== Adjust XP and Abyssal XP ==
The <code>addXP</code> and <code>addAbyssalXP</code> functions can be used to add or remove experience and abyssal experience from any skill. The <code>setXP</code> and <code>setAbyssalXP</code> can be used to set the new experience or abyssal experience value.
The <code>addXP</code> and <code>addAbyssalXP</code> functions can be used to add or remove experience and abyssal experience from any skill. The <code>setXP</code> and <code>setAbyssalXP</code> can be used to set the new experience or abyssal experience value.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.<skill>.addXP(xp);
game.<skill>.addXP(xp);
game.<skill>.addAbyssalXP(xp);
game.<skill>.addAbyssalXP(xp);
Line 176: Line 189:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| xp || int || No || || Amount of experience to add. A negative number will remove experience. When removing XP, it's best to use the Set commands as these will also visually update your current level if the removed experience results in a lower level.
| xp || int || No || Amount of experience to add. A negative number will remove experience. When removing XP, it's best to use the Set function as these will also visually update your current level if the removed experience results in a lower level.
|}
|}
=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.thieving.addXP(1000);
game.thieving.addXP(1000);
game.astrology.setAbyssalXP(game.astrology.abyssalXP - 700); // For XP, use game.astrology.xp with the addXP command
game.astrology.setAbyssalXP(game.astrology.abyssalXP - 700); // For XP, use game.astrology.xp with the addXP function
game.attack.setXP(exp.levelToXP(120) + 1); // For Abyssal XP, use abyssalExp.levelToXP with the setAbyssalXP command
game.attack.setXP(exp.levelToXP(120) + 1); // For Abyssal XP, use abyssalExp.levelToXP with the setAbyssalXP function
</syntaxhighlight>
</syntaxhighlight>
The first line will result in 1,000 experience being added to {{Skill|Thieving}}. The second line will remove 700 abyssal xp from Astrology. The third line will set Attack's level to 120.
The first line will result in 1,000 experience being added to {{Skill|Thieving}}. The second line will remove 700 abyssal xp from Astrology. The third line will set Attack's level to 120.


== Add or Remove Mastery XP ==
== Adjust Mastery XP ==
The <code>addMasteryXP</code> function can be used to add experience to any specific {{Icon|Mastery}} in a skill.
The <code>addMasteryXP</code> function can be used to add experience to any specific {{Icon|Mastery}} in a skill.
<syntaxhighlight lang="js">game.<skill>.addMasteryXP(masteryAction, xp)</syntaxhighlight>
<syntaxhighlight lang="js">game.<skill>.addMasteryXP(masteryAction, xp)</syntaxhighlight>
where <code><skill></code> is the lowercase name of the skill you are adding mastery experience to.
where <code><skill></code> is the lowercase name of the skill you are adding mastery experience to.
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| masteryAction || object || No || || The action to add Mastery XP to. Obtained with <syntaxhighlight lang="js" inline>game.skill.actions.getObjectByID(id)</syntaxhighlight> where <code>skill</code> is to be replaced with the name of the skill (all lowercase), and <code>id</code> is the ID of the action.
| masteryAction || object || No || The action to add Mastery XP to. Obtained with <syntaxhighlight lang="js" inline>game.<skill>.actions.getObjectByID(id);</syntaxhighlight>.
 
A list of actions IDs can be generated with <syntaxhighlight lang="js" inline>console.log(game.<skill>.actions.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'));</syntaxhighlight>


A list of action IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.skill.actions.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>.
In both of the provided functions, <code><skill></code> must be replaced with the name of the skill (all lowercase).
|-
|-
| xp || int || Yes || 0 || Amount of experience to add. A negative value will remove mastery xp.
| xp || int || Yes || Amount of experience to add. A negative value will remove mastery xp.
|}
|}


=== Examples ===
=== Examples ===
<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('melvorTotH:Starfruit'), -500);
  game.farming.addMasteryXP(game.farming.actions.getObjectByID('melvorTotH:Starfruit'), -500);
Line 211: Line 226:
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}}.
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>
The above code will result in 5,000 {{Icon|Mastery}} XP being added to every action within every skill with a mastery action.
The above code will result in 5,000 {{Icon|Mastery}} XP being added to every action within every skill with a mastery action.


== Add or Remove Mastery XP to Pool==
== Adjust Mastery Pool XP ==
The <code>addMasteryPoolXP</code> function can be used to add [[Mastery#The_Mastery_Pool|Mastery Pool]] experience to a skill
The <code>addMasteryPoolXP</code> function can be used to add [[Mastery#The_Mastery_Pool|Mastery Pool]] experience to a skill
<syntaxhighlight lang="js">game.<skill>.addMasteryPoolXP(realm, xp)</syntaxhighlight>
<syntaxhighlight lang="js">game.<skill>.addMasteryPoolXP(realm, xp)</syntaxhighlight>
where <code><skill></code> is the lowercase name of the skill you are adding mastery experience to.
where <code><skill></code> is the lowercase name of the skill you are adding mastery experience to.
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| realm || object || No || || The realm to add the Mastery Pool XP to. Obtained with <code>game.realms.getObjectByID(realmID)</code>.
| realm || object || No || The realm to add the Mastery Pool XP to. Obtained with <code>game.realms.getObjectByID(realmID)</code>.


A list of realm IDs can be obtained by entering the following into the console: <code>console.log(game.realms.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</code>.
A list of realm IDs can be obtained by entering the following into the console: <code>console.log(game.realms.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</code>.
|-
|-
| xp || int || Yes || 0 || Amount of experience to add. A negative value will remove mastery pool xp.
| xp || int || Yes || Amount of experience to add. A negative value will remove mastery pool xp.
|}
|}
=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.woodcutting.addMasteryPoolXP(game.realms.getObjectByID('melvorD:Melvor'), 600);
  game.woodcutting.addMasteryPoolXP(game.realms.getObjectByID('melvorD:Melvor'), 600);
  game.woodcutting.addMasteryPoolXP(game.realms.getObjectByID('melvorItA:Abyssal'), -400);
  game.woodcutting.addMasteryPoolXP(game.realms.getObjectByID('melvorItA:Abyssal'), -400);
Line 236: Line 251:
The first line will result in 600 [[Mastery#The_Mastery_Pool|Mastery Pool]] XP being added to {{Skill|Woodcutting}} in the Melvor Realm whereas the second line will remove 400 mastery pool xp from Woodcutting in the abyssal realm.
The first line will result in 600 [[Mastery#The_Mastery_Pool|Mastery Pool]] XP being added to {{Skill|Woodcutting}} in the Melvor Realm whereas the second line will remove 400 mastery pool xp from Woodcutting in the abyssal realm.


<syntaxhighlight lang="js">game.realms.forEach(realm => game.masterySkills.forEach(skill => skill.addMasteryPoolXP(realm, 1000)));</syntaxhighlight>
<syntaxhighlight lang="js">game.realms.forEach(realm => game.masterySkills.forEach(skill => skill.addMasteryPoolXP(realm, 1000)));</syntaxhighlight>
The above code will result in 1,000 [[Mastery#The_Mastery_Pool|Mastery Pool]] XP being added to all skills in every realm.
The above code will result in 1,000 [[Mastery#The_Mastery_Pool|Mastery Pool]] XP being added to all skills in every realm.


== Unlock Pet ==
== Unlock a Pet ==
The <code>unlockPetByID</code> function is used to unlock [[Pets]].
The <code>unlockPetByID</code> function is used to unlock [[Pets]].
<syntaxhighlight lang="js">game.petManager.unlockPetByID(petID)</syntaxhighlight>
<syntaxhighlight lang="js">game.petManager.unlockPetByID(petID)</syntaxhighlight>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| petID || string || No || || The ID of the pet, which can be found on the individual pet pages (such as {{PetIcon|Ty}} for example) or by using the following command: <code>console.log(game.pets.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</code>
| petID || string || No || The ID of the pet, which can be found on the individual pet pages (such as {{PetIcon|Ty}} for example) or by using the following function: <code>console.log(game.pets.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</code>
|}
|}
=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.petManager.unlockPetByID('melvorD:CoolRock');
  game.petManager.unlockPetByID('melvorD:CoolRock');
  game.petManager.unlocked.delete(game.pets.getObjectByID('melvorD:CoolRock'));game.petManager.computeProvidedStats();
  game.petManager.unlocked.delete(game.pets.getObjectByID('melvorD:CoolRock'));game.petManager.computeProvidedStats();
Line 258: Line 273:
The above code will unlock every single pet.
The above code will unlock every single pet.


== Discover Mark ==
== Discover Summoning Marks ==
The <code>discoverMark</code> function is used to discover [[Summoning#Summoning Marks|Summoning Marks]].
The <code>discoverMark</code> function is used to discover [[Summoning#Summoning Marks|Summoning Marks]].
<syntaxhighlight lang="js">game.summoning.discoverMark(mark)</syntaxhighlight>
<syntaxhighlight lang="js">game.summoning.discoverMark(mark)</syntaxhighlight>
=== Attributes ===
=== Attributes ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| mark || object || No || || The mark to discover. Obtained with <syntaxhighlight lang="js" inline>game.summoning.actions.getObjectByID(markID)</syntaxhighlight> where <code>markID</code> is the ID of the mark.
| mark || object || No || The mark to discover. Obtained with <syntaxhighlight lang="js" inline>game.summoning.actions.getObjectByID(markID)</syntaxhighlight> where <code>markID</code> is the ID of the mark.


A list of mark IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.summoning.actions.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>.
A list of mark IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.summoning.actions.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>.
Line 272: Line 287:


=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.summoning.discoverMark(game.summoning.actions.getObjectByID('melvorF:Dragon'));
  game.summoning.discoverMark(game.summoning.actions.getObjectByID('melvorF:Dragon'));
  game.summoning.marksUnlocked.delete(game.summoning.actions.getObjectByID('melvorF:Dragon'));
  game.summoning.marksUnlocked.delete(game.summoning.actions.getObjectByID('melvorF:Dragon'));
  </syntaxhighlight>
  </syntaxhighlight>
The first line discovers a single mark for the {{ItemIcon|Dragon}} familiar whereas the second line removes all marks from the Dragon.
The first line discovers a single mark for the {{ItemIcon|Dragon}} familiar whereas the second line removes all marks from the Dragon.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.summoning.actions.forEach((mark) => {
game.summoning.actions.forEach((mark) => {
game.summoning.marksUnlocked.set(mark, (mark.realm.id === 'melvorD:Melvor') ? 61 : 31);
game.summoning.marksUnlocked.set(mark, (mark.realm.id === 'melvorD:Melvor') ? 61 : 31);
Line 286: Line 301:
The above code will set every single mark to level 61 if it's in the Melvor Realm and 31 if it's in the Abyssal Realm then update the mark count and mark states.
The above code will set every single mark to level 61 if it's in the Melvor Realm and 31 if it's in the Abyssal Realm then update the mark count and mark states.


== Locate Ancient Relic ==
== Locate an Ancient Relic ==
The <code>locateAncientRelic</code> function is used to locate [[Ancient Relics#List_of_Ancient_Relics|Ancient Relics]].
The <code>locateAncientRelic</code> function is used to locate [[Ancient Relics#List_of_Ancient_Relics|Ancient Relics]].
<syntaxhighlight lang="js">game.<skill>.locateAncientRelic(relicSet, relic)</syntaxhighlight>
<syntaxhighlight lang="js">game.<skill>.locateAncientRelic(relicSet, relic)</syntaxhighlight>


where <code><skill></code> is the lowercase name of the skill you wish to add a relic to.
where <code><skill></code> is the lowercase name of the skill you wish to add a relic to.
Line 294: Line 309:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| relicSet || object || No || || The relicSet that the relic belongs to. Obtained with <syntaxhighlight lang="js" inline>game.<skill>.ancientRelicSets.get(realm)</syntaxhighlight>
| relicSet || object || No || The relicSet that the relic belongs to. Obtained with <syntaxhighlight lang="js" inline>game.<skill>.ancientRelicSets.get(realm)</syntaxhighlight>


A list of realms IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.realms.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>. To convert the realmID into a realm object, use <syntaxhighlight lang="js" inline>game.realms.getObjectByID('realmID')</syntaxhighlight>.
A list of realms IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.realms.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>. To convert the realmID into a realm object, use <syntaxhighlight lang="js" inline>game.realms.getObjectByID('realmID')</syntaxhighlight>.
|-
|-
| relic || object || No || || The relic that you wish to add.
| relic || object || No || The relic that you wish to add.


The relic can be obtained with <code>relicSet.relicDrops[#].relic;</code> where <code>#</code> is replaced with the relic number, starting from 0 for the first relic and ending with 4 for the 5th relic.
The relic can be obtained with <code>relicSet.relicDrops[#].relic;</code> where <code>#</code> is replaced with the relic number, starting from 0 for the first relic and ending with 4 for the 5th relic.
Line 306: Line 321:


=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
let realm = game.realms.getObjectByID('melvorD:Melvor');
let realm = game.realms.getObjectByID('melvorD:Melvor');
let relicSet = game.woodcutting.ancientRelicSets.get(realm);
let relicSet = game.woodcutting.ancientRelicSets.get(realm);
let relic = relicSet.relicDrops[0].relic;
let relic = relicSet.relicDrops[0].relic;
if (!relicSet.foundRelics.has(relic))
if (!relicSet.foundRelics.has(relic))
    game.woodcutting.locateAncientRelic(relicSet, relic);
game.woodcutting.locateAncientRelic(relicSet, relic);
</syntaxhighlight>
</syntaxhighlight>
The above code locates Woodcutting Relic 1 in the Melvor Realm.
The above code locates Woodcutting Relic 1 in the Melvor Realm.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.skills.forEach(skill => {
game.skills.forEach(skill => {
game.realms.forEach(realm => {
game.realms.forEach(realm => {
Line 326: Line 341:
});
});
</syntaxhighlight>
</syntaxhighlight>
The above will add all ancient relics to every skill, including modded skills, from all realms.
The above will add all the ancient relics to every skill, including modded skills, for all realms that have relics.


== Reset all Equipment Quick Equip Items ==
== Reset all Equipment Quick Equip Items ==
The below script will reset the Equipment Quick Equip items back to an empty item. These are the Quick Equip items that are found when clicking on an equipment slot, not the ones found in the skilling minibar (that are set through the bank).
The below script will reset the Equipment Quick Equip items back to an empty item. These are the Quick Equip items that are found when clicking on an equipment slot, not the ones found in the skilling minibar (that are set through the bank settings).
=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.combat.player.equipment.equippedArray.forEach(equipped => {
game.combat.player.equipment.equippedArray.forEach(equipped => {
equipped.quickEquipItems = [game.emptyEquipmentItem, game.emptyEquipmentItem, game.emptyEquipmentItem];
equipped.quickEquipItems = [game.emptyEquipmentItem, game.emptyEquipmentItem, game.emptyEquipmentItem];
Line 338: Line 353:
</syntaxhighlight>
</syntaxhighlight>
The above code will reset all the quick equip items for the '''current''' equipment set.
The above code will reset all the quick equip items for the '''current''' equipment set.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.combat.player.equipmentSets.forEach(({ equipment }) => {
game.combat.player.equipmentSets.forEach(({ equipment }) => {
equipment.equippedArray.forEach(equipped => {
equipment.equippedArray.forEach(equipped => {
Line 348: Line 363:
The above code will reset all the quick equip items for '''all''' equipment sets.
The above code will reset all the quick equip items for '''all''' equipment sets.


== Dungeon Completions ==
== Adjust Dungeon Completions ==
The <code>addDungeonCompletion</code> and <code>setDungeonCompleteCount</code> functions are used to modify a dungeon's completion count.
The <code>addDungeonCompletion</code> and <code>setDungeonCompleteCount</code> functions are used to modify a dungeon's completion count.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
game.combat.player.manager.addDungeonCompletion(dungeon);
game.combat.player.manager.addDungeonCompletion(dungeon);
game.combat.player.manager.setDungeonCompleteCount(dungeon, amount);
game.combat.player.manager.setDungeonCompleteCount(dungeon, amount);
Line 357: Line 372:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| dungeon || object || No || || The dungeon you wish to add a completion to. Obtained with <syntaxhighlight lang="js" inline>game.dungeons.getObjectByID(dungeonID);</syntaxhighlight> where <code>dungeonID</code> is the ID of the dungeon.
| dungeon || object || No || The dungeon you wish to add a completion to. Obtained with <syntaxhighlight lang="js" inline>game.dungeons.getObjectByID(dungeonID);</syntaxhighlight> where <code>dungeonID</code> is the ID of the dungeon.


A list of dungeon IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.dungeons.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>.
A list of dungeon IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.dungeons.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>.
Line 365: Line 380:
If an invalid dungeonID is entered, your game will be unable to be saved until the entry is either removed or the game is reloaded. You can remove the undefined entry with <code>game.combat.player.manager.dungeonCompletion.delete(undefined)</code> which should return <code>true</code> and the errors should stop appearing.
If an invalid dungeonID is entered, your game will be unable to be saved until the entry is either removed or the game is reloaded. You can remove the undefined entry with <code>game.combat.player.manager.dungeonCompletion.delete(undefined)</code> which should return <code>true</code> and the errors should stop appearing.
|-
|-
| amount || number || No || || The amount of dungeons clears you wish to add when using <code>setDungeonCompleteCount</code>. An amount is only required for setDungeonCompleteCount.
| amount || number || No || The amount of dungeons clears you wish to add when using <code>setDungeonCompleteCount</code>. An amount is only required for setDungeonCompleteCount.
|}
|}


=== Examples ===
=== Examples ===
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.combat.player.manager.addDungeonCompletion(game.dungeons.getObjectByID('melvorF:Into_the_Mist'));
  let dungeon = game.dungeons.getObjectByID('melvorF:Into_the_Mist');
  game.combat.player.manager.setDungeonCompleteCount(game.dungeons.getObjectByID('melvorItA:Into_The_Abyss'), 15);
  if (dungeon !== undefined)
game.combat.player.manager.addDungeonCompletion(dungeon);
else console.error('Dungeon is invalid');
 
let dungeon = game.dungeons.getObjectByID('melvorItA:Into_The_Abyss')
if (dungeon !== undefined)
game.combat.player.manager.setDungeonCompleteCount(dungeon, 15);
else console.error('Dungeon is invalid');
</syntaxhighlight>
</syntaxhighlight>
The first line will add a single completion to {{ZoneIcon|Into the Mist}} while the second line will set {{ZoneIcon|Into the Abyss}} completions to 15.
The first example will add a single completion to {{ZoneIcon|Into the Mist}} while the second example will set {{ZoneIcon|Into the Abyss}} completions to 15.


After modifying the dungeon completion count, run <code>game.queueRequirementRenders();</code> to apply UI updates without having to restart the game.
After modifying the dungeon completion count, run <code>game.queueRequirementRenders();</code> to apply UI updates without having to restart the game.
Line 390: Line 412:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Description
|-
|-
| value || int || No || || The value to increase the level cap by, or set the level cap to
| value || int || No || The value to increase the level cap by, or set the level cap to
|}
|}


==== Examples ====
==== Examples ====
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.slayer.increaseLevelCap(20);
  game.slayer.increaseLevelCap(20);
  game.thieving.setAbyssalLevelCap(45);
  game.thieving.setAbyssalLevelCap(45);
</syntaxhighlight>
</syntaxhighlight>
The first line will increase {{Skill|Slayer|Slayer's}} level cap by 20 levels whereas the second line will set {{AbyssalSkill|Thieving|Thieving's}} level cap to 45.
The first line will increase {{Skill|Slayer|Slayer's}} level cap by 20 levels whereas the second line will set {{AbyssalSkill|Thieving|Thieving's}} level cap to 45.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
  game.skills.forEach(skill => {
  game.skills.forEach(skill => {
skill.setLevelCap(skill.maxLevelCap);
skill.setLevelCap(skill.maxLevelCap);
Line 411: Line 433:
=== Awarding random level caps ===
=== Awarding random level caps ===
The below script will award random level cap increases without increasing combat level caps. The only value that must be changed is the <code>capType</code> at the beginning of the script. 0 is a pre-Bane level cap increase, 2 is a TotH level cap increase, and 4 is an ItA level cap increase.
The below script will award random level cap increases without increasing combat level caps. The only value that must be changed is the <code>capType</code> at the beginning of the script. 0 is a pre-Bane level cap increase, 2 is a TotH level cap increase, and 4 is an ItA level cap increase.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
let capType = 0; // 0 = pre-Bane, 2 = TotH, 4 = ItA
let capType = 0; // 0 = pre-Bane, 2 = TotH, 4 = ItA
let capIncrease = game.currentGamemode.levelCapIncreases[capType];
let capIncrease = game.currentGamemode.levelCapIncreases[capType];
Line 424: Line 446:
</syntaxhighlight>
</syntaxhighlight>
If you wish to also increase combat level caps then the following can be used.
If you wish to also increase combat level caps then the following can be used.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
let capType = 0; // 0 = pre-Bane, 2 = TotH, 4 = ItA
let capType = 0; // 0 = pre-Bane, 2 = TotH, 4 = ItA
let capIncrease = game.currentGamemode.levelCapIncreases[capType];
let capIncrease = game.currentGamemode.levelCapIncreases[capType];
game.increaseSkillLevelCaps(capIncrease, capIncrease.requirementSets.get(0));
game.increaseSkillLevelCaps(capIncrease, capIncrease.requirementSets.get(0));
</syntaxhighlight>
</syntaxhighlight>
{{Menu}}
{{Menu}}