Problem with mouse mode emodeUseinv [SOLVED]

Started by Electroshokker, Sat 17/09/2005 12:56:06

Previous topic - Next topic

Electroshokker

I'm using AGS 2.7

I have the "Handle inventory items in script" tagged, 'cause I'm making a custom inventory gui (CMI style, with the coin-gui over inventory items as well)

the problem is when I try to change the Mouse.Mode to eModeUseinv after a left-click on an inventory item, the mouse mode refuses to change to that cursor mode. It just stays in the previous cursor mode. If I tell it to change to any other cursor mode, it works as expected.

Here's the code (only the relevant part, everything else of my script could be removed without any difference to the response)

Quote
#sectionstart on_mouse_click
function on_mouse_click(int button) {
  // 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 == eMouseLeftInv){
    Mouse.ChangeModeGraphic(eModeUseinv,inventory[game.inv_activated].Graphic);
    Mouse.Mode = eModeUseinv;
    Display("mouse mode is %d", Mouse.Mode);
   }
}
#sectionend on_mouse_click

I tried changing it to right click response, but no go either.
I searched through the forum and bug reports, but couldn't find any answers. Does anybody know how to fix this (or a workaround?)

EDIT: Thanks, that worked!

Scorpiorus

The eModeUseinv mode is unavailable until you specify an active inventory item (one that will be used by that mode):

...
else if (button == eMouseLeftInv) {
Ã,  Ã, player.ActiveInventory = inventory[game.inv_activated];
Ã,  Ã, ...
}

SMF spam blocked by CleanTalk