Selecting active inventory item from Inventory GUI

Started by frenzykitty, Wed 10/04/2013 16:21:02

Previous topic - Next topic

frenzykitty

Hi Everyone. I've been working on figuring out this coding story. I've managed to create a very rudimentary custom Inventory, and create a scene where the character can pick up a flash drive.

Once the character picks up the flash drive, I've got it to disappear from the scene, appear in the inventory and become selected as the current active inventory item (all good news!). Once I deselect it, I can't figure out how to reselect it as the active item from the inventory GUI.

I've tried placing something in the Global script along the lines of:
Code: AGS
function iFlash_AnyClick(){
  cCharacter.ActiveInventory = iFlash;
}

but that did nothing. Any suggestions would be great! :)

Thanks again!

Khris

Depending on the type of interface you're using, there are two methods:
The default game, which uses default inv click handling, has a button on the inventory GUI that sets the current cursor mode to eModeInteract. Clicking an inventory icon with that mode selects it as active.
The other way, more suitable for a two-button interface, is to turn off default inv click handling (in General settings) and handle eMouseLeftInv and eMouseRightInv yourself inside on_mouse_click, using game.inv_activated.

(Btw, something you never do is implementing UI functionality on a per-item basis.)

frenzykitty

Thanks for this!! I will definitely take a look through the manual for the sections on eMouse*Inv :)

Quote(Btw, something you never do is implementing UI functionality on a per-item basis.)

I knew while I was doing it that this COULDN'T be right! Guess its the coding equivalent of "clutching at straws" :)

SMF spam blocked by CleanTalk