There might be a bug...(solved)

___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:

buffer_read argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at gml_GlobalScript_recieved_packet (line 3) - msgid = buffer_read(buffer,buffer_u8);
############################################################################################
gml_GlobalScript_recieved_packet (line 3)

buffer_read and all the buffer types dont work anymore. Watched youtube video and video worked. I copied it verbatim and nothing works.
What do you suggest i do?
 
Last edited:

TsukaYuriko

☄️
Forum Staff
Moderator
Post your code and we'll see.

... the code, that is, since there's not really a lot to see here, and therefore nothing to go by to diagnose issues. ;)


Copied code not working is usually not a sign of a bug, but a sign of using outdated resources assuming/hoping they are still applicable and/or only almost copying code.
 
GML:
buffer = argument0;
socket = argument1;
msgid = buffer_read(buffer,buffer_u8);

switch(msgid)
{
    case 1: //hello world
        var message = buffer_read(buffer,buffer_string);
        show_message(message);
        break;
}
This is the code that wont run. If i disable it, the game works.
 

FrostyCat

Redemption Seeker
That is pre-2.3 script syntax. You need to use post-2.3 syntax from now on.
GML:
function received_packet(buffer, socket)
{
    msgid = buffer_read(buffer, buffer_u8);
    switch (msgid)
    {
        case 1: //hello world
            var message = buffer_read(buffer, buffer_string);
            show_message(message);
            break;
    }
}
 
Top