Servuo
Client 7.0.15.1

I have some storage boxes that work great for storing items. However I am now trying to store tools and I am having a difficult time figuring out how to show the stored tool's uses as item count and then outputting a new tool with those uses.

Example: I drop 5 sewing kits onto box, each sewing kit has 10 uses. I want the box to show 50 sewing kits and then dispense a kit with 50 uses (or selected number from menu).

As the script is currently when I drop a sewing kit onto the box the usesremaining will go up by how many tools I drop on the box and not the uses the tools have.

Thanks for the help!
 

Attachments

  • TestBox.cs
    11.8 KB · Views: 2
I think you want it to work like that.

Also note that I didnt remove the extra variables.
 

Attachments

  • TestBox.cs
    9.2 KB · Views: 4
I appreciate the help.

Here are the errors. I have been unable to work them out.

C#:
Errors:
 + Items/Custom Items/IRBs/TestBox.cs:
    CS1061: Line 134: 'Server.Item' does not contain a definition for 'UsesRemai
ning' and no extension method 'UsesRemaining' accepting a first argument of type
 'Server.Item' could be found (are you missing a using directive or an assembly
reference?)
    CS1061: Line 136: 'Server.Item' does not contain a definition for 'UsesRemai
ning' and no extension method 'UsesRemaining' accepting a first argument of type
 'Server.Item' could be found (are you missing a using directive or an assembly
reference?)
    CS1061: Line 139: 'Server.Item' does not contain a definition for 'UsesRemai
ning' and no extension method 'UsesRemaining' accepting a first argument of type
 'Server.Item' could be found (are you missing a using directive or an assembly
reference?)
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 
My bad, didnt think about that feact that it was casted to an Item. Here we go
 

Attachments

  • TestBox.cs
    9.2 KB · Views: 1
I'm now trying to add runic items with mixed success. So far all my attempts to limit the runics by CraftResource has failed and it counts all hammer types as DullCopper in this case. This is my latest attempt.

C#:
public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped == null) return false;

            Item curItem = (Item)dropped;

            if (curItem is RunicHammer)
            {
                if (CraftResource.DullCopper is CraftResource)
                {
                    DCRunic = RunicHammer;
                    IUsesRemaining Tool = curItem as IUsesRemaining;
                    if (DCRunic + Tool.UsesRemaining > StorageLimit)
                    {
                        SendOverLimitMessage(from, DCRunic + Tool.UsesRemaining - StorageLimit);
                        return false;
                    }
                    DCRunic += Tool.UsesRemaining;
                    from.SendGump(new TestBoxGump((PlayerMobile)from, this));
                    curItem.Delete();
                    return true;
                }
            }

And it outputs a DullCopper hammer but with 0 uses if stored uses are equal to or less than the set withdraw amount. Hammers taken out of the box and placed back into the box do not add to count.

C#:
          else if (info.ButtonID == 3)
            {
                if (m_Container.DCRunic > m_Container.WithdrawIncrement)
                {
                    m_From.AddToBackpack(new RunicHammer(CraftResource.DullCopper , m_Container.WithdrawIncrement));
                    m_Container.DCRunic = m_Container.DCRunic - m_Container.WithdrawIncrement;
                    m_From.SendGump(new TestBoxGump(m_From, m_Container));
                }
                else if (m_Container.DCRunic > 0)
                {
                    m_From.AddToBackpack(new RunicHammer(CraftResource.DullCopper , m_Container.RunicHammer));
                    m_Container.DCRunic = 0;
                    m_From.SendGump(new TestBoxGump(m_From, m_Container));
                }
                else
                {
                    m_From.SendMessage("You do not have any of that resource!");
                    m_From.SendGump(new TestBoxGump(m_From, m_Container));
                }
            }
 

Attachments

  • TestBox.cs
    12.2 KB · Views: 0
Back