In-game Functions: Difference between revisions

From Melvor Idle
(Updated the functions to the new game object format.)
Line 16: Line 16:
== Add Item to Bank ==
== Add Item to Bank ==
The addItemByID 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>game.bank.addItemByID(itemID, quantity, found, showNotification, ignoreBankSpace)</nowiki>
  <nowiki>game.bank.addItemByID(itemID, quantity, logLost, found, ignoreSpace)</nowiki>


=== Attributes ===
=== Attributes ===
Line 27: Line 27:
| 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
|-
|-
| found || boolean || Yes || true || Determines if it will show in item completion log
| logLost || boolean || Yes || false || If <code>true</code>, items that did not fit into the bank will be logged as lost
|-
|-
| showNotification || boolean || Yes || true || Determines if it will show notification
| found || boolean || Yes || false || Determines if it will show in item completion log
|-
|-
| ignoreBankSpace || boolean || Yes || false || If <code>true</code>, the item will be added to the bank even if the bank is already full
| ignoreSpace || boolean || Yes || false || If <code>true</code>, the item will be added to the bank even if the bank is already full
|}
|}


=== Examples ===
=== Examples ===
  <nowiki>game.bank.addItemByID("melvorD:Oak_Logs", 10, false);</nowiki>
  <nowiki>game.bank.addItemByID("melvorD:Oak_Logs", 10, true, true, false);</nowiki>
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.
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.


== Remove Item from Bank ==
== Remove Item from Bank ==
The removeItemQuantity 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>game.bank.removeItemQuantity(itemID, quantity, removeItemCharges)</nowiki>
  <nowiki>game.bank.removeItemQuantityByID(itemID, quantity, removeItemCharges)</nowiki>


=== Attributes ===
=== Attributes ===
Line 47: Line 47:
! Attribute !! Type !! Optional? !! Default Value !! Description
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
|-
| 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]]*Not currently updated
|-
|-
| quantity || int || No || || The number of items to remove.
| quantity || int || No || || The number of items to remove.
Line 55: Line 55:


=== Examples ===
=== Examples ===
  <nowiki>game.bank.removeItemQuantity("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 of item ID "melvorD:Oak_Logs" being removed from the bank.


Line 221: Line 221:
The above code will result in the unlocking of {{PetIcon|Cool Rock}}.
The above code will result in the unlocking of {{PetIcon|Cool Rock}}.


== game.summoning.discoverMark ==
== Discover Mark ==
The discoverMark function is used to discover [[Summoning#Summoning Marks|Summoning Marks]]. Once discovered, there is no supported method to allow a mark to become undiscovered again.
The discoverMark function is used to discover [[Summoning#Summoning Marks|Summoning Marks]]. Once discovered, there is no supported method to allow a mark to become undiscovered again.
  <nowiki>game.summoning.discoverMark(mark)</nowiki>
  <nowiki>game.summoning.discoverMark(mark)</nowiki>