[SOLVED!] @Overhotspot@ appears when changing dialogues

Started by Ali, Wed 27/04/2011 21:22:51

Previous topic - Next topic

Ali

Hi,

I'm compiling Nelly Cootalot in AGS 3.2.1, and I've noticed a bug which I don't think used to occur in the old version of the game.

If the mouse is over a character/object/hotspot at the point when the game goes back to the dialogue options, the @overhotspot@ GUI appears, and then stays on the screen. Weirdly, it disappears if I move the mouse over the menu buttons, though I can't see any reason for that in the script.

I can switch the @overhotspot@ GUI off when the dialogue GUI is visible in rep_execute_always, but I can't think of a reliable way of switching it back on when the dialogue ends. Any suggestions?

Thanks!

- Ali

Calin Leafshade

just set the value in rep_ex_always

I actually prefer doing that because i have more control.

Check if the script is blocking (use a bool and set it in rep_ex and rep_ex_always) and if it is then hide the label.

Ali

Sorry, I can't work out how to check if the script is blocking. If I set the same bool in rep_ex and rep_ex_always, the latter always overides the former.

Also, will your suggestion allow other scripts to switch the GUI off during a non-blocking event?

Ryan Timothy B

Quote from: Calin Leafshade on Wed 27/04/2011 21:27:30
Check if the script is blocking (use a bool and set it in rep_ex and rep_ex_always) and if it is then hide the label.
That's quite redundant, as AGS already has a bool that tells you if the game is blocking.

Ali, check out:
Code: ags
IsInterfaceEnabled()

Calin Leafshade

Like this:

Code: ags

bool Blocking;

function repeatedly_execute(){


  Blocking = false; // this goes *last*
}

function repeatedly_execute_always() 
{
  gGui.Visible = !Blocking; //set the visibility
  Label1.Text = Game.GetLocationName(mouse.x, mouse.y);

  Blocking = true; // this goes *last*
}



Since rep ex always comes first in the order it looks like this:

if blocking:
start of rep_ex_always() -> blocking is false from the previous rep_ex
end of rep_ex_always() -> Blocking = true;
rep_ex() doesnt run because its being blocked so Blocking remains as true;
start of rep_ex_always() -> blocking is now true because the previous rep_ex didnt set it to false;

EDIT: Or whatever RT said.. but i like to be different wherever possible.

Ali

#5
Sorry, it's been a while since I've scripted in AGS... Thanks for the help!

Maybe this should be in the Beginners' forum, but I still have a question: How can I switch the hotspot GUI back on without overriding other scripts which might want to switch it off?


EDIT: I think I worked it out.. Sorry again!

Code: ags
if (IsInterfaceEnabled()==false){
  if (gHotspot.Visible) gHotspot.Visible=false;
}
else if (gHotspot.Visible == false  && hidingHotspot == false) gHotspot.Visible=true;

Calin Leafshade

urgh why is everyone checking shit all of a sudden?

Code: ags

gHotspot.Visible = IsInterfaceEnabled();


You don't need to check if something is not visible if you're just going to make it invisible if its not already.

Code: ags

if (gGui.Visible == false) gGui.Visible = true;
//is the same as
gGui.Visible = true;

Ali

The first bit of code is one of those clever bits of script I don't know about until someone points out.

The second bit... well I can't help but imagine the game is working less hard my way. I'm saying, "Hey AGS, don't be switching that GUI off all the time. Just check if it's on and switch it off, if not relax. You're doing a great job."

Hopefully that quote should put my programming knowledge in context.

Khris

Quote from: Ali on Thu 28/04/2011 00:34:41The second bit... well I can't help but imagine the game is working less hard my way.

AGS isn't some guy in an office who has to look up the file first :=
Seriously, the check makes AGS work even harder.

Ali

WAIT! I just remembered the reason for my seemingly crazy code.

Running the command constantly prevented SkipUntilCharacterStops from working for some reason. I'm not sure why, now that I think about it...

SMF spam blocked by CleanTalk