Overhotspot label stays on screen when using an inv item on an object (SOLVED)

Started by ManicMatt, Thu 26/04/2018 16:00:46

Previous topic - Next topic

ManicMatt

I am using the verb coin system. When I click, for example, look at locker, the overhotspot label disappears, which is how I like it. But for some reason,when using an inventory item, the label remains, which I don't like. One way i found to get rid of it, is in the code below. But to enter this every single time is a lot of extra work, when I get the feeling it can be permanently adjusted in the verb coin script to hide the label everytime, until the commands have stopped? But I don't want to go messing with it without knowing what i'm doing. If anyone can help, thanks.


Code: ags

function Locker_UseInv()
{
if (player.ActiveInventory == SmKey) 
  {

gOverhotspot.Visible = false;
cEgo.Walk(74, 161, eBlock);
cEgo.FaceLocation(cEgo.x, 50);
cEgo.Think("I tried using the key in the locker.");
cEgo.ChangeView(8);
cEgo.Animate(3, 2, eOnce, eBlock);
cEgo.ChangeView(1);
gOverhotspot.Visible = true;
}

Crimson Wizard

I've recently answered a similar question, maybe will work in your case too:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=55979.0

Other than that general solution, I guess you may find where ProcessClick is called in whatever UI module you are using, and put gOverhotspot.Visible = false before ProcessClick, and gOverhotspot.Visible = true after ProcessClick. That would cover at least the user actions.

ManicMatt

There's several times in the script where it says ProcessClick, but that will certainly narrow it down! I'll have a look. (It's the Curse of Monkey Island UI.)

UPDATE:

Unless I misunderstood you, putting visibilty before and after process click made no difference, because it would instantly become visible again. I looked at the repeatedly execute method, and that would cause it to be permanently invisible, because both would be running at the same time, so it would be telling the game to make it both invisible and visible whilst freely moving the cursor around.

HOWEVER:

Taking inspiration from that I figured I need the engine to check if it is being blocked, and I found an old thread from 2007! Here is how it's been inserted into my script. Just hope it doesn't cause any unexpected problems but I can always just remove that piece of code.

Code: ags
function repeatedly_execute_always()
{
if ( ! IsInterfaceEnabled() )gOverhotspot.Visible = false;

}

function repeatedly_execute()
{
gOverhotspot.SetPosition(mouse.x-95, mouse.y-46);
gOverhotspot.Visible = true;
}

Crimson Wizard

Oh, maybe I put that wrongly, anyway you did exactly what should be done.


SMF spam blocked by CleanTalk