Author Topic: (Solved)Disable inventory in room (BASS template)  (Read 438 times)

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?
« Last Edit: 01 Dec 2017, 21:17 by doctorhibert »

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: Disable inventory in room (BASS template)
« Reply #1 on: 30 Nov 2017, 00:29 »
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;

Re: Disable inventory in room (BASS template)
« Reply #2 on: 30 Nov 2017, 21:20 »
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

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Disable inventory in room (BASS template)
« Reply #3 on: 30 Nov 2017, 21: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.
« Last Edit: 30 Nov 2017, 21:52 by Crimson Wizard »

Re: Disable inventory in room (BASS template)
« Reply #4 on: 01 Dec 2017, 01:46 »
Yep, it makes sense

Code: Adventure Game Studio
  1. function repeatedly_execute()
  2. {
  3.         // Inventory GUI:
  4.         // - make visible if mouse "touches" trigger zone
  5.         // - make invisible if mouse leaves inventory GUI
  6.         if (!gInventoryBar.Visible && mouse.y <= INVENTORY_POPUP_POSITION)
  7.         {
  8.                 gInventoryBar.Visible = true;
  9.         }
  10.        
  11.         if (gInventoryBar.Visible && mouse.y > gInventoryBar.Height)
  12.         {
  13.                 gInventoryBar.Visible = false;
  14.         }
  15.  

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

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: Disable inventory in room (BASS template)
« Reply #5 on: 01 Dec 2017, 11:16 »
Code: Adventure Game Studio
  1.   if (!gInventoryBar.Visible && mouse.y <= INVENTORY_POPUP_POSITION)
  2.   {
  3.     if (player.Room != 1) gInventoryBar.Visible = true;
  4.   }

Re: Disable inventory in room (BASS template)
« Reply #6 on: 01 Dec 2017, 21:16 »
Wow alright, that's a lot easier than I thought it was. Thanks