Way to check if mouse is invisible due to blocking action? [Solved]

Started by BrightBulb, Sat 05/05/2012 19:08:30

Previous topic - Next topic

BrightBulb

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?

Ghost

A very simple way is to put this into repeatly_execute_always:

Code: ags

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.

BrightBulb

Thanks for the quick answer.

But not the status line is always invisible.

Ghost

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!

BrightBulb

It ist the repeatedly_execut loop where I write the status line label. Thus erasing ("") it there won't work.

But thanks anyway.

monkey0506

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:

Code: ags
  if (!IsInterfaceEnabled()) lblStatusline.Text = "";


That will clear the label during a blocking function, without interfering with your other code in rep_ex.

BrightBulb

Thanks,

that was exactly the command I was looking for.

SMF spam blocked by CleanTalk