Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ninjer on Tue 24/07/2007 19:02:31

Title: Problem with my own inventory GUI
Post by: Ninjer on Tue 24/07/2007 19:02:31
Hey. It took me almost hour do some own inventory that is hidden down. I managed that, i have inventory there, it's hiding... even I have there mouse changing and everything like in normal screen...
But it (mouse icon changing with right click) don't know why working only, when is cursor on some inventory thing or in small area, where can't be put inventory things...

Hope you understand, I can't speak english much :)

btw. to make change and use mouse in inventory I use few scripts... but it wouldn't make trouble that...
Title: Re: Problem with my own inventory GUI
Post by: Ashen on Tue 24/07/2007 19:23:06
Sorry, what's the problem exactly? Right-clicking to change cursor mode has stopped working except when over the Inventory?

Post the codes you used for changing the mouse in the Inventory, and your on_mouse_click function. It's possible they're not the problem but without seeing them (or even understanding the problem properly), it's hard to tell.
Title: Re: Problem with my own inventory GUI
Post by: Khris on Tue 24/07/2007 20:20:39
And keep in mind that eMouseLeftInv and eMouseRightInv only work if the cursor is over an InventoryItem.

If you want to change the cursor while it's over the GUI, you have to use mouse.IsButtonDown() in repeatedly_execute, IIRC.
Title: Re: Problem with my own inventory GUI
Post by: Ninjer on Wed 25/07/2007 11:12:22
Quote from: KhrisMUC on Tue 24/07/2007 20:20:39
And keep in mind that eMouseLeftInv and eMouseRightInv only work if the cursor is over an InventoryItem.

If you want to change the cursor while it's over the GUI, you have to use mouse.IsButtonDown() in repeatedly_execute, IIRC.

Yes, that's the a problem.

I tried it (mouse.IsButtonDown), but... changing cursor is... clumsy... it's changing too fast...
Do you know what to do with that..?
Title: Re: Problem with my own inventory GUI
Post by: Ashen on Wed 25/07/2007 11:15:41
Post the exact code you use. It should be possible to slow it down, but it might be easier to 'fix' what you've got, than give you new stuff that might not work with what you're using. In short: ALWAYS post code, it's usually quicker in the long run...
Title: Re: Problem with my own inventory GUI
Post by: Khris on Wed 25/07/2007 11:19:59
Use a while loop to wait for the mouse button's release.
  if (mouse.IsButtonDown(eMouseLeft)) {
    while (mouse.IsButtonDown(eMouseLeft)) {
      Wait(1);
    }
  // process the click
  }

Or use something like this:
bool lmb_down; // left mouse button down

// inside rep_ex
  if (mouse.IsButtonDown(eMouseLeft)) lmb_down=true;
  else {
    if (lmb_down) {
      lmb_down=false;
      // process the click
    }
  }

This should work, too, but won't block the game.