(Solved)Disable inventory in room (BASS template)

Started by doctorhibert, Wed 29/11/2017 23:33:02

Previous topic - Next topic

doctorhibert

Hey, so I'm making a game with the BASS template, which means the inventory is acessed by mousing over the top of the screen. Works perfectly, only issue is I want to disable this for the title screen.

Another question since you're already here, the exit game button is in the inventory itself, how do I make another exit button in the titlescreen outside it that acesses the same gui I made for confirming exit?

Khris

Just turn the GUI invisible in game_start, then turn it visible again in the first actual room.

As for the button / hotspot, all you need in its handler function is gMyQuitGUI.Visible = true;

doctorhibert

If I put gInventorybar.visible=false; in game_start or even in room_load of the title screen I can still move my mouse to the top and it still shows up. What am I doing wrong? If I set the transparency to 100 you can't see it but the inventory items are still there, and the exit button is still there and clickable!

Crimson Wizard

#3
Quote from: doctorhibert on Thu 30/11/2017 21:20:49
If I put gInventorybar.visible=false; in game_start or even in room_load of the title screen I can still move my mouse to the top and it still shows up. What am I doing wrong? If I set the transparency to 100 you can't see it but the inventory items are still there, and the exit button is still there and clickable!

I have a suspicion that may be a behavior of dropping-down GUIs, they cannot be disabled by Visible command, because moving mouse makes them visible automatically.
Not sure if there are other ways, but I'd suggest to make it normal GUI instead of "Popup at mouse Y" type, and code it so that it drops down when mouse is at the top yourself.



EDIT: Actually, if you are using "Lightweight BASS" template, the script module makes it visible. Look at repeatedly_execute() function in the TwoClickHandler.asc.

doctorhibert

Yep, it makes sense

Code: ags
function repeatedly_execute()
{
	// Inventory GUI: 
	// - make visible if mouse "touches" trigger zone
	// - make invisible if mouse leaves inventory GUI
	if (!gInventoryBar.Visible && mouse.y <= INVENTORY_POPUP_POSITION)
	{
		gInventoryBar.Visible = true;
	}
	
	if (gInventoryBar.Visible && mouse.y > gInventoryBar.Height)
	{
		gInventoryBar.Visible = false;
	}


But the question is, how do I temporarily disable this?

Khris

Code: ags
  if (!gInventoryBar.Visible && mouse.y <= INVENTORY_POPUP_POSITION)
  {
    if (player.Room != 1) gInventoryBar.Visible = true;
  }

doctorhibert

Wow alright, that's a lot easier than I thought it was. Thanks

SMF spam blocked by CleanTalk