Active Inventory gui woes (NOT NO MO')

Started by Ultra Magnus, Wed 13/08/2008 16:17:51

Previous topic - Next topic

Ultra Magnus

Firstly, I apologise immensely for having to ask this, because I know it's been asked several times before, but I've been searching through and reading all the old threads and stuff ain't working.

Based mostly upon this old thread, I have made a new GUI (gActiveInv) with a button (btnActiveInv) set to PopupModal with a z order of 2, where the normal UI it will be overlaid onto has a z order of 1.

I want it to show up when an inventory item is selected (obviously), so...

Global Script:
Quote

function btnInvSelect_OnClick(GUIControl *control, MouseButton button)
{
  mouse.Mode = eModeUseinv;
  mouse.UseModeGraphic(eModeUseinv);
  btnActiveInv.NormalGraphic=player.ActiveInventory.Graphic;
  gActiveInv.Visible=true;
}


The selected inventory item becomes active, the cursor changes, but gActiveInv doesn't appear.
I've tried using (INV) as well, but nothing doing.

Help?

Thanks.

Version 3.0, by the way.
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

Khris

The function in your post is the function associated with the pointer button on the built-in inventory GUI used to set the cursor to "selectActiveInv"-Mode.

You'll need to check for eModeUseinv in rep_ex.

Code: ags
function repeatedly_execute() {

  // other code

  // new:
  if (mouse.Mode == eModeUseinv && !gActiveInv.Visible) {
    btnActiveInv.NormalGraphic = player.ActiveInventory.Graphic;
    gActiveInv.Visible = true;
  }
  else if (mouse.Mode != eModeUseinv && gActiveInv.Visible) gActiveInv.Visible = false;
}


Also note that a Popup modal GUI will halt the game (like e.g. the Quit? GUI), so switch its visibility to Normal, then put "gActiveInv.Visible = false;" inside game_start.

Ultra Magnus

Thanks muchly, but wouldn't that mean that it's only visible while said inventory item is the current cursor mode?
How about swapping if (mouse.Mode == eModeUseinv && !gActiveInv.Visible) for if (player.ActiveInventory!=null), would that work?

Sorry, it's been a while. I've forgotten a lot of stuff.

Quote from: KhrisMUC on Wed 13/08/2008 16:48:54
Also note that a Popup modal GUI will halt the game (like e.g. the Quit? GUI), so switch its visibility to Normal, then put "gActiveInv.Visible = false;" inside game_start.

I had a feeling it was something like that, but I tried Normal mode first, and that didn't work.
I also think someone suggested using Popup in an old thread somewhere, but maybe not.
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

Khris

QuoteThanks muchly, but wouldn't that mean that it's only visible while said inventory item is the current cursor mode?
True, that's what I thought you wanted. I have to admit though that showing the inv item in the corner only while it's the current cursor anyway seems a bit silly :)

Change it to:
Code: ags
function repeatedly_execute() {

  // other code

  // new:
  if (player.ActiveInventory != null) {
    btnActiveInv.NormalGraphic = player.ActiveInventory.Graphic;
    gActiveInv.Visible = true;
  }
  else gActiveInv.Visible = false;
}


QuoteI had a feeling it was something like that, but I tried Normal mode first, and that didn't work.
It seems like "gActiveInv.Visible = true;" was never actually called. Normal is the right mode for what you want (a GUI that switches its visibility depending on the game's state).

Ultra Magnus

Excellent stuff. Works a charm.
I thank you, kind sir.
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

SMF spam blocked by CleanTalk