Usage: gms_script_set_session_change ( script_id )


Sets the script that will be called when the player's session_id changes.

The script script_id should take 1 argument.
1: The new session_id

Replies (3)

Last message on 10 May 2018

muniznico on 10 May 2018, 19:37:43
Hi Size,

I have a problem. i have set a simple script to handle a session change.

//in GMS object


var new_id = argument0;
if(new_id != gms_session_current_id()){
session_type = gms_session_type(new_id);
if(session_type == 1){
room_transition = instance_create(0,0,obj_screen_transition);
room_transition.next_room = rm_wait_screen;
else if(session_type == 0){
room_transition = instance_create(0,0,obj_screen_transition);
room_transition.next_room = rm_main_menu;

but when i call :


the script always pass by the "session_type == 0" case...
But after that, i check the session type (with a show_message), and it returns 1.

I can't handle session creation because of that.
Can you help me please ?
Dublann on 15 Mar 2017, 20:06:23
Hi Size,

To use it, should be like this?
somewhere in the code


Because it is connected to a random session id instead of the session 1.

Size43 (Administrator) on 22 Mar 2017, 18:50:20
Session IDs are random, you can only change the session type (when creating a new session).