News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Pause button issues in tutorial

Started by Yona-TYT, October 17, 2020, 05:56:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT


Pausing the game is causing a malfunction when building objects.

I can solve this with a boolian function that lets me know if the game is paused.

example:
is_pause ()

Dwachs

If the game is paused the script is paused also. What exactly is the malfunction?
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Quote from: Dwachs on October 18, 2020, 09:26:32 AMIf the game is paused the script is paused also. What exactly is the malfunction?
The "is_work_allowed_here" function keeps working even if the game is paused.
What I want to do is show a warning message that says "Advance is not allowed with the game paused." Every time the player tries to use a tool with the game paused, is it possible to do this?.

Dwachs

Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Great, it works as expected, thank you very much!.  8)

There is a problem that I could not notice at first, using "debug.is_paused ()" causes simutrans to pause, this should not happen. :-[ 

Dwachs

will fix tonight.
In  script/api/api_control.cc line 90 replace pause_game by is_game_paused
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Quote from: Dwachs on October 19, 2020, 06:54:27 AM
will fix tonight.
In  script/api/api_control.cc line 90 replace pause_game by is_game_paused
Excellent, now it works perfect. :)


I want to do an experiment, is it possible to do the same with the underground view tool ?, so I can try to fix a small problem in the underground constructions.

bool is_game_paused()
{
tool_pause_t t;
return t.is_selected();
}