Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Display Items Examine text on highlight in inventory

Hi All!
I am trying to create a game that is using just the keyboard, no mouse. I would like to make it so when you open up the inventory the 'examine' action runs as you scroll over each item.

Right now I have it so you can examine the items by pressing the 'examine' button. But I would like it to happen automatically

Any Ideas?


  • edited December 2019

    You can hook into the OnMouseOverMenu custom event to detect when hovering over an inventory item, and then run its Examine interaction:

    private void OnEnable ()
        EventManager.OnMouseOverMenu += OnMouseOverMenu;
    private void OnDisable ()
        EventManager.OnMouseOverMenu -= OnMouseOverMenu;
    private void OnMouseOverMenu (Menu menu, MenuElement element, int slot)
        if (menu.title == "Inventory" && element != null)
            MenuInventoryBox inventoryBox = element as MenuInventoryBox;
            if (inventoryBox != null)
                InvItem invItem = inventoryBox.GetItem (slot);
                if (invItem != null)
                    invItem.RunExamineInteraction ();
  • Thank you for your response Chris,
    Would you be able to point me in the direction of a tutorial on how to 'Hook into' custom events?
    I come from an animation background so have zero coding knowledge. Sorry!

  • I linked the "custom event" above to a tutorial, but the code I wrote should also do it - though you may have to rename the "Inventory" menu string.

    See also the Manual's "Custom events" chapter for further explanation.

  • HI Chris. I added this script to the GameEngine Object but when I try to run, I get the error:
    Unexpected symbol void', expectingclass', delegate',enum', interface',partial', or `struct'

    any Ideas?

  • Don't overwrite the default C# code with that - it goes inside the script itself.

    Create a new C# script, remove the default Start / Update functions, and insert the code above where they used to be.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.