Guest Login Code

Posted by BigWhomas
I'm currently trying to set up a guest login system for my new chat environment OpenChat.

[This code is in the create event of obj_guest_login]

randomize();
guest = ("guest_ ")
firstname = choose(nut,apple,koala,crocodile,elephant,snake)
surname = choose(peach,cucumber,orange,anteater,daisy,sunflower)
number = random_range(1,1000)
name = string(guest) + "" + string(firstname) + " " + string(surname) + " " + string(number);
gms_login_execute(0)
gms_login_set_username (name)

This is the code I have so far, but when it takes the user into a chat room, they do not have a username and if they try and send a message the game crashes. Any ideas?

Replies (6)

Last message on 1 Apr 2019

Size43 (Administrator) on 25 Mar 2019, 22:58:33
You need to call gms_login_set_username before calling gms_login_execute. Also, you must specify a valid script as the first argument to gms_login_execute.
BigWhomas (Topicstarter) on 26 Mar 2019, 00:44:55
Ayy, ty for the reply :D what do you mean by valid script? Like is there no way it could be left empty?
Size43 (Administrator) on 1 Apr 2019, 17:05:53
Looks like you can use -1 to leave it empty.
BigWhomas (Topicstarter) on 1 Apr 2019, 19:36:54
Ive fixed the error, thanks for the help and for making this api :D
BigWhomas (Topicstarter) on 1 Apr 2019, 19:12:43
Ok, so I've got it allowing for guest names but when I try and enter a message this error appears:

ERROR in
action number 1
of Step Event0
for object obj_server:

SERVER ERROR:Action Chat cannot be executed when not logged in

Please note: This is a server-sided error message. To disable all GameMaker Server-errors, call gms_debug_hide_errors().
at gml_Script_XServer_error (line 3) - show_error(argument0, false);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_XServer_error (line 3)
called from - gml_Script_gms_step (line 171) - XServer_error(gms_action_get_argument_string(0));
called from - gml_Object_obj_server_StepNormalEvent_1 (line 1) - gms_step()
BigWhomas (Topicstarter) on 1 Apr 2019, 18:42:53
Thanks :D