Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Milo87 on Thu 24/06/2010 02:19:41

Title: Custom Interface and Inventory woes
Post by: Milo87 on Thu 24/06/2010 02:19:41
Hey forum peeps. For my reboot of Dark Lake, I've implemented a completely custom interface based around the Broken Sword model (ie intelligent cursors). This is all well and good, with liberal use of the rep_ex function, but now I've run into problems with a custom inventory.

When I select an inventory object, the cursor doesn't change to the object in question. Handle Inventory Clicks in Script it set to False, which was the first thing I checked. I looked through the basic game template to see how Inventories are handled, but couldn't find anything useful. I also figured it was something to do with my rep_ex, which repeatedly checks what the cursor is over, and changes to the appropriate mode. I tried (player.ActiveInventory == null) before checking whether to change cursor mode, but no joy.

Can anyone help?
Title: Re: Custom Interface and Inventory woes
Post by: DrewCCU on Thu 24/06/2010 19:51:04
try checking out Mouse Functions and Properties in the AGS help file.  Theres a lot of things in there that you may find useful.
Title: Re: Custom Interface and Inventory woes
Post by: Dualnames on Thu 24/06/2010 23:24:48
You may have "Use inventory sprites as cursor graphics"(or whatever that property is called) set to false. A post of the code would be wise as well.
Title: Re: Custom Interface and Inventory woes
Post by: Milo87 on Fri 25/06/2010 15:58:46
Dualnames, it is set to true, it's one of the things I checked. Forgot to mention that in my first post.

Here's my run_interface script, which is called in rep_ex:

function run_interface()
{
  int locationType = GetLocationType(mouse.x, mouse.y);
 
  if(!GetRoomProperty("Title Screen") && !IsGamePaused())
  {
    if(GetLocationType(mouse.x, mouse.y) == eLocationHotspot)
    {
      Hotspot *hotspotAtMouse = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
     
      int dir;
   
      if(hotspotAtMouse.GetProperty("Exit"))
      {
        dir = hotspotAtMouse.GetProperty("Exit Direction");
        mouse.Mode = eModeExit;
        mouse.ChangeModeGraphic(eModeExit, 13+dir);
      }
      else
      {
        mouse.Mode = eModeInteract;
      }
    }
 
    else if(locationType == eLocationCharacter) mouse.Mode = eModeTalkto;

    else if(locationType == eLocationObject) mouse.Mode = eModePickup;
 
    else if(locationType == eLocationNothing) mouse.Mode = eModeWalkto;
  }
   
  else
  {
    mouse.Mode = eModePointer;
  }

//And some other stuff, not related to the cursor modes

}
Title: Re: Custom Interface and Inventory woes
Post by: Khris on Fri 25/06/2010 16:19:36
So where's the check for player.ActiveInventory being != null?
Title: Re: Custom Interface and Inventory woes
Post by: Milo87 on Fri 25/06/2010 16:57:30
Whoops, I deleted because it wasn't working. Forgot to put it in on here.

I tried this:

if(!GetRoomProperty("Title Screen") && !IsGamePaused() && player.ActiveInventory == null)

Although never having made an interface from scratch, it was just educated guessing.
Title: Re: Custom Interface and Inventory woes
Post by: Milo87 on Sun 04/07/2010 19:15:58
Sorry to bump this, but I still haven't worked it out and it's been really bugging me D: Can anyone help?