Essentials Docs Wiki

The Essentials wiki has moved and is now at: Essentials Engine wiki

This wiki will no longer be updated.

READ MORE

Essentials Docs Wiki
(Created page with "This article describes how to '''manipulate items''' in the game, including how to give/take items, count how many of an item a player has, check what kind of item an item i...")
 
Maruno (talk | contribs)
No edit summary
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
This article describes how to '''manipulate items''' in the game, including how to give/take items, count how many of an item a player has, check what kind of item an item is, and so forth.
+
This page describes how to '''manipulate items''' in the game, including how to give/take items, count how many of an item a player has, check what kind of item an item is, and so forth.
  +
==Contents==
 
 
== Giving the player an item ==
[[https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Manipulating_items# show]]==Giving the player an item==
 
  +
There are 3 ways to give the player an item:
 
  +
There are three ways to give the player an item:
{| border="1" cellpadding="2"
 
  +
!Script
 
  +
{| class="wikitable"
!What it does
 
 
! Script
 
! What it does
 
|-
 
|-
|Kernel.pbReceiveItem(:POTION)
+
| <code>Kernel.pbReceiveItem(:POTION)</code>
|This script gives the player an item. As elsewhere, "POTION" is the internal name of the item. Note the colon just before it.
+
| This script gives the player an item. As elsewhere, "POTION" is the internal name of the item to be given. Note the colon just before it.
  +
Two messages are shown: one states that the item has been ''received'' (and if it's a TM/HM, the move it teaches is also stated), and the second message states the player has put it in the appropriate pocket of their [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag]. If the item is Leftovers, the first message will say that "some Leftovers" have been received.
+
Two messages are shown: one states that the item has been ''received'' (and if it's a TM/HM, the move it teaches is also stated), and the second message states that the player has put it in the appropriate pocket of their [[Bag]]. If the item is Leftovers, the first message will refer to it as "some Leftovers" rather than "a Potion"/"an Oran Berry".
   
 
This script should be used when ''receiving'' an item from an NPC, because it displays the message that the player has "obtained" it (i.e. from another person, rather than finding it).
 
This script should be used when ''receiving'' an item from an NPC, because it displays the message that the player has "obtained" it (i.e. from another person, rather than finding it).
 
|-
 
|-
|Kernel.pbItemBall(:POTION)
+
| <code>Kernel.pbItemBall(:POTION)</code>
|This script works the same as the above, except that the first message shown states that the player has ''found'' the item (rather than obtained it). Also, if the item cannot be added to the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag], the second message instead says the Bag is full, and the item is not picked up.
+
| This script works the same as the above, except that the first message shown states that the player has "found" the item (rather than "obtained" it). Also, if the item cannot be added to the [[Bag]], the second message instead says the Bag is full, and the item is not picked up.
  +
It is used in [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Item_balls item balls]. When making an [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Item_balls item ball], this script is set up in that item ball event automatically when the game is compiled, so you will typically not need to use it yourself.
+
It is used in [[item balls]]. When making an [[Item balls|item ball]], this script is set up in that item ball event automatically when the game is compiled, so you will typically not need to use it yourself.
 
|-
 
|-
|$PokemonBag.pbStoreItem(:POTION,quantity)
+
| <code>$PokemonBag.pbStoreItem(:POTION,5)</code>
|This particular script is used by the above two methods. It does the actual adding of the item to the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag], and does not display any messages.
+
| This particular script is used by the above two methods. It does the actual adding of the item to the [[Bag]], and does not display any messages. The first parameter is the item to add, and the second is the quantity (default: 1).
If the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag] becomes full in the middle of adding several items, then as many as possible of the item will be added (the rest are ignored), but it will be treated as if no items had been picked up (i.e. it will still return FALSE) because it didn't add as many items as it wanted to.
 
   
 
If the [[Bag]] becomes full in the middle of adding several items, then as many as possible of the item will be added (the rest are ignored), but it will be treated as if no items had been picked up (i.e. the method will still return FALSE) because it didn't add as many items as it wanted to.
You should check beforehand whether the player has enough space to store all the items to be added. This won't normally be a problem, though, as by default all [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag pockets] are infinite in size.
 
  +
 
You should check beforehand whether the player has enough space to store all the items to be added. This won't normally be a problem, though, as by default all [[Bag|Bag pockets]] are infinite in size.
   
 
You will not normally ever use this script.
 
You will not normally ever use this script.
 
|}
 
|}
All three scripts above will return TRUE if the item has been added to the player's [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag], and FALSE if it hasn't.
 
   
 
All three scripts above will return TRUE if the item has been added to the player's [[Bag]], and FALSE if it hasn't.
As a slot in the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag] can only hold a maximum of 99 of an item (by default), if you attempt to give the player more than this amount, the excess will start filling up a new slot. For example, if the player has 97 Potions and the game gives them 5 more, 2 of the extra Potions will go into the existing slot and the other 3 will go into a new slot.
 
  +
===Giving multiple items===
 
 
As a slot in the [[Bag]] can only hold a maximum of 999 of an item (by default; this value is defined as <code>BAGMAXPERSLOT</code> in the [[script section]] '''Settings'''), if you attempt to give the player more than this amount, the excess will start filling up a new slot. For example, if the player has 997 Potions and the game gives them 5 more, 2 of the extra Potions will go into the existing slot and the other 3 will go into a new slot.
  +
 
=== Giving multiple items ===
  +
 
The first two scripts in the table above can also give more than 1 of an item. Here are examples of this:
 
The first two scripts in the table above can also give more than 1 of an item. Here are examples of this:
  +
 
Kernel.pbReceiveItem(:POKEBALL,5)
 
Kernel.pbReceiveItem(:POKEBALL,5)
 
Kernel.pbReceiveItem(:ORANBERRY,3)
 
Kernel.pbReceiveItem(:ORANBERRY,3)
 
Kernel.pbItemBall(:POTION,4)
 
Kernel.pbItemBall(:POTION,4)
 
Kernel.pbItemBall(:WISEGLASSES,2)
 
Kernel.pbItemBall(:WISEGLASSES,2)
  +
The two parameters are the item itself and the quantity (default 1 if not stated). The name of the item as stated in the message will be the plural form of the item's name (if the quantity is greater than 1) as defined in the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/PBS_file PBS file]"items.txt".
+
The two parameters are the item itself and the quantity (default is 1 if not stated). The name of the item as stated in the message will be the plural form of the item's name (if the quantity is greater than 1) as defined in the [[PBS file]] "items.txt".
==Deleting an item from the Bag==
 
  +
 
== Deleting an item from the Bag ==
  +
 
To delete an item that the player has, use the following script:
 
To delete an item that the player has, use the following script:
  +
 
$PokemonBag.pbDeleteItem(:POTION)
 
$PokemonBag.pbDeleteItem(:POTION)
  +
To delete several of the same item, add the quantity as a second parameter, like so:
+
To delete several of the same item, add the quantity as a second parameter like so:
  +
 
$PokemonBag.pbDeleteItem(:POTION,5)
 
$PokemonBag.pbDeleteItem(:POTION,5)
  +
 
This script returns TRUE if the item has been removed, and FALSE if it hasn't. It does not display any messages to indicate whether the item has been removed.
 
This script returns TRUE if the item has been removed, and FALSE if it hasn't. It does not display any messages to indicate whether the item has been removed.
   
