GUI, Inventory & Menu: Difference between revisions

Line 44: Line 44:
If you're using the Interaction Editor, choose "'''Conditional - if inventory item is used'''" action under the "'''Use inventory item on hotspot'''" interaction.
If you're using the Interaction Editor, choose "'''Conditional - if inventory item is used'''" action under the "'''Use inventory item on hotspot'''" interaction.


Otherwise, if you're using scripting only, use the following code:
Otherwise, if you're using scripting only, use the following code (in AGS V2.62):


   if (player.activeinv == 31) {
   if (player.activeinv == 31) {
Line 51: Line 51:


This will detect whether the player's current inventory item selected is #31, and if so, the code between the braces is run. Take out the // comments if you want.
This will detect whether the player's current inventory item selected is #31, and if so, the code between the braces is run. Take out the // comments if you want.
In AGS V2.7 and higher, use the following code:
  if (player.ActiveInventory==iItem){
    // Place code here
  }
This will detect whether the player's current inventory item selected is iItem.
Rather than using the item numbers, AGS now uses '''Script-O-Names''': usually ''i'' followed by the item name (so, if the item is called ''Key'' the Script-o-Name will be ''iKey''), which are  shown on the 'Inventory Items' window of the editor).


==Customizing graphics of AGS default GUIs; Creating your own GUIs==
==Customizing graphics of AGS default GUIs; Creating your own GUIs==
Anonymous user