• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Need help please!

J

Jordan Clark

Guest
I need help fixing lines 45 and 75 they are highlighted in red! I dont know what is going wrong but they are calling on macros to run the line of code maybe its something with the macros i have no idea. I am new to game maker please help!

THIS WAS THE ERROR:
Final Compile...Error : gml_Script_server_handle_message(45) : Token is undefined at CompileStatement
Error : gml_Script_server_handle_message(75) : Token is undefined at CompileStatement


///server_handle_message(socket_id, buffer);

var
socket_id = argument0,
buffer = argument1;
clientObject = clientmap[? string(socket_id)].client_id
client_id_current = clientObject.client_id;

while(true)
{

var
message_id = buffer_read(buffer, buffer_u8);

switch(message_id)
{

case MESSAGE_MOVE:

var
xx = buffer_read(buffer, buffer_u16);
yy = buffer_read(buffer, buffer_u16);

buffer_seek(send_buffer, buffer_seek_start, 0);
buffer_write(send_buffer, buffer_u8, MESSAGE_MOVE);
buffer_write(send_buffer, buffer_u16, client_id_current);
buffer_write(send_buffer, buffer_u16, xx);
buffer_write(send_buffer, buffer_u16, yy);


with(oServerClient){

if(client_id != client_id_current){
network_send_raw(self.socket_id, other.send_buffer, buffer_tell(other.send_buffer));
}


}

break;
}

if(buffer_tell(buffer) == buffer_get_size(buffer)){
break;
case MESSAGE_JOIN:

username = buffer_read(buffer,buffer_string);
clientObject.name = username;

buffer_seek(send_buffer, buffer_seek_start, 0);
buffer_write(send_buffer, buffer_u8, MESSAGE_JOIN);
buffer_write(send_buffer, buffer_u16, client_id_current);
buffer_write(send_buffer, buffer_string, username);

//sending the newly joining name to all other clients
with(oServerClient){
if(client_id != client_id_current){
network_send_raw(self.socket_id, other.send_buffer, buffer_tell(other.send_buffer));
}
}

//send the newly joined client the name of all other clients
with(oServerClient){
if(client_id != client_id_current){
buffer_seek(other.send_buffer, buffer_seek_start, 0);
buffer_write(other.send_buffer, buffer_u8, MESSAGE_JOIN);
buffer_write(other.send_buffer, buffer_u16, client_id);
buffer_write(other.send_buffer, buffer_string, name);
network_send_raw(socket_id, other.send_buffer, buffer_tell(other.send_buffer));
}
}


break;
case MESSAGE_SHOOT:

var
shootdirection = buffer_read(buffer, buffer_u16);

server_handle_shoot(shootdirection, clientObject);

break;
}

if(buffer_tell(buffer) == buffer_get_size(buffer)){
break;
}

}
 

jo-thijs

Member
Hi and welcome to the GMC!

Those cases are put outside of the switch body.
I'm thinking you miscounted the amount of { } brackets.
 
Top