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

Discussion in 'Programming' started by Chris Livermore, Jan 16, 2020.

  1. Chris Livermore

    Chris Livermore Member

    Aug 1, 2019
    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:
    The above ows not even display in the forums but it has a character with a complete square.
    I belive its called a :

    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:
      game.GameID = "A2234235";
    SendPacketToPlayer(sock, CMD_GAME_INFO, sock, game.GameID);
    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
        case CMD_GAME_INFO:
            buffer_write(buffer, buffer_text, argument3); // I have also tried buffer_string (incase you wondered...)
    network_send_packet(argument0, buffer, buffer_tell(buffer));

    and recieving:
    var newid = buffer_read(buffer, buffer_string);
  2. FrostyCat

    FrostyCat Member

    Jun 26, 2016
    Before you read the string, did you read as buffer_u8 exactly 3 times?
  3. Chris Livermore

    Chris Livermore Member

    Aug 1, 2019
    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.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice