In-game Functions: Difference between revisions

no edit summary
No edit summary
Line 1: Line 1:
{{V|1.1}}
{{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 25: Line 22:
| itemID || string || 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.
|-
|-
| logLost || boolean || Yes || false || If <code>true</code>, items that did not fit into the bank will be logged as lost
| logLost || boolean || Yes || false || If <code>true</code>, items that did not fit into the bank will be logged as lost
Line 36: Line 33:
=== Examples ===
=== Examples ===
  <nowiki>game.bank.addItemByID("melvorD:Oak_Logs", 10, true, true, false);</nowiki>
  <nowiki>game.bank.addItemByID("melvorD:Oak_Logs", 10, true, true, false);</nowiki>
The above code will result in attempting to add 10 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.


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


Line 56: Line 53:
=== Examples ===
=== Examples ===
  <nowiki>game.bank.removeItemQuantityByID("melvorD:Oak_Logs", 10);</nowiki>
  <nowiki>game.bank.removeItemQuantityByID("melvorD:Oak_Logs", 10);</nowiki>
The above code will result in 10 of item ID "melvorD:Oak_Logs" being removed from the bank.
The above code will result in 10 {{ItemIcon|Oak Logs}} being removed from the bank.


== Add GP ==
== Add GP ==
Line 70: Line 67:
=== Examples ===
=== Examples ===
  <nowiki>game.gp.add(1);</nowiki>
  <nowiki>game.gp.add(1);</nowiki>
The above code will add 1 gp to the player.
The above code will add 1 [[Currency#Gold Pieces|GP]] to the player.


== Remove GP ==
== Remove GP ==
Line 84: Line 81:
=== Examples ===
=== Examples ===
  <nowiki>game.gp.remove(1);</nowiki>
  <nowiki>game.gp.remove(1);</nowiki>
The above code will remove 1 GP from the player.
The above code will remove 1 [[Currency#Gold Pieces|GP]] from the player.


== Add Slayer Coins ==
== Add Slayer Coins ==
The slayerCoins.add function can be used to add slayer coins to a player.
The slayerCoins.add function can be used to add [[Currency#Slayer Coins|Slayer Coins]] to a player.
  <nowiki>game.slayerCoins.add(amount)</nowiki>
  <nowiki>game.slayerCoins.add(amount)</nowiki>
=== Attributes ===
=== Attributes ===
Line 98: Line 95:
=== Examples ===
=== Examples ===
  <nowiki>game.slayerCoins.add(1);</nowiki>
  <nowiki>game.slayerCoins.add(1);</nowiki>
The above code will add 1 slayer coin to the player.
The above code will add 1 [[Currency#Slayer Coins|Slayer Coin]] to the player.


== Remove Slayer Coins ==
== 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.
The slayerCoins.remove function can be used to remove [[Currency#Slayer Coins|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>game.slayerCoins.remove(amount)</nowiki>
  <nowiki>game.slayerCoins.remove(amount)</nowiki>
=== Attributes ===
=== Attributes ===
Line 112: Line 109:
=== Examples ===
=== Examples ===
  <nowiki>game.slayerCoins.remove(1);</nowiki>
  <nowiki>game.slayerCoins.remove(1);</nowiki>
The above code will remove 1 slayer coin from the player.
The above code will remove 1 [[Currency#Slayer Coins|Slayer Coin]] from the player.


== Add Raid Coins==
== Add Raid Coins==
The raidCoins.add function can be used to add [[Currency#Raid Coins|raid coins]] to a player.
The raidCoins.add function can be used to add [[Currency#Raid Coins|Raid Coins]] to a player.
  <nowiki>game.raidCoins.add(amount)</nowiki>
  <nowiki>game.raidCoins.add(amount)</nowiki>
=== Attributes ===
=== Attributes ===
Line 126: Line 123:
=== Examples ===
=== Examples ===
  <nowiki>game.raidCoins.add(1);</nowiki>
  <nowiki>game.raidCoins.add(1);</nowiki>
The above will add 1 raid coin to the player.
The above will add 1 [[Currency#Raid Coins|Raid Coin]] to the player.


== Remove Raid Coins==
== Remove Raid Coins==
The raidCoins.remove function can be used to remove [[Currency#Raid Coins|raid coins]] from a player.
The raidCoins.remove function can be used to remove [[Currency#Raid Coins|Raid Coins]] from a player.
  <nowiki>game.raidCoins.remove(amount)</nowiki>
  <nowiki>game.raidCoins.remove(amount)</nowiki>
=== Attributes ===
=== Attributes ===
Line 140: Line 137:
=== Examples ===
=== Examples ===
  <nowiki>game.raidCoins.remvoe(1);</nowiki>
  <nowiki>game.raidCoins.remvoe(1);</nowiki>
The above will remove 1 raid coin from the player.
The above will remove 1 [[Currency#Raid Coins|Raid Coin]] from the player.


== Add Prayer Points ==
== Add Prayer Points ==
Line 169: Line 166:
=== Examples ===
=== Examples ===
  <nowiki>game.thieving.addXP(1000);</nowiki>
  <nowiki>game.thieving.addXP(1000);</nowiki>
The above code will result in 1000 experience being added to Theiving.
The above code will result in 1000 experience being added to {{Skill|Thieving}}.


== Add Mastery XP ==
== Add Mastery XP ==
The addMasteryXP function can be used to add experience to any specific Mastery in a skill.
The addMasteryXP function can be used to add experience to any specific {{Icon|Mastery}} in a skill.
  <nowiki>game.skill.addMasteryXP(masteryAction, xp)</nowiki>
  <nowiki>game.skill.addMasteryXP(masteryAction, xp)</nowiki>
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.
Line 187: Line 184:
=== Examples ===
=== Examples ===
  <nowiki>game.farming.addMasteryXP(game.farming.actions.allObjects[13], 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 Farming for Mastery ID 13 (Carrot Seeds).
The above code will result in 300 {{Icon|Mastery}} XP being added to {{Skill|Farming}} for Mastery ID 13 (Carrot Seeds).


  <nowiki>game.firemaking.addMasteryXP(game.firemaking.actions.allObjects[3], 3000);</nowiki>
  <nowiki>game.firemaking.addMasteryXP(game.firemaking.actions.allObjects[3], 3000);</nowiki>
The above code will result in 3000 Mastery XP being added to Firemaking for Mastery ID 3 (Teak Logs).
The above code will result in 3000 {{Icon|Mastery}} XP being added to {{Skill|Firemaking}} for Mastery ID 3 (Teak Logs).


== Add Mastery XP to Pool==
== Add Mastery XP to Pool==
The addMasteryPoolXP function can be used to add mastery pool experience to a skill
The addMasteryPoolXP function can be used to add [[Mastery#The_Mastery_Pool|Mastery Pool]] experience to a skill
  <nowiki>game.skill.addMasteryPoolXP(xp)</nowiki>
  <nowiki>game.skill.addMasteryPoolXP(xp)</nowiki>
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.
Line 205: Line 202:
=== Examples ===
=== Examples ===
  <nowiki>game.woodcutting.addMasteryPoolXP(600);</nowiki>
  <nowiki>game.woodcutting.addMasteryPoolXP(600);</nowiki>
The above code will result in 600 Mastery Pool XP being added to Woodcutting.
The above code will result in 600 [[Mastery#The_Mastery_Pool|Mastery Pool]] XP being added to {{Skill|Woodcutting}}.


== Unlock Pet ==
== Unlock Pet ==
14

edits