[SOLVED] on_mouse_click never called?

Started by Monsieur OUXX, Mon 13/01/2014 15:01:26

Previous topic - Next topic

Monsieur OUXX

I have that game with a lot of custom scripts.
So far it worked like a charm.

I've toyed around with some cutscene that was already there and worked well. I've mainly changed the sequence of rooms the main character goes through during the cutscene; during the cutscene the main character changes several times (I use "setAsPlayer" back and forth) and he goes through 3 rooms.

ISSUE: At the end of the cutscene, the last room fades-in correctly, BUT then it's like the mouse clicks are not caught. I added Display("click"); in the global script's on_mouse_click, and it's never called when I click in-game.

Note that:
-  I didn't use ClaimEvent anywhere.
- The game is not hanging (the cursor is animated and the label showing what hotspot is under the mouse gets properly updated when I move the mouse around. That calculation is done in repeatedly_execute_always).
- The game works OK in any other room.
- It's not a missing "EndCutscene": I've tried to add one, and the game crashes with "there is no cutcene going on so don't call EndCutscene, you jackass" (more or less). 
- The player character is on a walkarea (I even added a player.placeOnWalkarea(); to be sure).

What on earth could block a "Display" comment on the first line of on_mouse_click???
 

Gilbert

During a cutscene, the engine is blocked and on_mouse_click() will not be executed. Are you sure the cutscene has ended? Instead, you need to check IsButtonDown() on whether a button is clicked, like in repeatedly_execute_always().

Monsieur OUXX

Quote from: Iceboty V7000a on Mon 13/01/2014 15:58:57
During a cutscene, the engine is blocked and on_mouse_click() will not be executed. Are you sure the cutscene has ended? Instead, you need to check IsButtonDown() on whether a button is clicked, like in repeatedly_execute_always().

Thanks for the tip, I'll keep searching.
 

Monsieur OUXX

The symptoms seem to point at the game being in a cutscene (as I said the game is not blocked: in repeatedly_execute_always I can test mouse.IsButtonDown(eMouseLeft) and it works -- but the game loop never enters on_mouse_click).

However in repeatedly_execute_always I test the value of Game.InSkippableCutscene (I display its value in the status bar using Status.Text=String.Format("incutscne=%d", Game.InSkippableCutscene);) ... And it says it's worth 0. So the game is definitely not in a cutscene.

Any idea on what other situation could give similar symptoms?

 

Khris

Did you use DisableInterface()?
Try displaying IsInterfaceEnabled().

Monsieur OUXX

Quote from: Khris on Mon 13/01/2014 23:20:14
Did you use DisableInterface()?
Try displaying IsInterfaceEnabled().

There are indeed functions doing DisableInterface() in my code, but normally I do EnableInterface() just a few instructions before the issue occurs. But you're right, I'll test just in case.
 

Khris

Just like with Start/EndCutscene(), each DisableInterface() call has to be countered with a corresponding EnableInterface(). Using it once after several DisableInterface() calls isn't enough.

Think of it like a variable that gets in/decreased by 1 with each call; you have to bring it back down to zero.

Monsieur OUXX

Alright, that was it. There was one too many DisableInterface(); somewhere.

Now that's quite mysterious. I've used that set of custom scripts for months without touching it, it was quite rock-solid. And suddenly there's an issue only in this room. I'll have to dig deep to find the original cause! But that's my business :)

Thanks Iceboty and Khris! Problem solved!
 

SMF spam blocked by CleanTalk