Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: BrightBulb on Sat 05/05/2012 19:08:30

Title: Way to check if mouse is invisible due to blocking action? [Solved]
Post by: BrightBulb on Sat 05/05/2012 19:08:30
Hi everyone,

simliar to Lucasarts games I have a status line that shows what is currently under the cursor and which action will be executed on mouse click (i.e. open door when cursor is over a door). When a (blocking) action is executed the mouse cursor dissappears (which is fine).

Now what I want is to make the status line invisible as well, as long as the (blocking) action is executed. I tried checking mouse.visible=false but this seems only to work if set manually.

Any ideas?
Title: Re: Way to check if mouse is invisible due to blocking action?
Post by: on Sat 05/05/2012 19:17:26
A very simple way is to put this into repeatly_execute_always:


LABELNAME.Text = "";


This will set your action text line to blank each turn, even when a blocking action is taking place. If a non-blocking action takes place the text will be set to blank but almost instantly be reset to what's under the mouse. It's quick and dirty, but should work.
Title: Re: Way to check if mouse is invisible due to blocking action?
Post by: BrightBulb on Sat 05/05/2012 19:27:13
Thanks for the quick answer.

But not the status line is always invisible.
Title: Re: Way to check if mouse is invisible due to blocking action?
Post by: on Sat 05/05/2012 19:42:47
Yes, my bad. Move the line to the TOP of repeatedly_execute, that should do the trick.

If not, I am at a loss and sorry!
Title: Re: Way to check if mouse is invisible due to blocking action?
Post by: BrightBulb on Sat 05/05/2012 19:48:37
It ist the repeatedly_execut loop where I write the status line label. Thus erasing ("") it there won't work.

But thanks anyway.
Title: Re: Way to check if mouse is invisible due to blocking action?
Post by: monkey0506 on Sat 05/05/2012 23:34:08
I was just doing some testing and although rep_ex_always is called each loop before rep_ex, it seems that the label won't update properly...

There is, however, a simple way to check if a blocking function is running:

Quote from: ManualIsInterfaceEnabled()

Returns 1 if the player interface is currently enabled, 0 if it is disabled. The user interface is disabled while the cursor is set to the Wait cursor - ie. while the character is performing a blocking Walk, or other blocking action.

So you could put in rep_ex_always:

  if (!IsInterfaceEnabled()) lblStatusline.Text = "";

That will clear the label during a blocking function, without interfering with your other code in rep_ex.
Title: Re: Way to check if mouse is invisible due to blocking action?
Post by: BrightBulb on Sat 05/05/2012 23:56:20
Thanks,

that was exactly the command I was looking for.