Table of Contents

Picking up

class MyHero : AutomaticHero
{    
    
    void Update()
    {
        // Automatically pick up gold and health potions (from the nearest to the farthest)
        var item = FindNearestItem("Gold", "Vial of Health");
    
        if (item != null)
        {
            PickUp(item);
            return;
        }
    }
    
}
class MyHero : AutomaticHero
{    
    
    void Update()
    {
        // First pick up all useful items
        var item = FindNearestItem("Gold");
    
        if (item != null)
        {
            PickUp(item);
            return; // return stops the execution of the method, so the code below will not be executed, until the item is picked up
        }
        
        // Then pick up the trash
        item = FindNearestItem("Vial of Health");
        if (item != null)
        {
            PickUp(item);
        } 
    }
    
}

Equipping

class MyHero : AutomaticHero
{   
    void Update()
    {
        // Makes hero fetch a stick
        var item = FindNearestItem("Stick");
    
        if (item != null)
        {
            Equip(item);
        }
    }
    
}
class MyHero : AutomaticHero
{   
    void Update()
    {
        // Find a stick in the inventory and equip it
        var item = FindItemInInventory("Stick");
    
        if (item != null)
        {
            Equip(item);
        }
    }
    
}

Shortcut for opening inventory

class MyHero : AutomaticHero
{
    void Update() // all the time
    {
        if (Input.GetKeyDown(KeyCode.F2)) // check if use presses the F1 key
        {
            OpenInventory();
        }
    }
}

Beware that with multiple heroes, this would open all their inventories, checkout party tutorial for more information.