can i expand a bag to reveal what it contains in inventory?? [SOLVA-REE-KNEED ]

Started by Joseph, Mon 31/01/2011 20:55:10

Previous topic - Next topic

Joseph

yo dudes!

I have bag I pick up nad put in my inventory. Id like this
scenario: you find a bag on the ground. pick it up.it goes inmy inventory.

Then, when i click on the bag in inventory, i want it to 'expand' whats inside (3 items inside the bag: 1 turtle wax can, 1 turtle treat, 1 jar of turtle juice) so that the next 3 items are now outside the bag, next to the bag in my inventory. important: no matter what items is next to bag already, those 3 items will always be exactly next to the bag, bumping the order always.

whenyou click on the bag again, it will 'collapse' those items so all go back inside the bag.

How can I get this done??
help please!! or else!!!  ;D ;D
Spread the love...One.Turtle.At.A.Time.
http://www.youtube.com/watch?v=y0A77rohcyg

monkey0506

I'm thinking:

Code: ags
// GlobalScript.asc

function iBag_AnyClick()
{
  int index = -1;
  int i = 0;
  while (i < invWindow.ItemCount)
  {
    if (invWindow.ItemAtIndex[i] == iBag)
    {
      index = i;
      i = invWindow.ItemCount;
    }
    i++;
  }
  if (index == -1) return; // this shouldn't happen at this point..
  if (mouse.Mode == eModeOpen)
  {
    if (!player.HasInventory(iTurtleWax)) player.AddInventory(iTurtleWax, index);
    if (!player.HasInventory(iTurtleTreat)) player.AddInventory(iTurtleTreat, index + 1);
    if (!player.HasInventory(iTurtleJuice)) player.AddInventory(iTurtleJuice, index + 2);
  }
  else if (mouse.Mode == eModeClose)
  {
    if (player.HasInventory(iTurtleWax)) player.LoseInventory(iTurtleWax);
    if (player.HasInventory(iTurtleTreat)) player.LoseInventory(iTurtleTreat);
    if (player.HasInventory(iTurtleJuice)) player.LoseInventory(iTurtleJuice);
  }
}

Joseph

you thought right, b*tch. :D :D :o ;)

muchas gracias mi amigo!
Spread the love...One.Turtle.At.A.Time.
http://www.youtube.com/watch?v=y0A77rohcyg

monkey0506

Could possibly need some fine-tuning later on depending how exactly those inventory items are actually getting used, but that's the basic first step to getting where you need to be. Or possibly, barring your exact needs, you'll never need to modify it. Either way, glad you got it working. ;)

SMF spam blocked by CleanTalk