Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: SeamanNaranja on Sun 18/12/2011 18:14:59

Title: Problem with ScrollUp and ScrollDown in inventory
Post by: SeamanNaranja on Sun 18/12/2011 18:14:59
Ok, so I have an inventory with working ScrollUp and ScrollDown arrows. There's just one problem. If I select an inventory item from the first row of items and try to click myself downwards with my InvDown button the item gets deselected. That means that I can't use an inventory item from row 1 on an inventory item on row 4.

I tried to look this up, but I could't find the answer anywhere. This is my code:

function btnInvUp_Click(GUICONTROL *control, Mousebutton button) {
   InvCustomInv.ScrollUp();
}
Title: Re: Problem with ScrollUp and ScrollDown in inventory
Post by: Khris on Sun 18/12/2011 18:17:21
That's the code for InvUp, could you post the InvDown code, too?
Are you using any modules or templates?
And please post your on_mouse_click.
Title: Re: Problem with ScrollUp and ScrollDown in inventory
Post by: SeamanNaranja on Sun 18/12/2011 18:52:08
Quote from: Khris on Sun 18/12/2011 18:17:21
That's the code for InvUp, could you post the InvDown code, too?
Are you using any modules or templates?
And please post your on_mouse_click.

Here is both codes:

function btnInvUp_Click(GUICONTROL *control, Mousebutton button) {
  InvCustomInv.ScrollUp();
}

function btnInvDown_Click(GUICONTROL *control, Mousebutton button) {
  InvCustomInv.ScrollDown();
}


And here is the on_mouse_click:

function on_mouse_click(MouseButton button) {
 if (IsGamePaused() == 1) {
 }
 else if (button == eMouseLeft) {
 }
 else if ((button == eMouseRight) && (player.ActiveInventory == null)) {
   gInventory.Visible = !gInventory.Visible;
 }
 else if (button == eMouseMiddle) {
   ProcessClick(mouse.x, mouse.y, eModeWalkto);
 }
 else if (button == eMouseWheelNorth) {
   if (mouse.Mode>0) mouse.Mode=mouse.Mode-1;
   {
     if (player.ActiveInventory!=null)
     {
     }
     else
     {
       mouse.Mode=eModeTalkto;
     }
   }
 }
}


As for modules or templates nothing directly related to the inventory, well perhaps Verbcoin (by monkey_05_06). I also use Tween and GuiPortrait (SSH) in my game.

I don't know if this has anything to do with it but I have the Override built-in inventory window click handling set to False.
Title: Re: Problem with ScrollUp and ScrollDown in inventory
Post by: monkey0506 on Sun 18/12/2011 21:31:54
The Verbcoin module would set the player.ActiveInventory to null if the mouse cursor was set to the value of eVerbcoinDefaultMode (by default, eModeWalkto), if Verbcoin.Enabled is true and Verbcoin.CoinGUI is non-null. The assumption in that case is that the verbcoin effect is in place, which means that the cursor modes aren't going to be used in the "normal" fashion anyway.

So unless you're specifically changing the cursor mode after the ActiveInventory has been set then the Verbcoin module isn't impeding anything here.

However, if you're not overriding the built-in inventory handling, then I would say that it has something to do with how the engine processes the default handling of clicking a GUIControl in eModeUseInv. You may need to script the inventory interactions yourself.
Title: Re: Problem with ScrollUp and ScrollDown in inventory
Post by: SeamanNaranja on Thu 05/01/2012 23:27:27
Quote from: monkey_05_06 on Sun 18/12/2011 21:31:54However, if you're not overriding the built-in inventory handling, then I would say that it has something to do with how the engine processes the default handling of clicking a GUIControl in eModeUseInv. You may need to script the inventory interactions yourself.

Sorry for the late reply, was away for holiday in internet barren land (who knew it existed these days). It doesn't seem to help that I override the built-in inventory handling either. So I might have to script the inventory interactions myself. How would I go about doing that?