X
XirmiX
Guest
Again... but this time I'm 100% sure it's supposed to retrieve exactly what I tell it to retrieve. Getting this error:
And essentially here, I'm supposed to have the code retrieve a string value. This string value is stored upon a client joining the server, for each client, it's even generated by the server itself. And it's saved as a string:
This string is meant to be retrieved by the server from each already-joined player and sent to the currently joining player. This piece of code only runs if there are 2 or more clients on the server:
I previously had this error outside of the 2-player check thing, but had it when one player joined. That was understandable, since there were no other players, so the server had nothing to retrieve. But since after I changed the code to have this included in the 2-or-more player check statement, it shouldn't be whining about it and should execute it just fine, but for whatever reason, it's not!
Previously I had a similar problem, however, previously, my mistake was that I needed to check for a key and not the key's value. This time, I know I need to check the value, and here it's returning that it's not a string. Now that I think about it, the previous issue wasn't resolved... I simply didn't need the information that I was getting, so as soon as I changed that, everything went hey. But now that I do need it, everything goes haywire. Please help!
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Async Event: Networking
for object obj_connection:
buffer_write argument 1 incorrect type (5) expecting a String (YYGS)
at gml_Object_obj_connection_NetworkingEvent_1 (line 126) - buffer_write(load_buffer, buffer_string, client_id_load);
############################################################################################
############################################################################################
FATAL ERROR in
action number 1
of Async Event: Networking
for object obj_connection:
buffer_write argument 1 incorrect type (5) expecting a String (YYGS)
at gml_Object_obj_connection_NetworkingEvent_1 (line 126) - buffer_write(load_buffer, buffer_string, client_id_load);
############################################################################################
And essentially here, I'm supposed to have the code retrieve a string value. This string value is stored upon a client joining the server, for each client, it's even generated by the server itself. And it's saved as a string:
Code:
//case for the client connecting
case network_type_connect:
//Identify the connecting socket
client_socket_current = async_load[? "socket"];
var client_id = "";
file_id = file_text_open_read("id_picker.txt");
var str = file_text_read_string(file_id);
for(i = 0; i < 8; i++)
{
var j = string_copy(str, irandom(string_length(str)), 1);
client_id += j;
}
file_text_close(file_id);
socket_map[? client_socket_current] = string(client_id);
client_amount = ds_map_size(socket_map);
break;
Code:
//Defining a temporary variable for the buffer number
var buffer_type_write = -3;
//Updating the amount of players that are connected in the client amount variable
client_amount = ds_map_size(socket_map);
//If there are now 2 or more users connected, send data about the new client to other clients
if (ds_map_size(socket_map) >= 2)
{
var client_id_this = ds_map_find_value(socket_map, client_socket_current);
//create a buffer with which to send information
send_buffer = buffer_create(256, buffer_fixed, 1);
//writing data to send to buffer
buffer_seek(send_buffer, buffer_seek_start, 0);
buffer_write(send_buffer, buffer_s8, buffer_type_write);
buffer_write(send_buffer, buffer_string, client_id_this);
buffer_write(send_buffer, buffer_u8, client_amount);
buffer_write(buffer, buffer_f32, xx);
buffer_write(buffer, buffer_f32, yy);
buffer_write(buffer, buffer_f32, angle);
for(i = 0; i < ds_map_size(socket_map); i++)
{
socket_in_use = ds_map_exists(socket_map, i);//ds_map_find_value(socket_map, i);
if(i != client_socket_current)
{
network_send_packet(socket_in_use, send_buffer, buffer_get_size(send_buffer));
}
}
buffer_delete(send_buffer);
//Send data to the about the existing clients to the new client
load_buffer = buffer_create(256, buffer_fixed, 1);
for(i = 0; i < ds_map_size(socket_map); i++)
{
//socket_in_use = ds_map_exists(socket_map, i);
var client_id_load = ds_map_find_value(socket_map, i);
buffer_seek(load_buffer, buffer_seek_start, 0);
buffer_write(load_buffer, buffer_s8, buffer_type_write);
buffer_write(load_buffer, buffer_string, client_id_load);
buffer_write(load_buffer, buffer_u8, client_amount);
buffer_write(load_buffer, buffer_f32, xx);
buffer_write(load_buffer, buffer_f32, yy);
buffer_write(load_buffer, buffer_f32, angle);
if(i != client_socket_current)
{
network_send_packet(client_socket_current, load_buffer, buffer_get_size(load_buffer));
}
}
}
Previously I had a similar problem, however, previously, my mistake was that I needed to check for a key and not the key's value. This time, I know I need to check the value, and here it's returning that it's not a string. Now that I think about it, the previous issue wasn't resolved... I simply didn't need the information that I was getting, so as soon as I changed that, everything went hey. But now that I do need it, everything goes haywire. Please help!