Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Barrett on Sun 13/09/2009 15:21:03

Title: Inventory window opens/works, but will not close
Post by: Barrett on Sun 13/09/2009 15:21:03
// main global script file

// called when the game starts, before the first room is loaded
function game_start() {}


// put anything you want to happen every game cycle in here
function repeatedly_execute()
{
}

function show_inventory_window ()
{
  gtorginvwindow.Visible = true;
  // switch to the Use cursor (to select items with)
  mouse.Mode = eModeInteract;
  // But, override the appearance to look like the arrow
  mouse.UseModeGraphic(eModePointer);
}

function hide_inventory_window() {
  gtorginvwindow.Visible = false;
}



function invbtn_OnClick(GUIControl *control, MouseButton button) {
 
  show_inventory_window();
}

function btnbacktogame_OnClick(GUIControl *control, MouseButton button) {
 
  hide_inventory_window();
}

   Once again I'm sure it's simple, but I've been toying with it most of the morning...oh, and the button is set to run script.
Title: Re: Inventory window opens/works, but will not close
Post by: Khris on Sun 13/09/2009 15:24:00
In the button's event pane, check if it says "btnbacktogame_OnClick" in the field.
Also, you can put a Display line inside functions to check if they're called.
Title: Re: Inventory window opens/works, but will not close
Post by: Barrett on Sun 13/09/2009 15:28:14
Grrr. I just assumed those types of things changed automatically when you renamed the button.

Thanks again.