inventory troubles

Started by thecatamites, Sun 20/12/2009 13:29:21

Previous topic - Next topic

thecatamites

Hello,
In my game I have a custom inventory and two-click system. I can go into the inventory and select an item, and use it or deselect it with the right mouse button, just fine. The problem is that after I use/deselect it I can no longer select any items on the inventory screen! Wherever I click on the graphics there is no response. This happens to inventory items other than the one i have used, too.

I'm pretty sure this is down to my extremely ugly code in some way, but I can't figure out why!
Here's the code for on_mouse_click:

Code: ags

if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
  }
  if (gInv.Visible == true)
  {
    if (button == eMouseLeft)
    {
      ProcessClick(mouse.x, mouse.y, eModePointer);
    }
    else if (button == eMouseRight)
    {
      ProcessClick(mouse.x, mouse.y, eModePointer);
      }
  }
  else if (gInv.Visible == false)
  {
    if (player.ActiveInventory == null)
    {
  if (button == eMouseLeft) 
    {
      if (GetLocationType(mouse.x, mouse.y) == eLocationNothing)
      {
    ProcessClick(mouse.x,mouse.y, eModeWalkto);
  }
  else
  {
    ProcessClick(mouse.x,mouse.y, eModeLookat);
    }
  }
  else /// on right click
    {   
    ProcessClick(mouse.x, mouse.y, eModeInteract);
}
}
else
{
  if (button == eMouseLeft)
  {
    ProcessClick(mouse.x, mouse.y, eModeUseinv);
  }
  else if (button == eMouseRight)
  {
    player.ActiveInventory = null;
    }
  }
}


gInv is the inventory screen, which is brought up by clicking a gui in the bottom left corner of the screen. Anyway, like I said this is probably some dumb coding mistake in on_mouse_click but I can't find it. Any help would be much appreciated!
Games 4 Schools Dot Com play games made for schools and teens to lkearn

thecatamites

Whoops, nevermind, I can just set the activeinventory in the event settings for the individual objects and that seems to fix it.
Games 4 Schools Dot Com play games made for schools and teens to lkearn

thecatamites

Uh, scratch that. That fixed it for a while but now it's back again, after a certain point in the game where control switches to another character. I've tried it by setting that character's activeinventory and the 'player' activeinventory to the item in the item's events page, in the same way as above, but no luck. Should I just keep the original character and change views etc or is this a different problem entirely?
Games 4 Schools Dot Com play games made for schools and teens to lkearn

SMF spam blocked by CleanTalk