Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: 10o on Tue 18/10/2011 17:46:25

Title: Can't Use Iventory Items
Post by: 10o on Tue 18/10/2011 17:46:25
My GUI ist still like in this Thread :
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44644.msg596325#msg596325

Problem is that I can rightclick on the Items and it will wie displayed the current Message, but if I rightclick on them my Curser stays the same and doesent get the Iventory object. So I'am not able to drag out the Objects from the Inventar.

I found some kind of Help on Adventure Treff from a Thread and added following lines:


In repeatedly_execute:


  GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if (gc == invCustomInv) {   // Maus über Inventarfenster?
    if (mouse.Mode != eModeInteract && mouse.Mode != eModeUseinv)
      mouse.Mode = eModeInteract;
  }


Inventar-Klicks:

// Anfang von on_mouse_click:

  InventoryItem*ia = inventory[game.inv_activated];  // falls Klick auf Inv Item, in ia speichern

  // dann:
  ...
  else if (button == eMouseLeftInv) {
    if (mouse.Mode == eModeUseinv) ia.RunInteraction(eModeUseinv);  // aktuelles Item mit ia benutzen
    else player.ActiveInventory = ia;  // angeklicktes Item auswählen
  }
  else if (button == eModeRightInv) {
    if (mouse.Mode == eModeUseinv) player.ActiveInventory = null;  // aktives Item abwählen
    else ia.RunInteraction(eModeLookat);  // angeklicktes Item anschauen
  }



But it didn't do anything.



Here my aktulized skript wich still doesent work out for that problem:

function on_mouse_click(MouseButton button) {
   
  InventoryItem*ia = inventory[game.inv_activated];  // falls Klick auf Inv Item, in ia speichern

  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft)
  {
//   ProcessClick(mouse.x, mouse.y, mouse.Mode );
        int nm;
    if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter)
    {
      nm= eModeTalkto;
    }
    else if (GetLocationType(mouse.x, mouse.y) == eLocationNothing)
    {
      nm= eModeWalkto;
    }
    else if (GetLocationType(mouse.x, mouse.y) == eLocationHotspot)
    {
      if(wechsel == 0)
      {
      nm=eModeInteract;
      }
      else
      {
      nm= eModeWalkto;
      }
    }
   
    else
    {
      nm=eModeInteract;
    }
    ProcessClick(mouse.x, mouse.y, nm); 
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor
   // mouse.SelectNextMode();
   int mm;
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing)
    {
      mm = eModeWalkto;
    }
    else
    {
      mm = eModeLookat;
    }
    ProcessClick(mouse.x, mouse.y, mm);

  }
  else if (button == eMouseMiddle) {
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
    // leave our options open - what if you have a special script triggered
    // on "walking" mode?
    ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  else if (button == eMouseWheelNorth) {
    // Mouse-wheel up, cycle cursors
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
    // of eNums, when it suits us)...
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1;
    else
    {
      // ...but if it is WALK mode...
      if (player.ActiveInventory!=null)
      {
        //...and the player has a selected inventory item, set mouse mode to UseInv.
        mouse.Mode=eModeUseinv;
      }
      else
      {
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
        mouse.Mode=eModeTalkto;
      }
    }
  }
  else if (button == eMouseLeftInv)
  {
    if (mouse.Mode == eModeUseinv) ia.RunInteraction(eModeUseinv);  // aktuelles Item mit ia benutzen
    else player.ActiveInventory = ia;  // angeklicktes Item auswählen
  }
  else if (button == eMouseRightInv)
  {
    if (mouse.Mode == eModeUseinv) player.ActiveInventory = null;  // aktives Item abwählen
    else ia.RunInteraction(eModeLookat);  // angeklicktes Item anschauen
  }
   
}


function repeatedly_execute() {
 
  // Put here anything you want to happen every game cycle, even when
  // the game is paused. This will not run when the game is blocked
  // inside a command like a blocking Walk()
 
    GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
    if (gc == invCustomInv)
    {   // Maus über Inventarfenster?
      if (mouse.Mode != eModeInteract && mouse.Mode != eModeUseinv)
      mouse.Mode = eModeInteract;
    }
 
   if (GetLocationType(mouse.x, mouse.y)==eLocationCharacter)
   {
    mouse.Mode = eModeTalkto;
    wechsel = 0;
    }
  else if (GetLocationType(mouse.x, mouse.y)==eLocationObject)
   {
    mouse.Mode = eModeInteract;
    wechsel = 0;
   }
    else if (GetLocationType(mouse.x, mouse.y)==eLocationHotspot)
   {
     if(wechsel==0)
     {
      mouse.Mode = eModeInteract;
      wechsel = 0;
     }
     else
     {
       mouse.Mode = eModeArrowR;
       
     }
   } 
  else
  {
    mouse.Mode = eModeWalkto;
    wechsel = 0;
   
  }
 
  if (IsGamePaused() == 1) return;

  // Put here anything you want to happen every game cycle, but not
  // when the game is paused.
}



Title: Re: Can't Use Iventory Items
Post by: Khris on Wed 19/10/2011 11:36:13
Did you turn on that inventory clicks are handled in script in General settings?
Title: Re: Can't Use Iventory Items
Post by: 10o on Wed 19/10/2011 12:13:00
My settings are:
(http://i16.photobucket.com/albums/b26/666Flex/iventory.jpg)
Title: Re: Can't Use Iventory Items
Post by: Matti on Wed 19/10/2011 14:56:46
Well, you didn't..
Title: Re: Can't Use Iventory Items
Post by: 10o on Wed 19/10/2011 16:17:38
If I change "Override item cursor hotspot marker" to True, I can't even rightclick on the Items to show the display Messsage.  :(
Title: Re: Can't Use Iventory Items
Post by: Khris on Wed 19/10/2011 23:03:36
You need to set "Override built-in inventory window click handling" to true, otherwise, eMouseLeftInv/RightInv are useless.
Title: Re: Can't Use Iventory Items
Post by: 10o on Thu 20/10/2011 12:24:04
Oh yes I ment that, I wrote bullshit in my last post...  :-\

When is set "Override item cursor hotspot marker" to true I can't even rightclick on the Items to show the display Messsage nor interact with them ond leftclick. Just nothing happens.