I need a function similar to "function resume_game ()" and "function start ()", but only activate when a client joins a server .... something like "function client_start ()" ... is to show the scenario sale every time a player starts.
example:
function client_start()
{
gui.open_info_win_at("goal")
}
You could use resume_game. Is this not working?
The documentation for resume_game() says "This function is called when a savegame with active scenario is loaded.". Is there a guaranteed 1 to 1 relationship between loading a save game and joining a server?
Quote from: Dwachs on February 22, 2018, 05:32:47 PM
You could use resume_game. Is this not working?
I have tried with:
gui.open_info_win_at("goal")I'm afraid it does not work. :-[
You can test my script here:
Sorry for the wrong information: of course, any open_info_win works only locally at the server.
Quote from: jameskuyper on February 22, 2018, 05:46:09 PM
Is there a guaranteed 1 to 1 relationship between loading a save game and joining a server?
In terms of the game state: yes, but not in terms of gui.
Quote from: Dwachs on February 22, 2018, 08:01:46 PM
Sorry for the wrong information: of course, any open_info_win works only locally at the server.
Too bad, it would be good if each player could see the script rules at the moment of starting.
Edit:
Now I see it, the function is executed, but the window is shown only on the server.
Quote from: Dwachs on February 22, 2018, 05:32:47 PM
You could use resume_game. Is this not working?
It would be good for clients to use a different function, in my humble opinion. ;)
I could modify the open_info_win function to open the window for all clients. Also somehting like open_info_win_player(player_nr) which opens the window only if clients are allowed to play with the given player/company.
One could also always open the scenario window if a savegame with scenario is loaded.
What do you think?
Quote from: Dwachs on February 24, 2018, 10:47:01 AM
I could modify the open_info_win function to open the window for all clients. Also somehting like open_info_win_player(player_nr) which opens the window only if clients are allowed to play with the given player/company.
One could also always open the scenario window if a savegame with scenario is loaded.
What do you think?
Thank you so much ;D ...
I like this function "open_info_win_player (player_nr)", but I would also like to indicate the tab, something like "open_info_win_player (player_nr, goal)"
I added a function open_info_win_client, which does the job:
http://dwachs.github.io/simutrans-sqapi-doc/classgui.html#a407dd8f68eca07a61ddc3f5dd25391e3
also all the open_info_win functinos now open the window on server & clients.
thank you very much !!. ;D ;D
It seems that something is wrong, clients do not show the scenario window. :-[
Another detail, I noticed a lot of deicronization compared to the last time I did tests, is something causing problems ?. ???
It is only shown on clients that are connected when another joins. Should be fixed in r8395
Quote
player_nropens scenario info window on all clients that have this player unlocked.
I thought the player number was to show scenario window only if the client is using that player. :o