Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Zany on Wed 11/10/2017 10:03:23

Title: Cursor Modification wont allow me to use inventory item
Post by: Zany on Wed 11/10/2017 10:03:23
I modified my cursor so that it has only 2 views, 1 general and 1 which changes when I hover over a hotspot. The problem that I'm having is that when I need to take an emblem(inventory item) out of my inventory and place it somewhere it doesn't actually with hold the emblem(inventory item).
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Slasher on Wed 11/10/2017 10:45:59
Have you got this in general settings set to true?
Override built-in inventory window click handling
try setting it to false if not already.

Also, check that your inventory window height and width of items are set ok and that the hotspots of your inv items are positioned ok so the mouse interacts with them OK.

Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Khris on Wed 11/10/2017 11:22:40
How exactly did you modify the cursors? Which cursor modes is your game using?
If inventory clicks are handled by the engine (the default setting) the proper cursor mode to pick up an inventory item is eModeInteract.
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Zany on Wed 11/10/2017 12:10:50
Okay checked those and it all looks in order...

I'm using this:
function repeatedly_execute() {
 
  if (IsGamePaused() == 1) return;
 
  UpdateMouseGraphic();
  CustomizeIconBar();
 
  int mm = mouse.Mode;
  int nm; // newMode
 
  Hotspot *h;
  Object *o;
 
  int lt = GetLocationType(mouse.x,  mouse.y);
 
  if (nm != eModeUseinv){
    if(lt == eLocationNothing) nm = eModeWalkto;
      if(lt == eLocationHotspot){
        h = Hotspot.GetAtScreenXY(mouse.x,  mouse.y);
        nm = h.GetProperty("def_curs");
      }
      if(lt == eLocationObject){
        o = Object.GetAtScreenXY(mouse.x,  mouse.y);
        nm = o.GetProperty("def_curs");
      }
      if(lt == eLocationCharacter){
        nm = eModeTalkto;
      }
      if(nm != mm)mouse.Mode = nm;
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: dayowlron on Wed 11/10/2017 15:10:37
could be wrong but I think your testing new mode whether is it eModeUseinv. If you just change that line to:
if (mm != eModeUseinv){
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Zany on Thu 12/10/2017 08:52:30
Thank You that worked (nod)
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Khris on Thu 12/10/2017 14:08:24
That code looks suspiciously like something I may have written; did you get that from the forum? Because if that error is in the original code, I'd like to fix it.
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Mandle on Thu 12/10/2017 14:40:32
Quote from: Khris on Thu 12/10/2017 14:08:24
That code looks suspiciously like something I may have written; did you get that from the forum? Because if that error is in the original code, I'd like to fix it.

Is it this one:

http://www.adventuregamestudio.co.uk/forums/index.php?topic=46959.msg631494#msg631494

Probably not but kind of on the right track maybe?
Title: Re: Cursor Modification wont allow me to use inventory item
Post by: Zany on Fri 13/10/2017 08:58:02
Yes I did get the code from the forum lolz and yes you did post it previously, your code is really helpful. Thanks