• 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!

GameMaker Comparing 2 strings (1 sent through a packet) Seemingly identical but for one thing...

C

Chris Livermore

Guest
Im having a bit of a nightmare trying to figure this one out... I could take the quick approch and trim the string down but im fairly new and like to undertsna dmy problems....

I have a server that sends a String to the client, the client then stores the string and uses this for all future comms with the sever to authenticate...

the issue im having is when the client recieves the string it comes out like this:
Code:
"A2234235"
The above ows not even display in the forums but it has a character with a complete square.
I belive its called a :
U+25A1

Now im not even sure what the square represents. It does not display int he GMS debugger (thus its taken me an hour just to figure out something is there...

now my Sending code is this:
Code:
  game.GameID = "A2234235";
SendPacketToPlayer(sock, CMD_GAME_INFO, sock, game.GameID);
Code:
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, PACKET_KEY)
buffer_write(buffer, buffer_u8, argument1);//WHAT WE ARE SENDING
buffer_write(buffer, buffer_u8, argument2);//player id
switch(argument1)
{
    case CMD_GAME_INFO:
        buffer_write(buffer, buffer_text, argument3); // I have also tried buffer_string (incase you wondered...)
    break;
}

network_send_packet(argument0, buffer, buffer_tell(buffer));


and recieving:
Code:
var newid = buffer_read(buffer, buffer_string);
 
C

Chris Livermore

Guest
I di yes, I actually got this solved.... I was using the script as above but sorgetting to read a second line of buffer_u8 so my string was reading the int and the string.... thus getting the wird stuff at the beggining, one tip to all those doign networking is make sure you are reading each line and if its not required just do a buffer_read(buffer, U8/string/etc) to discard it.
 
Top