Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ali on Wed 27/04/2011 21:22:51

Title: [SOLVED!] @Overhotspot@ appears when changing dialogues
Post by: Ali on Wed 27/04/2011 21:22:51
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
Title: Re: @Overhotspot@ appears when changing dialogues
Post by: Calin Leafshade on Wed 27/04/2011 21:27:30
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.
Title: Re: @Overhotspot@ appears when changing dialogues
Post by: Ali on Wed 27/04/2011 23:28:06
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?
Title: Re: @Overhotspot@ appears when changing dialogues
Post by: Ryan Timothy B on Wed 27/04/2011 23:33:47
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: IsInterfaceEnabled()
Title: Re: @Overhotspot@ appears when changing dialogues
Post by: Calin Leafshade on Wed 27/04/2011 23:34:42
Like this:


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.
Title: Re: @Overhotspot@ appears when changing dialogues
Post by: Ali on Wed 27/04/2011 23:39:51
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!

if (IsInterfaceEnabled()==false){
 if (gHotspot.Visible) gHotspot.Visible=false;
}
else if (gHotspot.Visible == false  && hidingHotspot == false) gHotspot.Visible=true;
Title: Re: [SOLVED!] @Overhotspot@ appears when changing dialogues
Post by: Calin Leafshade on Thu 28/04/2011 00:15:45
urgh why is everyone checking shit all of a sudden?


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.


if (gGui.Visible == false) gGui.Visible = true;
//is the same as
gGui.Visible = true;
Title: Re: [SOLVED!] @Overhotspot@ appears when changing dialogues
Post by: Ali on Thu 28/04/2011 00:34:41
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.
Title: Re: [SOLVED!] @Overhotspot@ appears when changing dialogues
Post by: Khris on Thu 28/04/2011 02:16:12
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.
Title: Re: [SOLVED!] @Overhotspot@ appears when changing dialogues
Post by: Ali on Thu 28/04/2011 20:53:06
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...