Note that if you try to delete more of an item than there are in the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag], then as many as possible of that item will be deleted (i.e. all of them), but then this script will still return FALSE (because it didn't manage to delete as many as it should have).
+
Note that if you try to delete more of an item than there are in the [[Bag]], then as many as possible of that item will be deleted (i.e. all of them), but then this script will still return FALSE (because it didn't manage to delete as many as it should have).
   
 
Before deleting an item, you should check that the player has at least as many of that item as you want to delete, so that the script can execute fully.
 
Before deleting an item, you should check that the player has at least as many of that item as you want to delete, so that the script can execute fully.
  +
==Counting items in the Bag==
+
== Counting items in the Bag ==
  +
 
To determine how many of a particular item the player currently has, use the following script:
 
To determine how many of a particular item the player currently has, use the following script:
  +
 
$PokemonBag.pbQuantity(:POTION)
 
$PokemonBag.pbQuantity(:POTION)
  +
This script returns a value, and does nothing else on its own. It should either be stored as a variable, or be used as part of a check comparing this value to another value, e.g.
+
This script returns a value, and does nothing else on its own. It should either be stored as a variable or be used as part of a check comparing this value to another value, e.g.
itemquant = $PokemonBag.pbQuantity(:POTION)
 
  +
 
itemQty = $PokemonBag.pbQuantity(:POTION)
 
$game_variables[42] = $PokemonBag.pbQuantity(:POTION)
 
$game_variables[42] = $PokemonBag.pbQuantity(:POTION)
 
$PokemonBag.pbQuantity(:POTION)==5
 
$PokemonBag.pbQuantity(:POTION)==5
 
$PokemonBag.pbQuantity(:POTION)>0
 
$PokemonBag.pbQuantity(:POTION)>0
  +
If you want to check if the player has at least 1 of an item (typically used for checking for the possession of Key Items such as Key Cards), you can instead use this:
+
If you want to check if the player has at least 1 of an item, you can instead use this:
  +
 
$PokemonBag.pbHasItem?(:POTION)
 
$PokemonBag.pbHasItem?(:POTION)
  +
This is how items like Key Cards work. They have no effects themselves, but doors open when interacted with so long as the player has the item in their Bag. This is done by using this line of code in a Conditional Branch.
+
This is how items like Key Cards work. They have no effects themselves, but doors open when interacted with so long as the player has the item in their [[Bag]]. This is done by using this line of code in a Conditional Branch and making the door open within that Conditional Branch (i.e. if they have at least 1 of the item).
==Choosing an item from the Bag==
 
  +
 
== Choosing an item from the Bag ==
  +
 
To make the player choose an item from the Bag, use either version of the following script:
 
To make the player choose an item from the Bag, use either version of the following script:
  +
 
Kernel.pbChooseItem
 
Kernel.pbChooseItem
 
Kernel.pbChooseItem(1)
 
Kernel.pbChooseItem(1)
  +
This method returns the ID of the chosen item (or 0 if no item was chosen). The argument is optional, and is the number of the Global Variable in which the returned value is stored (in addition to returning the value).
+
This method returns the ID of the chosen item (or 0 if no item was chosen). The argument is optional, and is the number of the [[Events|Game Variable]] in which the item's ID number is stored (in addition to the method itself returning that value).
   
 
To make the player choose from a specific list of items, use the following script:
 
To make the player choose from a specific list of items, use the following script:
  +
 
pbChooseItemFromList(_I("Choose an item"),1,:POTION,:REPEL,:POKEBALL)
 
pbChooseItemFromList(_I("Choose an item"),1,:POTION,:REPEL,:POKEBALL)
  +
This method returns the ID of the chosen item, or -1 if the choice was cancelled. The second argument (the number 1 here) is the Global Variable in which the returned value is stored (in addition to returning the value).
+
This method returns the ID of the chosen item (or -1 if the choice was cancelled). The second argument (the number 1 here) is the [[Events|Game Variable]] in which the returned value is stored (in addition to the method itself returning that value).
   
 
Any number of items can be listed. Only items which the player has at least 1 of will appear in the list. If the player has none of the listed items, then the method will immediately return/store 0 without displaying the message or listing anything.
 
Any number of items can be listed. Only items which the player has at least 1 of will appear in the list. If the player has none of the listed items, then the method will immediately return/store 0 without displaying the message or listing anything.
  +
==Other checks==
+
== Other checks ==
Below is a list of other ways an item can be checked or manipulated.
 
  +
{| border="1" cellpadding="2"
 
 
Below is a list of other ways in which an item can be checked for or manipulated.
!Script
 
  +
!Description
 
  +
{| class="wikitable"
 
! Script
 
! Description
 
|-
 
|-
 
| <code>$PokemonBag.pbCanStore?(:POTION,5)</code>
|PBItems.getName(PBItems::POTION)
 
|Returns the name of the item.
+
| Returns TRUE if there is space in the [[Bag]] for the given amount of the given item; returns FALSE if there isn't.
 
|-
 
|-
|pbGetPrice(PBItems::POTION)
+
| <code>PBItems.getName(PBItems::POTION)</code>
  +
| Returns the name of the item.
|Returns the value of the item, i.e. the price the player would pay when buying it. The selling price of an item is half its buying price.
 
 
|-
 
|-
|pbIsImportantItem?(PBItems::POTION)
+
| <code>pbGetPrice(PBItems::POTION)</code>
|Returns TRUE if the item is a Key Item or a HM (i.e. something that cannot be tossed/sold); returns FALSE otherwise.
+
| Returns the money value of the item, i.e. the price the player would pay when buying it. The selling price of an item is half its buying price.
 
|-
 
|-
|pbIsKeyItem?(PBItems::POTION)
+
| <code>pbGetPocket(PBItems::POTION)</code>
  +
| Returns the [[Bag|Bag pocket number]] that the item is stored in.
|Returns TRUE if the item is a Key Item (i.e. is stored in [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag pocket] 8); returns FALSE otherwise.
 
 
|-
 
|-
|pbIsMachine?(PBItems::POTION)
+
| <code>pbIsKeyItem?(PBItems::POTION)</code>
|Returns TRUE if the item is a TM or a HM; returns FALSE otherwise.
+
| Returns TRUE if the item is a Key Item (i.e. its [[Defining an item|"special items" number]] is 6); returns FALSE otherwise.
 
|-
 
|-
|pbIsTechnicalMachine?(PBItems::POTION)
+
| <code>pbIsImportantItem?(PBItems::POTION)</code>
|Returns TRUE if the item is a TM; returns FALSE otherwise.
+
| Returns TRUE if the item is a Key Item or a HM (i.e. something that cannot be tossed/sold); returns FALSE otherwise. Also returns TRUE if the item is a TM and TMs are set to infinite use, because in that case they cannot be tossed/sold either.
 
|-
 
|-
|pbIsHiddenMachine?(PBItems::POTION)
+
| <code>pbIsTechnicalMachine?(PBItems::POTION)</code>
|Returns TRUE if the item is a HM; returns FALSE otherwise.
+
| Returns TRUE if the item is a TM; returns FALSE otherwise.
 
|-
 
|-
  +
| <code>pbIsHiddenMachine?(PBItems::POTION)</code>
|pbIsHiddenMove?(PBMoves::CUT)
 
|Returns TRUE if the move can be taught by any HM; returns FALSE otherwise.
+
| Returns TRUE if the item is a HM; returns FALSE otherwise.
 
|-
 
|-
|pbGetPocket(PBItems::POTION)
+
| <code>pbIsMachine?(PBItems::POTION)</code>
  +
| Returns TRUE if the item is a TM or a HM; returns FALSE otherwise.
|Returns the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag pocket] number this item is stored in.
 
 
|-
 
|-
 
| <code>pbIsHiddenMove?(PBMoves::CUT)</code>
|pbIsMail?(PBItems::POTION)
 
|Returns TRUE if the item is a Mail item; returns FALSE otherwise.
+
| Returns TRUE if the move can be taught by any HM; returns FALSE otherwise.
 
|-
 
|-
|pbIsPokeBall?(PBItems::POTION)
+
| <code>pbIsBerry?(PBItems::POTION)</code>
|Returns TRUE if the item is a Poké Ball or a Snag Ball; returns FALSE otherwise.
+
| Returns TRUE if the item is a berry; returns FALSE otherwise.
 
|-
 
|-
|pbIsSnagBall?(PBItems::POTION)
+
| <code>pbIsPokeBall?(PBItems::POTION)</code>
|Returns TRUE if the item is a Snag Ball, or if it is a Poké Ball while $PokemonGlobal.snagMachine=true; returns FALSE otherwise.
+
| Returns TRUE if the item is a Poké Ball or a Snag Ball; returns FALSE otherwise.
 
|-
 
|-
|pbIsBerry?(PBItems::POTION)
+
| <code>pbIsSnagBall?(PBItems::POTION)</code>
|Returns TRUE if the item is a berry; returns FALSE otherwise.
+
| Returns TRUE if the item is a Snag Ball, or if it is a Poké Ball while <code>$PokemonGlobal.snagMachine=true</code>; returns FALSE otherwise.
 
|-
 
|-
 
| <code>pbIsMail?(PBItems::POTION)</code>
|pbClosestHiddenItem
 
  +
| Returns TRUE if the item is a Mail item; returns FALSE otherwise.
|Returns the location of the nearest [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Item_balls hidden item]; returns nil if there is none in range (i.e. within a square of 17 tiles on each side, where the player is at the centre of the square). Used by the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Itemfinder Itemfinder].
 
 
|-
 
|-
 
| <code>pbClosestHiddenItem</code>
|$PokemonBag.pbCanStore?(:POTION,5)
 
  +
| Returns the location of the nearest [[Item balls|hidden item]]; returns <code>nil</code> if there is none in range. Used by the [[Itemfinder]].
|Returns TRUE if there is space in the [https://web.archive.org/web/20180320170642/http://pokemonessentials.wikia.com:80/wiki/Bag Bag] for the given number of the given item; returns FALSE if there isn't.
 
 
|}
 
|}
  +
==Activating Item Effects==
+
== Activating item effects ==
  +
 
There are a few ways to activate the effects of a given item.
 
There are a few ways to activate the effects of a given item.
  +
{| border="1" cellpadding="2"
 
  +
{| class="wikitable"
!Script
+
! Script
!Description
+
! Description
 
|-
 
|-
|ItemHandlers.triggerUseInField(:REPEL)
+
| <code>ItemHandlers.triggerUseInField(:REPEL)</code>
|Triggers the activation of a given item type without consuming it.
+
| Triggers the activation of a given item type without consuming it.
 
|-
 
|-
|Kernel.pbUseKeyItemInField(:REPEL)
+
| <code>Kernel.pbUseKeyItemInField(:REPEL)</code>
|Triggers the activation of a given item type and consumes it.
+
| Triggers the activation of a given item type and consumes it.
 
|}
 
|}
 
 

Revision as of 19:49, 21 August 2019

This page describes how to manipulate items in the game, including how to give/take items, count how many of an item a player has, check what kind of item an item is, and so forth.

Giving the player an item

There are three ways to give the player an item:

Script What it does
Kernel.pbReceiveItem(:POTION) This script gives the player an item. As elsewhere, "POTION" is the internal name of the item to be given. Note the colon just before it.

Two messages are shown: one states that the item has been received (and if it's a TM/HM, the move it teaches is also stated), and the second message states that the player has put it in the appropriate pocket of their Bag. If the item is Leftovers, the first message will refer to it as "some Leftovers" rather than "a Potion"/"an Oran Berry".

This script should be used when receiving an item from an NPC, because it displays the message that the player has "obtained" it (i.e. from another person, rather than finding it).

Kernel.pbItemBall(:POTION) This script works the same as the above, except that the first message shown states that the player has "found" the item (rather than "obtained" it). Also, if the item cannot be added to the Bag, the second message instead says the Bag is full, and the item is not picked up.

It is used in item balls. When making an item ball, this script is set up in that item ball event automatically when the game is compiled, so you will typically not need to use it yourself.

$PokemonBag.pbStoreItem(:POTION,5) This particular script is used by the above two methods. It does the actual adding of the item to the Bag, and does not display any messages. The first parameter is the item to add, and the second is the quantity (default: 1).

If the Bag becomes full in the middle of adding several items, then as many as possible of the item will be added (the rest are ignored), but it will be treated as if no items had been picked up (i.e. the method will still return FALSE) because it didn't add as many items as it wanted to.

You should check beforehand whether the player has enough space to store all the items to be added. This won't normally be a problem, though, as by default all Bag pockets are infinite in size.

You will not normally ever use this script.

All three scripts above will return TRUE if the item has been added to the player's Bag, and FALSE if it hasn't.

As a slot in the Bag can only hold a maximum of 999 of an item (by default; this value is defined as BAGMAXPERSLOT in the script section Settings), if you attempt to give the player more than this amount, the excess will start filling up a new slot. For example, if the player has 997 Potions and the game gives them 5 more, 2 of the extra Potions will go into the existing slot and the other 3 will go into a new slot.

Giving multiple items

The first two scripts in the table above can also give more than 1 of an item. Here are examples of this:

Kernel.pbReceiveItem(:POKEBALL,5)
Kernel.pbReceiveItem(:ORANBERRY,3)
Kernel.pbItemBall(:POTION,4)
Kernel.pbItemBall(:WISEGLASSES,2)

The two parameters are the item itself and the quantity (default is 1 if not stated). The name of the item as stated in the message will be the plural form of the item's name (if the quantity is greater than 1) as defined in the PBS file "items.txt".

Deleting an item from the Bag

To delete an item that the player has, use the following script:

$PokemonBag.pbDeleteItem(:POTION)

To delete several of the same item, add the quantity as a second parameter like so:

$PokemonBag.pbDeleteItem(:POTION,5)

This script returns TRUE if the item has been removed, and FALSE if it hasn't. It does not display any messages to indicate whether the item has been removed.

Note that if you try to delete more of an item than there are in the Bag, then as many as possible of that item will be deleted (i.e. all of them), but then this script will still return FALSE (because it didn't manage to delete as many as it should have).

Before deleting an item, you should check that the player has at least as many of that item as you want to delete, so that the script can execute fully.

Counting items in the Bag

To determine how many of a particular item the player currently has, use the following script:

$PokemonBag.pbQuantity(:POTION)

This script returns a value, and does nothing else on its own. It should either be stored as a variable or be used as part of a check comparing this value to another value, e.g.

itemQty = $PokemonBag.pbQuantity(:POTION)
$game_variables[42] = $PokemonBag.pbQuantity(:POTION)
$PokemonBag.pbQuantity(:POTION)==5
$PokemonBag.pbQuantity(:POTION)>0

If you want to check if the player has at least 1 of an item, you can instead use this:

$PokemonBag.pbHasItem?(:POTION)

This is how items like Key Cards work. They have no effects themselves, but doors open when interacted with so long as the player has the item in their Bag. This is done by using this line of code in a Conditional Branch and making the door open within that Conditional Branch (i.e. if they have at least 1 of the item).

Choosing an item from the Bag

To make the player choose an item from the Bag, use either version of the following script:

Kernel.pbChooseItem
Kernel.pbChooseItem(1)

This method returns the ID of the chosen item (or 0 if no item was chosen). The argument is optional, and is the number of the Game Variable in which the item's ID number is stored (in addition to the method itself returning that value).

To make the player choose from a specific list of items, use the following script:

pbChooseItemFromList(_I("Choose an item"),1,:POTION,:REPEL,:POKEBALL)

This method returns the ID of the chosen item (or -1 if the choice was cancelled). The second argument (the number 1 here) is the Game Variable in which the returned value is stored (in addition to the method itself returning that value).

Any number of items can be listed. Only items which the player has at least 1 of will appear in the list. If the player has none of the listed items, then the method will immediately return/store 0 without displaying the message or listing anything.

Other checks

Below is a list of other ways in which an item can be checked for or manipulated.

Script Description
$PokemonBag.pbCanStore?(:POTION,5) Returns TRUE if there is space in the Bag for the given amount of the given item; returns FALSE if there isn't.
PBItems.getName(PBItems::POTION) Returns the name of the item.
pbGetPrice(PBItems::POTION) Returns the money value of the item, i.e. the price the player would pay when buying it. The selling price of an item is half its buying price.
pbGetPocket(PBItems::POTION) Returns the Bag pocket number that the item is stored in.
pbIsKeyItem?(PBItems::POTION) Returns TRUE if the item is a Key Item (i.e. its "special items" number is 6); returns FALSE otherwise.
pbIsImportantItem?(PBItems::POTION) Returns TRUE if the item is a Key Item or a HM (i.e. something that cannot be tossed/sold); returns FALSE otherwise. Also returns TRUE if the item is a TM and TMs are set to infinite use, because in that case they cannot be tossed/sold either.
pbIsTechnicalMachine?(PBItems::POTION) Returns TRUE if the item is a TM; returns FALSE otherwise.
pbIsHiddenMachine?(PBItems::POTION) Returns TRUE if the item is a HM; returns FALSE otherwise.
pbIsMachine?(PBItems::POTION) Returns TRUE if the item is a TM or a HM; returns FALSE otherwise.
pbIsHiddenMove?(PBMoves::CUT) Returns TRUE if the move can be taught by any HM; returns FALSE otherwise.
pbIsBerry?(PBItems::POTION) Returns TRUE if the item is a berry; returns FALSE otherwise.
pbIsPokeBall?(PBItems::POTION) Returns TRUE if the item is a Poké Ball or a Snag Ball; returns FALSE otherwise.
pbIsSnagBall?(PBItems::POTION) Returns TRUE if the item is a Snag Ball, or if it is a Poké Ball while $PokemonGlobal.snagMachine=true; returns FALSE otherwise.
pbIsMail?(PBItems::POTION) Returns TRUE if the item is a Mail item; returns FALSE otherwise.
pbClosestHiddenItem Returns the location of the nearest hidden item; returns nil if there is none in range. Used by the Itemfinder.

Activating item effects

There are a few ways to activate the effects of a given item.

Script Description
ItemHandlers.triggerUseInField(:REPEL) Triggers the activation of a given item type without consuming it.
Kernel.pbUseKeyItemInField(:REPEL) Triggers the activation of a given item type and consumes it.