How to get hotspot text properties

Started by bx83, Fri 31/03/2017 00:48:10

Previous topic - Next topic

bx83

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.

Code: ags

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?

dayowlron

#1
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:
Code: ags
  
        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.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

bx83


SMF spam blocked by CleanTalk