Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: bx83 on Fri 31/03/2017 00:48:10

Title: How to get hotspot text properties
Post by: bx83 on Fri 31/03/2017 00:48:10
Hello all

I've set a custom propery for hHotspot5, in room 2. I have a function in globalscript which checks the mouse cursor, and updates it due to it's location.
I have a custom property for hotspots called "hidden", which is a bool; on one hidden hotspot, I've made it true - all others false.


function UpdateMouseGraphic ()
{
  int newGraphic;
  int lt = GetLocationType(mouse.x, mouse.y);
  [b]bool hidden = hotspot[4].GetProperty("hidden");[/b]

  if (player.ActiveInventory != null) return;

  if (mouse.Mode==eModeWalkto) {
    newGraphic=2054;
  }
  else if (mouse.Mode==eModeLookat) {
    newGraphic=105; //eye closed
    [b]if (lt == eLocationHotspot) {
      if (hidden==false) {
        newGraphic=2056;    //eye open
      }[/b]
    }
  }
  else if (mouse.Mode==eModeInteract) {
    newGraphic = 286;  //interact
    if (lt == eLocationObject) {
      newGraphic = 2;
    }
  } 
  else if (mouse.Mode==eModeTalkto) {
    newGraphic = 2058;  //talk
    if (lt == eLocationCharacter) {
      newGraphic = 213;
    }
  } else {
   
  }

  if (newGraphic != mouse.GetModeGraphic(mouse.Mode)) {
    mouse.ChangeModeGraphic(mouse.Mode, newGraphic);
  }
}


The bolded lines are the ones of interest.
I want the eye to be open when over a not-hidden hotspot; and closed not over a hotspot, OR a hidden one.
I've tried both hotspot[5] and hotspot[4] (zero index); neither works. Is the correct way to acces them, for the current room? How does it handle different rooms?

On hotspot[4], it seems to work, but the eye opens on hidden=true hotspots.
On hotspot[5], all hotspots are =true, so the eyes never open.

What am I doing wrong?
Title: Re: How to get hotspot text properties
Post by: dayowlron on Fri 31/03/2017 01:34:11
the one thing I see is you are always setting hidden equal to whatever hotspot 4 has in its hidden property and not the hotspot that the cursor is over.
Give me a little time and I can tell you what to change it to.
the first bold spot remove it.

the other bold area:
 
        if (lt == eLocationHotspot) {
            Hotspot* hs=Hotspot.GetAtScreenXY(mouse.x, mouse.y);
            if (hs.GetProperty("hidden")==false) {
                newGraphic=2056;    //eye open
            }


This is untested but you need to do something like this.
Title: Re: How to get hotspot text properties
Post by: bx83 on Fri 31/03/2017 02:05:37
It works, thankyou :D