gms_session_create

Usage: gms_session_create ( type )

Description

Creates a new session, and the player calling this action will be put in that session. type can be a value ranging from 0 to 255. This function will be executed asynchronously. When the new session-information has been received, the script set by gms_script_set_session_change will be called.

When the player joins a new session, communication with other players is impossible. For more info, see de vs mode

Replies (6)

Last message on 27 Dec 2017

TheLandimizer on 24 Dec 2017, 19:05:42
Hey Size43,

I've been trying to make sessions work for a while now and I'm still confused on how they fully work.
I have a system where the player types in a value ranging from 1-255, then creates a lobby with that power.
I then have a system where it displays your current session ID.
But when I try to have another player join that session ID, it says it doesn't exist.
Any suggestions?
Size43 (Administrator) on 24 Dec 2017, 19:47:51
Can you post the code that you're using for joining and creating the sessions?

I'm working on updating the session tutorial to something more useful, you should see that show up at some point in the near future.
TheLandimizer on 24 Dec 2017, 21:35:05
Hey Size43,

Yeah, I'd be happy to! I'm also looking forward to the session tutorial.
I have two objects, one is for if the player wants to create a session.
After they press ENTER after typing in a type, this code is initiated:

lobby = keyboard_string;
gms_session_create(lobby);

They are then sent to a point where it draws the current session ID on the screen so they can send it to their friends. The friend types in the session ID with a different object, and after they press ENTER, this code is initiated:

gms_session_join(keyboard_string);

But if the person who creates it is in a lobby, and the player joining joins that lobby, then it gives me an error saying the session doesn't exist.
Any suggestions?
Size43 (Administrator) on 25 Dec 2017, 14:41:59
keyboard_string is a string, which I suspect is not being converted to a number properly. Try explicitly converting it by changing it to real(keyboard_string).
TheLandimizer on 27 Dec 2017, 02:05:53
Hey Size43,

Hmmm, that didn't seem to work. The session error is still happening.
If you're out of ideas, I can wait for the new session tutorial to be released and
just go off of there when you're ready.
Size43 (Administrator) on 27 Dec 2017, 13:25:14
I'll add some debugging info to the error message in the update that'll be released later today. That should make figuring out the issue easier.