The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on October 17, 2020, 05:56:46 PM

Title: Pause button issues in tutorial
Post by: Yona-TYT on October 17, 2020, 05:56:46 PM

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 ()
Title: Re: Pause button issues in tutorial
Post by: Dwachs on October 18, 2020, 09:26:32 AM
If the game is paused the script is paused also. What exactly is the malfunction?
Title: Re: Pause button issues in tutorial
Post by: Yona-TYT on October 18, 2020, 09:48:11 AM
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?.
Title: Re: Pause button issues in tutorial
Post by: Dwachs on October 18, 2020, 10:06:10 AM
in r 9303
Title: Re: Pause button issues in tutorial
Post by: Yona-TYT on October 18, 2020, 11:30:41 PM
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. :-[ 
Title: Re: Pause button issues in tutorial
Post by: 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
Title: Re: Pause button issues in tutorial
Post by: Yona-TYT on October 19, 2020, 08:11:20 AM
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();
}