Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: ------ on Wed 09/12/2009 04:43:15

Title: -----
Post by: ------ on Wed 09/12/2009 04:43:15
-----
Title: Re: Problem selecting inventory items
Post by: Khris on Wed 09/12/2009 09:34:33
It looks like something's running in rep_ex, are you using any modules, templates, code from other people?
Title: ----
Post by: ------ on Wed 09/12/2009 12:40:08
---
Title: Re: Problem selecting inventory items
Post by: Khris on Wed 09/12/2009 13:39:35
There didn't seem to be any consistent style of indentation so I cleaned this up a bit:

// main global script file

int Mouse_Mode_Cache = eModePointer;

bool paso_por_Inv;

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
  // called when the game starts, before the first room is loaded
}
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


function repeatedly_execute_always() {

  GUI *theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);

  BotonInvent.NormalGraphic=14;

  if (theGui == gInventario) {
    if  (paso_por_Inv == false) {
      paso_por_Inv = true;
      Mouse_Mode_Cache = Mouse.Mode;
      Mouse.Mode = eModeInteract;
    }

    //Esta desplegado?

    if (gInventario.Y < 0 ) {
      if (gInventario.Y > (70-90) ) {
        gInventario.X = gInventario.X + 1;
        gEncima.X=gEncima.X + 1;
      }
     
      gInventario.Y=gInventario.Y + 1;
      gEncima.Y=gEncima.Y + 1;
    }
  }

  else {

    //********************

    // if (paso_por_Inv) Mouse.Mode = Mouse_Mode_Cache;

    if (paso_por_Inv && Mouse.Mode != eModeUseinv) Mouse.Mode = Mouse_Mode_Cache;

    //********************

    paso_por_Inv=false;

    BotonInvent.NormalGraphic=15;
   
    if (gInventario.Y >(20-85)) {
      if (gInventario.Y>(65-85)) {
        gInventario.X = gInventario.X -1;
        gEncima.X=gEncima.X -1;
      }

      gInventario.Y=gInventario.Y - 1;
      gEncima.Y = gEncima.Y - 1;
    }
         

  }
}


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here
  if (gMouselabel.Visible == true) {
    UnPauseGame ();                                 
  }

  gMouselabel.SetPosition(mouse.x, mouse.y);
}
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


function show_inventory_window () {
  // This demonstrates both types of inventory window - the first part is how to
  // show the built-in inventory window, the second part uses the custom one.
  // Un-comment one section or the other below.

  // ** DEFAULT INVENTORY WINDOW
  //  InventoryScreen();

  // ** CUSTOM INVENTORY WINDOW
  gInventario.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);

}


I've marked my change with *******s, it's at the beginning of the main else.
Upon the mouse leaving the inventory GUI, its mode is set back to whatever it was before. Thus, once you had selected an inventory item, the mode was changed back to eModeInteract regardless.
My change should fix that.
Title: ------
Post by: ------ on Wed 09/12/2009 14:00:06
----
Title: Re: Problem selecting inventory items
Post by: Khris on Wed 09/12/2009 17:23:50
You're welcome :)