<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>&lt;undefined&gt;</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</depth>
  <persistent>-1</persistent>
  <parentName>&lt;undefined&gt;</parentName>
  <maskName>&lt;undefined&gt;</maskName>
  <events>
    <event eventtype="0" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>network_set_config(network_config_connect_timeout, 5000);
strict_init(working_directory + "\dictionary.json");
queenHealthResetQueued = false;
canSend = false;
metroidCountChanged = false;
itemChanged = false;
metdeadChanged = false;
eventChanged = false;
mapChanged = false;
itemstakenChanged = false;
maxmissilesChanged = false;
maxsmissilesChanged = false;
maxpbombsChanged = false;
maxhealthChanged = false;
etanksChanged = false;
mtanksChanged = false;
stanksChanged = false;
ptanksChanged = false;
connected = false;
queenHealthWait = false;
queenDead = false;
sameRoom = false;
queenHealth = global.mod_queenHstart + (global.mtanks * 10);
phase = 0;
maxpbombsTimer = 10;
maxhealthTimer = 10;
etanksTimer = 10;
mtanksTimer = 10;
stanksTimer = 10;
ptanksTimer = 10;
teleportTimer = 180;
disconnectTimer = 900;
pingTimer = 90;
resetTimer = -1;
teleport = false;
noName = false;
state = undefined;
seed = undefined;
var type;
type = network_socket_tcp;

ini_open(working_directory + "\mod_settings.ini");
ipaddress = ini_read_string("ModSettings", "ipaddress", "127.0.0.1");
name = ini_read_string("ModSettings", "displayname", "name");
port = ini_read_real("ModSettings", "port", 64198);
reactorsequence = string_lower(ini_read_string("ModSettings", "reactorsequence", "synced"));
preferredcolor = string_lower(ini_read_string("ModSettings", "preferredcolor", "random"));
showName = string_lower(ini_read_string("ModSettings", "showname", "enabled"));
ini_close();

var nameLength = string_length(name);
if(nameLength &gt; 15){
    name = string_copy(name, 1, 15);
    ini_open(working_directory + "\mod_settings.ini");
    ini_write_string("ModSettings", "displayname", name);
    ini_close();
}

if(string_length(name) == 0){
    noName = true;
    popup_text_ext("Set a name before connecting", 180);
    instance_destroy();
}

socket = network_create_socket(type);
isConnected = network_connect(socket, ipaddress, port);

switch(preferredcolor){
    case "green":
        preferredcolor = 1;
        break;
    case "red":
        preferredcolor = 2;
        break;
    case "blue":
        preferredcolor = 3;
        break;
    case "yellow":
        preferredcolor = 4;
        break;
    case "orange":
        preferredcolor = 5;
        break;
    case "purple":
        preferredcolor = 6;
        break;
    case "pink":
        preferredcolor = 7;
        break;
    case "white":
        preferredcolor = 8;
        break;
    case "random":
        preferredcolor = 9;
        break;
}

switch(showName){
    case "disabled":
        showName = false;
        break;
    case "enabled":
        showName = true;
        break;
}

var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);

global.queenhealthPrev = global.mod_queenHstart + (global.mtanks * 10);;
global.queenphasePrev = 0;


global.prevX = 0;
global.prevY = 0;
global.prevSprite = 0;
global.prevIndex = 0;

global.roomPrev = room;

global.ping = 0;
global.clientID = 0;
global.packetID = 0;
global.receivedPacketID = 0;
global.onlineList = ds_grid_create(3, 20);
global.onlineSend = ds_grid_create(3, 20);
global.onlineItem = ds_list_create();
global.onlineMetdead = ds_list_create();
global.onlineEvent = ds_list_create();
global.onlineReceived = ds_grid_create(3, 20);
roomList = ds_list_create();
roomListData = ds_list_create();
global.idList = ds_list_create();
posData = ds_list_create();
global.hatchlingList = ds_list_create();
ds_grid_clear(global.onlineSend, -1);
ds_grid_clear(global.onlineReceived, -1);
for(var i=0; i&lt;ds_grid_height(global.onlineList); i++){
    ds_grid_set(global.onlineList, 2, i, i);
}

update_variables("initprev");

update_variables("onlinevars");

if(os_type != os_android){
    alpha = 1;
} else {
    alpha = 0.8;
}

posX = 3;
posY = 3;

time = 60;

trail = 0;

//global.icemissiles = 1;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="1" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(connected){
    if(disconnectTimer &gt; 0){
        popup_text("Disconnected");
    } else {
        popup_text("Lost connection to server");
    }
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 254);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 254);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(!noName){
    network_destroy(socket);
    buffer_delete(buffer);
    ds_grid_destroy(global.onlineList);
    ds_grid_destroy(global.onlineSend);
    ds_grid_destroy(global.onlineReceived);
    ds_list_destroy(global.onlineItem);
    ds_list_destroy(global.onlineMetdead);
    ds_list_destroy(global.onlineEvent);
    ds_list_destroy(roomList);
    ds_list_destroy(roomListData);
    ds_list_destroy(global.idList);
    ds_list_destroy(posData);
    ds_list_destroy(global.hatchlingList);
}

global.canConnect = false;
oControl.alarm[10] = 90;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="11">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 101);
buffer_write(buffer, buffer_u8, global.clientID);
buffer_write(buffer, buffer_s16, room);
buffer_write(buffer, buffer_s16, posX);
buffer_write(buffer, buffer_s16, posY);
var bufferSize = buffer_tell(buffer);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_s32, bufferSize);
buffer_write(buffer, buffer_u8, 101);
buffer_write(buffer, buffer_u8, global.clientID);
buffer_write(buffer, buffer_s16, room);
buffer_write(buffer, buffer_s16, posX);
buffer_write(buffer, buffer_s16, posY);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));

if(ds_list_size(posData)){
    
}

alarm[11] = 20;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="10">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(sameRoom){
    if(instance_exists(oCharacter)){
        if(oCharacter.x != global.prevX || oCharacter.y != global.prevY || global.roomPrev != room || global.prevSprite != oCharacter.sprite_index || global.prevIndex != oCharacter.image_index){
            if(global.prevX != oCharacter.x){
                global.prevX = oCharacter.x;
            }
            if(global.prevY != oCharacter.y){
                global.prevY = oCharacter.y;
            }
            if(global.prevSprite != oCharacter.sprite_index){
                global.prevSprite = oCharacter.sprite_index;
            }
            if(global.prevIndex != oCharacter.image_index){
                global.prevIndex = oCharacter.image_index;
            }
            buffer_delete(buffer);
            var size, type, alignment;
            size = 1024;
            type = buffer_grow;
            alignment = 1;
            buffer = buffer_create(size, type, alignment);
            buffer_seek(buffer, buffer_seek_start, 0);
            buffer_write(buffer, buffer_u8, 100);
            buffer_write(buffer, buffer_u8, global.clientID);
            buffer_write(buffer, buffer_s16, oCharacter.x);
            buffer_write(buffer, buffer_s16, oCharacter.y);
            buffer_write(buffer, buffer_s16, oCharacter.sprite_index);
            buffer_write(buffer, buffer_s16, oCharacter.image_index);
            buffer_write(buffer, buffer_s16, oCharacter.aspr1);
            buffer_write(buffer, buffer_s16, oCharacter.asprx);
            buffer_write(buffer, buffer_s16, oCharacter.aspry);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2x);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2y);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2a);
            buffer_write(buffer, buffer_s16, oCharacter.mirror);
            buffer_write(buffer, buffer_s16, oCharacter.armmsl);
            buffer_write(buffer, buffer_s16, room);
            buffer_write(buffer, buffer_string, name);
            buffer_write(buffer, buffer_s16, oCharacter.image_blend);
            buffer_write(buffer, buffer_s8, oCharacter.fxtimer);
            buffer_write(buffer, buffer_s16, global.roomPrev);
            buffer_write(buffer, buffer_s8, oCharacter.state);
            buffer_write(buffer, buffer_s8, oCharacter.speedboost);
            var bufferSize = buffer_tell(buffer);
            buffer_seek(buffer, buffer_seek_start, 0);
            buffer_write(buffer, buffer_s32, bufferSize);
            buffer_write(buffer, buffer_u8, 100);
            buffer_write(buffer, buffer_u8, global.clientID);
            buffer_write(buffer, buffer_s16, oCharacter.x);
            buffer_write(buffer, buffer_s16, oCharacter.y);
            buffer_write(buffer, buffer_s16, oCharacter.sprite_index);
            buffer_write(buffer, buffer_s16, oCharacter.image_index);
            buffer_write(buffer, buffer_s16, oCharacter.aspr1);
            buffer_write(buffer, buffer_s16, oCharacter.asprx);
            buffer_write(buffer, buffer_s16, oCharacter.aspry);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2x);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2y);
            buffer_write(buffer, buffer_s16, oCharacter.aspr2a);
            buffer_write(buffer, buffer_s16, oCharacter.mirror);
            buffer_write(buffer, buffer_s16, oCharacter.armmsl);
            buffer_write(buffer, buffer_s16, room);
            buffer_write(buffer, buffer_string, name);
            buffer_write(buffer, buffer_s16, oCharacter.image_blend);
            buffer_write(buffer, buffer_s8, oCharacter.fxtimer);
            buffer_write(buffer, buffer_s16, global.roomPrev);
            buffer_write(buffer, buffer_s8, oCharacter.state);
            buffer_write(buffer, buffer_s8, oCharacter.speedboost);
            var result = network_send_packet(socket, buffer, buffer_tell(buffer));
            if(global.roomPrev != room){
                global.roomPrev = room;
            }
        }
    }
}
alarm[10] = 3;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="9">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(global.maxsmissilesPrev != global.maxsmissiles){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 12);
    buffer_write(buffer, buffer_u8, global.maxsmissiles);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 12);
    buffer_write(buffer, buffer_u8, global.maxsmissiles);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    maxsmissilesChanged = true;
}

if(!maxsmissilesChanged){
    alarm[9] = 10;
}

if(maxsmissilesChanged){
    maxsmissilesChanged = false;
    alarm[9]= 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="8">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(global.maxmissilesPrev != global.maxmissiles){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 11);
    buffer_write(buffer, buffer_u16, global.maxmissiles);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 11);
    buffer_write(buffer, buffer_u16, global.maxmissiles);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    maxmissilesChanged = true;
}

if(!maxmissilesChanged){
    alarm[8] = 10;
}

if(maxmissilesChanged){
    maxmissilesChanged = false;
    alarm[8]= 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="7">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(global.itemstakenPrev != global.itemstaken){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 10);
    buffer_write(buffer, buffer_u8, global.itemstaken);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 10);
    buffer_write(buffer, buffer_u8, global.itemstaken);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    itemstakenChanged = true;
}

if(!itemstakenChanged){
    alarm[7] = 10;
}

if(itemstakenChanged){
    itemstakenChanged = false;
    alarm[7] = 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="6">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>var v = 0;
if(global.ingame){
    for(var i=0; i&lt;array_height_2d(global.dmap); i++){
        for(var f=0; f&lt;array_length_2d(global.dmap, i); f++){
            if(global.dmapPrev[i, f] != global.dmap[i, f]){
                mapChanged = true;
                break;
            }
        }
    }
}

if(mapChanged){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 9);
    
    var tileCount = 0;
    
    for(var i=0; i&lt;array_height_2d(global.dmap); i++){
        for(var f=0; f&lt;array_length_2d(global.dmap, i); f++){
            if(global.dmapPrev[i, f] != global.dmap[i, f]){
                buffer_write(buffer, buffer_u8, i);
                buffer_write(buffer, buffer_u8, f);
                buffer_write(buffer, buffer_u8, global.dmap[i, f]);
                tileCount++;
            }
        }
    }
    
    buffer_write(buffer, buffer_u16, tileCount);
    buffer_write(buffer, buffer_u8, global.clientID);
    
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 9);
    buffer_write(buffer, buffer_u16, tileCount);
    
    for(var i=0; i&lt;array_height_2d(global.dmap); i++){
        for(var f=0; f&lt;array_length_2d(global.dmap, i); f++){
            if(global.dmapPrev[i, f] != global.dmap[i, f]){
                buffer_write(buffer, buffer_u8, i);
                buffer_write(buffer, buffer_u8, f);
                buffer_write(buffer, buffer_u8, global.dmap[i, f]);
            }
        }
    }
    
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(!mapChanged){
    alarm[6] = 10;
}

if(mapChanged){
    mapChanged = false;
    alarm[6] = 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="5">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>var v = 0;
for(var f=0; f&lt;array_length_1d(global.event); f++){
    if(f &gt; 350){
        break;
    }
    if(f == 102){
        global.eventPrev[f] = global.event[f];
    }
    if(global.eventPrev[f] != global.event[f]){
        global.eventChanges[v, 0] = global.event[f];
        global.eventChanges[v, 1] = f;
        global.onlineEvent[| 0] = global.eventChanges;
        eventChanged = true;
        v++;
    }
}

if(eventChanged){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 8);
    buffer_write(buffer, buffer_string, strict_compress(ds_list_write(global.onlineEvent)));
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 8);
    buffer_write(buffer, buffer_string, strict_compress(ds_list_write(global.onlineEvent)));
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(!eventChanged){
    alarm[5] = 10;
}

if(eventChanged){
    eventChanged = false;
    alarm[5] = 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="4">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>var v = 0;
for(var f=0; f&lt;array_length_1d(global.metdead); f++){
    if(global.metdeadPrev[f] != global.metdead[f]){
        global.metdeadChanges[v, 0] = global.metdead[f];
        global.metdeadChanges[v, 1] = f;
        global.onlineMetdead[| 0] = global.metdeadChanges;
        metdeadChanged = true;
        v++;
    }
}

if(metdeadChanged){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 7);
    buffer_write(buffer, buffer_string, strict_compress(ds_list_write(global.onlineMetdead)));
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 7);
    buffer_write(buffer, buffer_string, strict_compress(ds_list_write(global.onlineMetdead)));
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(!metdeadChanged){
    alarm[4] = 10;
}

if(metdeadChanged){
    metdeadChanged = false;
    alarm[4] = 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="3">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>var v = 0;
for(var f=0; f&lt;array_length_1d(global.item); f++){
    if(global.itemPrev[f] != global.item[f]){
        global.itemChanges[v, 0] = global.item[f];
        global.itemChanges[v, 1] = f;
        global.onlineItem[| 0] = global.itemChanges;
        itemChanged = true;
        v++;
    }
}

if(itemChanged){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 6);
    buffer_write(buffer, buffer_string, strict_compress(ds_list_write(global.onlineItem)));
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 6);
    buffer_write(buffer, buffer_string, strict_compress(ds_list_write(global.onlineItem)));
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(!itemChanged){
    alarm[3] = 10;
}

if(itemChanged){
    itemChanged = false;
    alarm[3] = 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="2">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(global.monstersleftPrev != global.monstersleft){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 4);
    buffer_write(buffer, buffer_s8, global.monstersleft);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 4);
    buffer_write(buffer, buffer_s8, global.monstersleft);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    metroidCountChanged = true;
}

if(global.monstersareaPrev != global.monstersarea){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 5);
    buffer_write(buffer, buffer_s8, global.monstersarea);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 5);
    buffer_write(buffer, buffer_s8, global.monstersarea);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    metroidCountChanged = true;
}

if(!metroidCountChanged){
    alarm[2] = 10;
}

if(metroidCountChanged){
    metroidCountChanged = false;
    alarm[2] = 75;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="1">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(queenHealthResetQueued){
    if(instance_exists(oQueen) &amp;&amp; instance_exists(oQueenHead) &amp;&amp; !is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
        if(global.queenhealthPrev != queenHealth){
            if(queenHealth == 999999){
                queenHealth = 0;
                oQueenHead.myhealth = queenHealth;
                if(queenHealth &lt;= 0){
                    with(oQueenHead){
                        if (myhealth &lt;= 0 &amp;&amp; state != 100 &amp;&amp; state != 50) {
                            if (oQueen.phase &lt; 3) head_damage = 1;
                            if (oQueen.phase == 3) head_damage = 2;
                            if (oQueen.phase &lt; 5) {
                                state = 50;
                                statetime = 0;
                                myhealth = 999999;
                                with (oQueen) {
                                    state = 6;
                                    statetime = 0;
                                }
                            }
                            if (oQueen.phase == 5) {
                                with (oQueen) {
                                    state = 100;
                                    statetime = 0;
                                }
                                state = 100;
                            }
                        }
                    }
                    queenHealth = 999999;
                }
            }
        }
        oQueenHead.myhealth = queenHealth;
        oQueen.phase = phase;
        queenHealthResetQueued = false;
        if(phase &gt;= 1 &amp;&amp; instance_exists(inst_146524)){
            event_perform_object(oQueenFireball, ev_other, ev_user1);
            oQueen.state = 7;
            oQueen.statetime = 0;
            with(oQueen){
                head_target_snap = 1;
                head_target_x = x + neck_x + 10;
                head_target_y = y + neck_y;
            }
        }
        if(phase &gt;= 2 &amp;&amp; instance_exists(inst_146525) &amp;&amp; instance_exists(inst_146520)){
            event_perform_object(oQueenFireball, ev_other, ev_user2);
            oQueen.state = 7;
            oQueen.statetime = 0;
            with(oQueen){
                head_target_snap = 1;
                head_target_x = x + neck_x + 10;
                head_target_y = y + neck_y;
            }
        }
        if(phase &gt;= 3 &amp;&amp; instance_exists(inst_146526) &amp;&amp; instance_exists(inst_146514)){
            event_perform_object(oQueenFireball, ev_other, ev_user3);
            oQueen.state = 7;
            oQueen.statetime = 0;
            with(oQueen){
                head_target_snap = 1;
                head_target_x = x + neck_x + 10;
                head_target_y = y + neck_y;
            }
        }
        if(phase &gt;= 4 &amp;&amp; instance_exists(inst_146527)){
            event_perform_object(oQueenFireball, ev_other, ev_user4);
            oQueen.state = 7;
            oQueen.statetime = 0;
            with(oQueen){
                head_target_snap = 1;
                head_target_x = x + neck_x + 10;
                head_target_y = y + neck_y;
            }
        }
    }
    alarm[1] = 5;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>
update_variables("onlinevars");

for(var i=0; i&lt;ds_grid_height(global.onlineList); i++){
    if(global.onlineList[# 0, i] != global.onlineList[# 1, i]){
        global.onlineSend[# 0, i] = global.onlineList[# 0, i];
        global.onlineSend[# 1, i] = global.onlineList[# 1, i];
        global.onlineSend[# 2, i] = global.onlineList[# 2, i];
        show_debug_message(string(global.onlineList[# 0, i]) + " " + string(global.onlineList[# 1, i]) + " " + string(global.onlineList[# 2, i]));
        canSend = true;
        alarm[0] = 600;
    }
}

if(canSend){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 0);
    buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineSend)));
    buffer_write(buffer, buffer_u8, global.clientID);
    buffer_write(buffer, buffer_u32, global.packetID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 0);
    buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineSend)));
    buffer_write(buffer, buffer_u8, global.clientID);
    buffer_write(buffer, buffer_u32, global.packetID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    show_debug_message("packetID = " + string(global.packetID));
    global.packetID++;
    ds_grid_clear(global.onlineSend, -1);
}

if(!canSend){
    alarm[0] = 10;
}

if(canSend){
    canSend = false;
    alarm[0] = 75;
}

if(instance_exists(oCharacter)){
    check_areaclear();
    if(global.playerhealth &lt;= 0){
        if(oCharacter.state != oCharacter.DEFEATED &amp;&amp; oCharacter.canbehit){
            oCharacter.alarm[0] = 6;
            oCharacter.state = oCharacter.DEFEATED;
            mus_current_fadeout();
            sfx_stop_all();
        }
    }
}

if(instance_exists(oQueen) &amp;&amp; instance_exists(oQueenHead) &amp;&amp; !is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
    if(global.queenhealthPrev != oQueenHead.myhealth || oQueen.phase != phase){
        show_debug_message("queen health sent " + string(oQueenHead.myhealth));
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 2);
        buffer_write(buffer, buffer_s32, oQueenHead.myhealth);
        buffer_write(buffer, buffer_u8, global.clientID);
        buffer_write(buffer, buffer_s8, oQueen.phase);
        buffer_write(buffer, buffer_s8, oQueen.state);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 2);
        buffer_write(buffer, buffer_s32, oQueenHead.myhealth);
        buffer_write(buffer, buffer_u8, global.clientID);
        buffer_write(buffer, buffer_s8, oQueen.phase);
        buffer_write(buffer, buffer_s8, oQueen.state);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    }
}

var itemCount = 0;
for(var h=0; h&lt;array_length_1d(global.item); h++){
    var val = global.item[h];
        if(val == 1 &amp;&amp; h != 1){
            itemCount++;
        }
    }

if(itemCount != global.itemstaken){
    global.itemstaken = itemCount;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="3" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(!connected){
    if(isConnected &gt;= 0){
        connected = true;
        popup_text("Connected");
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 1);
        buffer_write(buffer, buffer_string, name);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 1);
        buffer_write(buffer, buffer_string, name);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        instance_create(x, y, oNametag);
    } else {
        instance_destroy();
        popup_text("Failed to connect");
    }
}

if(instance_exists(oCharacter)){
    if(global.event[203] &lt; 9 &amp;&amp; string_lower(reactorsequence) == "disabled"){
        global.event[203] = 9;
    }
}

if(global.event[103] &gt; 0){
    global.event[103] = floor(global.event[103]);
}

if(global.event[303] &gt; 0){
    phase = 0;
}

if(room == rm_death){
    phase = 0;
    queenHealth = global.mod_queenHstart + (global.mtanks * 10);;
}

if((room == rm_a4b02 || room == rm_a4b03 || room == rm_a4b04 || room == rm_a4b05 || room == rm_a4b06 || room == rm_a4b07 || room == rm_a4b08 || room == rm_a4b09 || room == rm_a4b10 || room == rm_a4b11 || room == rm_a4b12 || room == rm_a4b13 || room == rm_a4b14 || room == rm_a4b15 || room == rm_a4b16 || room == rm_a4b17 || room == rm_a4b18 || room == rm_a4b19) &amp;&amp; global.event[203] &gt; 0 &amp;&amp; global.event[203] &lt; 9 &amp;&amp; !instance_exists(oA4EscapeControl)){
    instance_create(x, y, oA4EscapeControl);
}

if(room == rm_a4b01 &amp;&amp; global.event[203] == 9 &amp;&amp; instance_exists(oA4EscapeControl)){
    with(oA4EscapeControl){
        event_user(0);
    }
}

if(!instance_exists(oQueen) &amp;&amp; global.event[303] == 0){
    if(!queenHealthResetQueued){
        queenHealthResetQueued = true;
        alarm[1] = 5;
    }
}

if(instance_exists(oQueen) &amp;&amp; !is_undefined(oQueen.phase)){
    if(global.event[303] &gt; 0 &amp;&amp; !queenDead){
        with(oQueen){
            state = 100;
            statetime = 0;
            mus_fadeout(musQueen);
            mus_fadeout(musQueen2);
            mus_fadeout(musQueen3);
            mus_fadeout(musQueenBreak);
            mus_fadeout(musQueenIntro);
        }
        queenDead = true;
    }
    if(instance_exists(oQueenHead)){
        with(oQueenHead){
            if(oQueen.phase &gt; 3 &amp;&amp; instance_exists(inst_146527)){
                oQueen.phase = 3;
                if(head_damage == 2){
                    head_damage = 1;
                }
            }
        }
    }
}

if(keyboard_check_pressed(vk_f2)){
    instance_destroy();
}

if(keyboard_check_pressed(vk_f3)){
    popup_text_ext(string(oControl.seed), 300);
}

if(keyboard_check_pressed(vk_f4)){
    showName = -showName;
    if(showName){
        popup_text("Nametags enabled");
    } else {
        popup_text("Nametags disabled");
    }
}

if(instance_exists(oCharacter)){
    posX = global.mapposx;
    posY = global.mapposy;
} else {
    posX = posX;
    posY = posY;
}

if((room == rm_a4b02 || room == rm_a4b03 || room == rm_a4b04 || room == rm_a4b05 || room == rm_a4b06 || room == rm_a4b07 || room == rm_a4b08 || room == rm_a4b09 || room == rm_a4b10 || room == rm_a4b11 || room == rm_a4b12 || room == rm_a4b13 || room == rm_a4b14 || room == rm_a4b15 || room == rm_a4b16 || room == rm_a4b17 || room == rm_a4b18 || room == rm_a4b19) &amp;&amp; global.event[203] == 9 &amp;&amp; !teleport){
    teleport = true;
    global.targetx = 624;
    global.targety = 144;
    room_change(rm_a4b01, 1);
}

if(instance_exists(oCharacter) &amp;&amp; (oCharacter.state == oCharacter.SAVINGFX || oCharacter.state == oCharacter.SAVINGSHIPFX || oCharacter.state == oCharacter.SAVINGSHIP)){
    refill_heath_ammo();
}

//Ensure that reloading a save doesn't disable Extreme Lab Metroids
if(oControl.mod_monstersextremecheck == 1 &amp;&amp; oControl.mod_monstersextreme == 0 &amp;&amp; global.event[302] &gt; 0){
    oControl.mod_monstersextreme = 1;
} else if(oControl.mod_monstersextremecheck == 0 &amp;&amp; oControl.mod_monstersextreme == 1){
    oControl.mod_monstersextreme = 0;
}

//Sends event 309 to make sure all players can fight guardian
if(global.log[21] &gt; 0 &amp;&amp; global.event[309] == 0){
    global.event[309] = 1;
}

if(global.event[309] == 1 &amp;&amp; global.log[21] &lt; 1){
    global.log[21] = 1;
}
//End of guardian event check

if(time == 0 &amp;&amp; connected &amp;&amp; instance_exists(self)){ //why do i need an instance_exists(self) here to not crash???
    if(ds_list_size(global.idList) &gt; 0){
        checkListID = ds_list_create();
        for(var i=0; i&lt;ds_list_size(global.idList); i++){
            var arr = global.idList[| i];
            ds_list_add(checkListID, arr[0, 0]);
        }
        for(var i=0; i&lt;ds_list_size(roomList); i++){
            var ID = roomList[| i];
            var findID = ds_list_find_index(checkListID, ID);
            if(findID &lt; 0){
                ds_list_delete(roomList, i);
            }
        }
        for(var i=0; i&lt;ds_list_size(roomListData); i++){
            var arr = roomListData[| i];
            var findID = ds_list_find_index(checkListID, arr[0]);
            if(findID &lt; 0){
                ds_list_delete(roomListData, i);
            }
        }
        for(var i=0; i&lt;ds_list_size(posData); i++){
            var arr = posData[| i];
            var findID = ds_list_find_index(checkListID, arr[0]);
            if(findID &lt; 0){
                ds_list_delete(posData, i);
            }
        }
        ds_list_destroy(checkListID);
    }
    time = 60;
}

if(maxpbombsTimer == 0 &amp;&amp; connected){
    if(global.maxpbombsPrev != global.maxpbombs){
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 13);
        buffer_write(buffer, buffer_u8, global.maxpbombs);
        buffer_write(buffer, buffer_u8, global.clientID);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 13);
        buffer_write(buffer, buffer_u8, global.maxpbombs);
        buffer_write(buffer, buffer_u8, global.clientID);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        maxpbombsChanged = true;
    }
    
    if(!maxpbombsChanged){
        maxpbombsTimer = 10;
    }
    
    if(maxpbombsChanged){
        maxpbombsChanged = false;
        maxpbombsTimer = 75;
    }
}

if(maxhealthTimer == 0 &amp;&amp; connected){
    if(global.maxhealthPrev != global.maxhealth){
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 14);
        buffer_write(buffer, buffer_u16, global.maxhealth);
        buffer_write(buffer, buffer_u8, global.clientID);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 14);
        buffer_write(buffer, buffer_u16, global.maxhealth);
        buffer_write(buffer, buffer_u8, global.clientID);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        maxhealthChanged = true;
    }
    
    if(!maxhealthChanged){
        maxhealthTimer = 10;
    }
    
    if(maxhealthChanged){
        maxhealthChanged = false;
        maxhealthTimer = 75;
    }
}

if(etanksTimer == 0 &amp;&amp; connected){
    if(global.etanksPrev != global.etanks){
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 15);
        buffer_write(buffer, buffer_u8, global.etanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 15);
        buffer_write(buffer, buffer_u8, global.etanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        etanksChanged = true;
    }
    
    if(!etanksChanged){
        etanksTimer = 10;
    }
    
    if(etanksChanged){
        etanksChanged = false;
        etanksTimer = 75;
    }
}

if(mtanksTimer == 0 &amp;&amp; connected){
    if(global.mtanksPrev != global.mtanks){
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 16);
        buffer_write(buffer, buffer_u8, global.mtanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 16);
        buffer_write(buffer, buffer_u8, global.mtanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        mtanksChanged = true;
    }
    
    if(!mtanksChanged){
        mtanksTimer = 10;
    }
    
    if(mtanksChanged){
        mtanksChanged = false;
        mtanksTimer = 75;
    }
}

if(stanksTimer == 0 &amp;&amp; connected){
    if(global.stanksPrev != global.stanks){
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 17);
        buffer_write(buffer, buffer_u8, global.stanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 17);
        buffer_write(buffer, buffer_u8, global.stanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        stanksChanged = true;
    }
    
    if(!stanksChanged){
        stanksTimer = 10;
    }
    
    if(stanksChanged){
        stanksChanged = false;
        stanksTimer = 75;
    }
}

if(ptanksTimer == 0 &amp;&amp; connected){
    if(global.ptanksPrev != global.ptanks){
        buffer_delete(buffer);
        var size, type, alignment;
        size = 1024;
        type = buffer_grow;
        alignment = 1;
        buffer = buffer_create(size, type, alignment);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_u8, 18);
        buffer_write(buffer, buffer_u8, global.ptanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var bufferSize = buffer_tell(buffer);
        buffer_seek(buffer, buffer_seek_start, 0);
        buffer_write(buffer, buffer_s32, bufferSize);
        buffer_write(buffer, buffer_u8, 18);
        buffer_write(buffer, buffer_u8, global.ptanks);
        buffer_write(buffer, buffer_u8, global.clientID);
        var result = network_send_packet(socket, buffer, buffer_tell(buffer));
        ptanksChanged = true;
    }
    
    if(!ptanksChanged){
        ptanksTimer = 10;
    }
    
    if(ptanksChanged){
        ptanksChanged = false;
        ptanksTimer = 75;
    }
}

if(teleport){
    teleportTimer--;
    if(teleportTimer &lt;= 0){
        teleport = false;
        teleportTimer = 60;
    }
}

if(disconnectTimer &lt;= 0){
    instance_destroy();
}

if(pingTimer &lt;= 0){
    pingTimer = 90;
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 103);
    buffer_write(buffer, buffer_u32, current_time);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 103);
    buffer_write(buffer, buffer_u32, current_time);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(resetTimer == 0){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 20);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 20);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
    show_debug_message("it sent why doesn't this work pls");
}

time--;
maxpbombsTimer--;
maxhealthTimer--;
etanksTimer--;
mtanksTimer--;
stanksTimer--;
ptanksTimer--;
disconnectTimer--;
pingTimer--;

if(resetTimer &gt; -1){
    resetTimer--;
}

if(instance_exists(self)){
    if(ds_list_size(roomListData) &gt; 0){
        for(var h=0; h&lt;ds_list_size(roomListData); h++){
            var arrList = roomListData[| h];
            var arrID = arrList[0];
            var arrX = arrList[1];
            var arrY = arrList[2];
            var findHatchlingID = ds_list_find_index(global.hatchlingList, arrID);
            if(instance_exists(oHatchling)){
                if(findHatchlingID == -1){
                    ds_list_add(global.hatchlingList, arrID);
                    var hatchling = instance_create(arrX, arrY, oHatchling);
                    with(hatchling){
                        targetx = arrX;
                        targety = arrY;
                        myid = arrID;
                    }
                }
            } else {
                if(findHatchlingID &gt;= 0){
                    ds_list_delete(global.hatchlingList, findHatchlingID);
                }
            }
        }
    } else {
        if(ds_list_size(global.hatchlingList) &gt; 0){
            ds_list_clear(global.hatchlingList);
        }
    }
}

</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="68">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>disconnectTimer = 900;
if(!global.acceptPacket) exit;

var type_event = ds_map_find_value(async_load, "type");

switch(type_event){
    case network_type_data:
        var _buffer = ds_map_find_value(async_load, "buffer");
        var bufferSize = buffer_get_size(_buffer);
        buffer_seek(_buffer, buffer_seek_start, 0);
        var bufferSizePacket = buffer_read(_buffer, buffer_s32);
        show_debug_message(string(bufferSize) + " " + string(bufferSizePacket));
        if(!is_real(bufferSizePacket)) exit;
        if(bufferSizePacket + 4 != bufferSize) exit;
        show_debug_message("done");
        msgid = buffer_read(_buffer, buffer_u8);
        switch(msgid){
            case 254:
                var clientID = buffer_read(_buffer, buffer_u8);
                if(ds_list_size(roomList) &gt; 0){
                    var findsocket = ds_list_find_index(roomList, clientID);
                    if(findsocket &gt;= 0){
                        ds_list_delete(roomList, findsocket);
                    }
                }
                for(var i=0; i&lt;ds_list_size(roomListData); i++){
                    var arrList = roomListData[| i];
                    if(arrList[0] == clientID){
                        ds_list_delete(roomListData, i);
                    }
                }
                for(var f=0; f&lt;ds_list_size(global.idList); f++){
                    var arrList = global.idList[| f];
                    if(clientID == arrList[0, 0]){
                        ds_list_delete(global.idList, f);
                    }
                }
                for(var v=0; v&lt;ds_list_size(posData); v++){
                    var arrList = posData[| v];
                    if(clientID == arrList[0]){
                        ds_list_delete(posData, v);
                    }
                }
                if(instance_exists(oHatchling)){
                    with(oHatchling){
                        if(myid != 0){
                            instance_destroy();
                        }
                    }
                }
                break;
            case 200:
                global.clientID = preferredcolor;
                break;
            case 100:
                var clientID = buffer_read(_buffer, buffer_u8);
                var clientX = buffer_read(_buffer, buffer_s16);
                var clientY = buffer_read(_buffer, buffer_s16);
                var clientSprite = buffer_read(_buffer, buffer_s16);
                var clientImage = buffer_read(_buffer, buffer_s16);
                var clientA1 = buffer_read(_buffer, buffer_s16);
                var clientA1X = buffer_read(_buffer, buffer_s16);
                var clientA1Y = buffer_read(_buffer, buffer_s16);
                var clientA2 = buffer_read(_buffer, buffer_s16);
                var clientA2X = buffer_read(_buffer, buffer_s16);
                var clientA2Y = buffer_read(_buffer, buffer_s16);
                var clientA2A = buffer_read(_buffer, buffer_s16);
                var clientMirror = buffer_read(_buffer, buffer_s16);
                var clientArmmsl = buffer_read(_buffer, buffer_s16);
                var clientRoom = buffer_read(_buffer, buffer_s16);
                var clientName = buffer_read(_buffer, buffer_string);
                var clientBlend = buffer_read(_buffer, buffer_s16);
                var clientFXTimer = buffer_read(_buffer, buffer_s8);
                var clientRoomPrev = buffer_read(_buffer, buffer_s16);
                var findsocket = ds_list_find_index(roomList, clientID);
                if(global.clientID != clientID){
                    if(findsocket &lt; 0){
                        if(clientRoom == room || clientRoom == rm_options || clientRoom == itemroom || clientRoom == subscreenroom || clientRoom == maproom || clientRoom == rm_subscreen){
                            ds_list_add(roomList, clientID);
                            var arr;
                            arr[0] = clientID;
                            arr[1] = clientX;
                            arr[2] = clientY;
                            arr[3] = clientSprite;
                            arr[4] = clientImage;
                            arr[5] = clientA1;
                            arr[6] = clientA1X;
                            arr[7] = clientA1Y;
                            arr[8] = clientA2;
                            arr[9] = clientA2X;
                            arr[10] = clientA2Y;
                            arr[11] = clientA2A;
                            arr[12] = clientMirror;
                            arr[13] = clientArmmsl;
                            arr[14] = clientRoom;
                            arr[15] = clientName;
                            arr[16] = clientBlend;
                            arr[17] = clientFXTimer;
                            arr[18] = clientRoomPrev;
                            ds_list_add(roomListData, arr);
                        }
                    } else {
                        var arr;
                        arr[0] = clientID;
                        arr[1] = clientX;
                        arr[2] = clientY;
                        arr[3] = clientSprite;
                        arr[4] = clientImage;
                        arr[5] = clientA1;
                        arr[6] = clientA1X;
                        arr[7] = clientA1Y;
                        arr[8] = clientA2;
                        arr[9] = clientA2X;
                        arr[10] = clientA2Y;
                        arr[11] = clientA2A;
                        arr[12] = clientMirror;
                        arr[13] = clientArmmsl;
                        arr[14] = clientRoom;
                        arr[15] = clientName;
                        arr[16] = clientBlend;
                        arr[17] = clientFXTimer;
                        arr[18] = clientRoomPrev;
                        var indexValue = ds_list_find_value(roomList, findsocket);
                        for(var i=0; i&lt;ds_list_size(roomListData); i++){
                                var arrList = roomListData[| i];
                                if(arrList[0] == indexValue){
                                    roomListData[| i] = arr;
                                }
                            }
                        if(clientRoom != room &amp;&amp; (clientRoom != rm_options &amp;&amp; clientRoom != itemroom &amp;&amp; clientRoom != subscreenroom &amp;&amp; clientRoom != maproom &amp;&amp; clientRoom != rm_subscreen)){
                            sameRoom = false;
                            var indexValue = ds_list_find_value(roomList, findsocket);
                            ds_list_delete(roomList, findsocket);
                            for(var i=0; i&lt;ds_list_size(roomListData); i++){
                                var arrList = roomListData[| i];
                                if(arrList[0] == indexValue){
                                    ds_list_delete(roomListData, i);
                                }
                            }
                        }
                    }
                }
                break;
            case 101:
                var clientID = buffer_read(_buffer, buffer_u8);
                var clientRoom = buffer_read(_buffer, buffer_s16);
                var clientMapX = buffer_read(_buffer, buffer_s16);
                var clientMapY = buffer_read(_buffer, buffer_s16);
                var findsocket = ds_list_find_index(roomList, clientID);
                
                /*
                if(instance_exists(oCharacter)){
                    if(clientRoom == rm_death){
                        if(oCharacter.state != oCharacter.DEFEATED){
                            oCharacter.alarm[0] = 6;
                            oCharacter.state = oCharacter.DEFEATED;
                            mus_current_fadeout();
                            sfx_stop_all();
                        }
                    }
                }
                */
                                
                if(clientRoom == room &amp;&amp; global.clientID != clientID){
                    sameRoom = true;
                } else if(clientRoom != room &amp;&amp; global.clientID != clientID &amp;&amp; (clientRoom != rm_options &amp;&amp; clientRoom != itemroom &amp;&amp; clientRoom != subscreenroom &amp;&amp; clientRoom != maproom &amp;&amp; clientRoom != rm_subscreen)){
                    if(ds_list_size(roomList) &gt; 0 &amp;&amp; findsocket &gt;= 0){
                        sameRoom = false;
                        var indexValue = ds_list_find_value(roomList, findsocket);
                        ds_list_delete(roomList, findsocket);
                        for(var i=0; i&lt;ds_list_size(roomListData); i++){
                            var arrList = roomListData[| i];
                            if(arrList[0] == clientID){
                                ds_list_delete(roomListData, i);
                            }
                        }
                    }
                }
                
                var findsocket = ds_list_find_index(roomList, clientID);
                
                if(ds_list_size(roomList) &gt; 0 &amp;&amp; findsocket &gt;= 0){
                    for(var i=0; i&lt;ds_list_size(roomListData); i++){
                        var arrList = roomListData[| i];
                        if(arrList[0] == clientID){
                            arrList[14] = clientRoom;
                            roomListData[| i] = arrList;
                        }
                    }
                }
                
                checkList = ds_list_create();
                
                if(ds_list_size(global.idList) &gt; 0){
                    for(var f=0; f&lt;ds_list_size(global.idList); f++){
                        if(ds_list_size(posData) &gt; 0 &amp;&amp; clientID != global.clientID){
                            var arrPosData;
                            arrPosData[0] = clientID;
                            arrPosData[1] = clientMapX;
                            arrPosData[2] = clientMapY;
                            for(var v=0; v&lt;ds_list_size(posData); v++){
                                var arr = posData[| v];
                                ds_list_add(checkList, arr[0]);
                                if(arr[0] == clientID){
                                    posData[| v] = arrPosData;
                                }
                            }
                            
                            var find = ds_list_find_index(checkList, clientID);
                            
                            if(find &lt; 0){
                                ds_list_add(posData, arrPosData);
                            }
                        } else if(ds_list_size(posData) == 0 &amp;&amp; clientID != global.clientID){
                            var arrPosData;
                            arrPosData[0] = clientID;
                            arrPosData[1] = clientMapX;
                            arrPosData[2] = clientMapY;
                            ds_list_add(posData, arrPosData);
                            if(instance_exists(oMapCursor) &amp;&amp; surface_exists(oSS_Control.s_map)){
                                surface_free(oSS_Control.s_map);
                            }
                        }
                    }
                }
                ds_list_destroy(checkList);
                
                if(clientRoom == rm_a4b01 &amp;&amp; room != rm_a4b01 &amp;&amp; global.event[203] &gt; 0 &amp;&amp; global.event[203] &lt; 9 &amp;&amp; !teleport &amp;&amp; string_lower(reactorsequence) == "synced"){
                    if(room == rm_a4b02 || room == rm_a4b03 || room == rm_a4b04 || room == rm_a4b05 || room == rm_a4b06 || room == rm_a4b07 || room == rm_a4b08 || room == rm_a4b09 || room == rm_a4b10 || room == rm_a4b11 || room == rm_a4b12 || room == rm_a4b13 || room == rm_a4b14 || room == rm_a4b15 || room == rm_a4b16 || room == rm_a4b17 || room == rm_a4b18 || room == rm_a4b19){
                        teleport = true;
                        global.targetx = 624;
                        global.targety = 144;
                        room_change(rm_a4b01, 1);
                    }
                }
                
                break;
            case 102:
                ds_list_read(global.idList, strict_decompress(buffer_read(_buffer, buffer_string)));
                break;
            case 104:
                var playerHealth = buffer_read(_buffer, buffer_s16);
                var missiles = buffer_read(_buffer, buffer_s16);
                var smissiles = buffer_read(_buffer, buffer_u8);
                var pbombs = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                global.playerhealth = playerHealth;
                global.missiles = missiles;
                global.smissiles = smissiles;
                global.pbombs = pbombs;
                break;
            case 105:
                var ping = buffer_read(_buffer, buffer_u32);
                global.ping = current_time - ping;
                break;
            case 106:
                load_character_vars();
                reset_dmap();
                global.itemPrev = array_clone(global.item);
                global.metdeadPrev = array_clone(global.metdead);
                global.eventPrev = array_clone(global.event);
                global.dmapPrev = array_clone(global.dmap);
                popup_text("Stats reset");
                break;
            case 0:
                global.clientID = buffer_read(_buffer, buffer_u8);
                show_debug_message(string(msgid) + " " + string(global.clientID));
                alarm[0] = 5;
                alarm[2] = 5;
                alarm[3] = 5;
                alarm[4] = 5;
                alarm[5] = 5;
                alarm[6] = 5;
                alarm[7] = 5;
                alarm[8] = 5;
                alarm[9] = 5;
                alarm[10] = 3;
                alarm[11] = 20;
                buffer_delete(buffer);
                var size, type, alignment;
                size = 1024;
                type = buffer_grow;
                alignment = 1;
                buffer = buffer_create(size, type, alignment);
                buffer_seek(buffer, buffer_seek_start, 0);
                buffer_write(buffer, buffer_u8, 200);
                buffer_write(buffer, buffer_u8, global.clientID);
                buffer_write(buffer, buffer_u8, preferredcolor);
                var bufferSize = buffer_tell(buffer);
                buffer_seek(buffer, buffer_seek_start, 0);
                buffer_write(buffer, buffer_s32, bufferSize);
                buffer_write(buffer, buffer_u8, 200);
                buffer_write(buffer, buffer_u8, global.clientID);
                buffer_write(buffer, buffer_u8, preferredcolor);
                var result = network_send_packet(socket, buffer, buffer_tell(buffer));
                break;
            case 1:
                ds_grid_read(global.onlineReceived, strict_decompress(buffer_read(_buffer, buffer_string)));
                global.receivedClientID = buffer_read(_buffer, buffer_u8);
                global.receivedPacketID++;
                if(global.receivedClientID != global.clientID){
                    update_variables("disablesame");
                    update_variables("replaceglobalvars");
                    update_variables("updateprev");
                    alarm[0] = 10;
                    ds_grid_clear(global.onlineReceived, -1);
                } 
                break;
            case 2:
                ds_grid_read(global.onlineReceived, strict_decompress(buffer_read(_buffer, buffer_string)));
                global.receivedClientID = buffer_read(_buffer, buffer_u8);
                update_variables("disablesame");
                update_variables("updateprev");
                //global.itemChanges = 0;
                //global.metdeadChanges = 0;
                //global.eventChanges = 0;
                alarm[0] = 10;
                ds_grid_clear(global.onlineReceived, -1);
                break;
            case 3:
                queenHealth = buffer_read(_buffer, buffer_s32);
                var clientID = buffer_read(_buffer, buffer_u8);
                phase = buffer_read(_buffer, buffer_s8);
                state = buffer_read(_buffer, buffer_s8);
                if(clientID != global.clientID){
                    if(instance_exists(oQueen) &amp;&amp; instance_exists(oQueenHead) &amp;&amp; !is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
                        if(oQueen.phase == phase){
                            if(global.queenhealthPrev != queenHealth){
                                if(queenHealth == 999999){
                                    queenHealth = 0;
                                    oQueenHead.myhealth = queenHealth;
                                    if(queenHealth &lt;= 0){
                                        with(oQueenHead){
                                            if (myhealth &lt;= 0 &amp;&amp; state != 100 &amp;&amp; state != 50) {
                                                if (oQueen.phase &lt; 3) head_damage = 1;
                                                if (oQueen.phase == 3) head_damage = 2;
                                                if (oQueen.phase &lt; 5) {
                                                    state = 50;
                                                    statetime = 0;
                                                    myhealth = 999999;
                                                    with (oQueen) {
                                                        state = 6;
                                                        statetime = 0;
                                                    }
                                                }
                                                if (oQueen.phase == 5) {
                                                    with (oQueen) {
                                                        state = 100;
                                                        statetime = 0;
                                                    }
                                                    state = 100;
                                                }
                                            }
                                        }
                                        queenHealth = 999999;
                                    }
                                }
                                global.queenhealthPrev = queenHealth;
                                oQueenHead.myhealth = queenHealth;
                            }
                        }
                        
                        if(global.queenphasePrev != phase){
                            global.queenphasePrev = phase;
                        }
                    }
                } else {
                    if(instance_exists(oQueen) &amp;&amp; instance_exists(oQueenHead) &amp;&amp; !is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
                        /*
                        if(oQueen.phase == phase){
                            if(global.queenhealthPrev != queenHealth){
                                global.queenhealthPrev = queenHealth;
                                oQueenHead.myhealth = queenHealth;
                            }
                        }
                        
                        if(global.queenphasePrev != phase){
                            global.queenphasePrev = phase;
                        }
                        */
                        global.queenhealthPrev = oQueenHead.myhealth;
                        global.queenphasePrev = oQueen.phase;
                    }
                }
                break;
            case 4:
                var _seed = buffer_read(_buffer, buffer_f64);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID){
                    if(seed != _seed){
                        seed = _seed;
                        show_debug_message("seed received");
                        popup_seed("Seed received");
                    }
                }
                break;
            case 5:
                var monstersLeft = buffer_read(_buffer, buffer_s8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(global.clientID != clientID &amp;&amp; global.monstersleft != monstersLeft){
                    global.monstersleft = monstersLeft;
                    global.monstersleftPrev = global.monstersleft;
                } else if(global.clientID == clientID){
                    global.monstersleftPrev = global.monstersleft;
                }
                alarm[2] = 10;
                break;
            case 6:
                var monstersArea = buffer_read(_buffer, buffer_s8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(global.clientID != clientID &amp;&amp; global.monstersarea != monstersArea){
                    global.monstersarea = monstersArea;
                    global.monstersareaPrev = global.monstersarea;
                } else if(global.clientID == clientID){
                    global.monstersareaPrev = global.monstersarea;
                }
                alarm[2] = 10;
                break;
            case 7:
                var item = ds_list_create();
                ds_list_read(item, strict_decompress(buffer_read(_buffer, buffer_string)));
                var clientID = buffer_read(_buffer, buffer_u8);
                var itemArr = item[| 0];
                if(is_array(itemArr)){
                    for(var i=0; i&lt;array_length_1d(global.item); i++){
                        for(var f=0; f&lt;array_height_2d(itemArr); f++){
                            if(i == itemArr[f, 1]){
                                global.itemPrev[i] = itemArr[f, 0];
                                if(global.item[i] != itemArr[f, 0]){
                                    global.item[i] = itemArr[f, 0];
                                }
                            }
                        }
                    }
                }
                alarm[3] = 10;
                if(global.clientID == clientID){
                    ds_list_clear(global.onlineItem);
                    global.itemChanges = 0;
                }
                ds_list_destroy(item);
                break;
            case 8:
                var metdead = ds_list_create();
                ds_list_read(metdead, strict_decompress(buffer_read(_buffer, buffer_string)));
                var clientID = buffer_read(_buffer, buffer_u8);
                var metdeadArr = metdead[| 0];
                if(is_array(metdeadArr)){
                    for(var i=0; i&lt;array_length_1d(global.metdead); i++){
                        for(var f=0; f&lt;array_height_2d(metdeadArr); f++){
                            if(i == metdeadArr[f, 1]){
                                global.metdeadPrev[i] = metdeadArr[f, 0];
                                if(global.metdead[i] != metdeadArr[f, 0]){
                                    global.metdead[i] = metdeadArr[f, 0];
                                    if(metdeadArr[f, 0] == 1 &amp;&amp; global.clientID != clientID){
                                        popup_text("Metroid killed");
                                    }
                                }
                            }
                        }
                    }
                }
                alarm[4] = 10;
                if(global.clientID == clientID){
                    ds_list_clear(global.onlineMetdead);
                    global.metdeadChanges = 0;
                }
                ds_list_destroy(metdead);
                break;
            case 9:
                var event = ds_list_create();
                ds_list_read(event, strict_decompress(buffer_read(_buffer, buffer_string)));
                var clientID = buffer_read(_buffer, buffer_u8);
                var eventArr = event[| 0];
                if(is_array(eventArr)){
                    for(var i=0; i&lt;array_length_1d(global.event); i++){
                        for(var f=0; f&lt;array_height_2d(eventArr); f++){
                            if(i == eventArr[f, 1] &amp;&amp; eventArr[f, 1] != 102){
                                global.eventPrev[i] = eventArr[f, 0];
                                if(global.event[i] != eventArr[f, 0]){
                                    global.event[i] = eventArr[f, 0];
                                }
                                if(eventArr[f, 1] == 308){
                                    if(eventArr[f, 0] == 1 &amp;&amp; clientID != global.clientID){
                                        if(instance_exists(oCharacter)){
                                            with(oCharacter){
                                                facing = 0;
                                                if (global.currentsuit == 0) sprite_index = scr_suit_sprites(sFront,sFront_fusion);
                                                if (global.currentsuit == 1) sprite_index = scr_suit_sprites(sVFront,sFront_fusion);
                                                if (global.currentsuit == 2) sprite_index = scr_suit_sprites(sGFront,sFront_fusion);
                                                canbehit = 0;
                                                xVel = 0;
                                                yVel = 0;
                                                xAcc = 0;
                                                yAcc = 0;
                                            }
                                        }
                                        global.enablecontrol = 0;
                                        oControl.displaygui = 0;
                                        popup_text_ext("Ship reached", 120);
                                    }
                                    if(eventArr[f, 0] == 2 &amp;&amp; clientID != global.clientID){
                                        oControl.displaygui = 0;
                                        global.enablecontrol = 0;
                                        if(instance_exists(oCharacter)){
                                            with(oCharacter){
                                                xVel = 0;
                                                yVel = 0;
                                                xAcc = 0;
                                                yAcc = 0;
                                            }
                                        }
                                    }
                                    if(eventArr[f, 0] == 3 &amp;&amp; clientID != global.clientID){
                                        instance_create(0, 0, oFinalFadeout);
                                        mus_fadeout(musHatchling);
                                        global.enablecontrol = 0;
                                        if(instance_exists(oCharacter)){
                                            with(oCharacter){
                                                xVel = 0;
                                                yVel = 0;
                                                xAcc = 0;
                                                yAcc = 0;
                                            }
                                        }
                                    }
                                    if(eventArr[f, 0] == 4 &amp;&amp; clientID != global.clientID){
                                        if(instance_exists(oCharacter)){
                                            with(oCharacter){
                                                xVel = 0;
                                                yVel = 0;
                                                xAcc = 0;
                                                yAcc = 0;
                                                canbehit = 1;
                                            }
                                        }
                                        remove_persistent_objects();
                                        sfx_stop_all();
                                        global.vibL = 0;
                                        global.vibR = 0;
                                        global.ingame = 0;
                                        global.darkness = 0;
                                        global.gotolog = -1;
                                        global.enablecontrol = 1;
                                        global.transitiontype = 0;
                                        oControl.displaygui = 1;
                                        room_goto(rm_credits);
                                        mus_stop_all();
                                        mus_play_once(musCredits);
                                    }
                                }
                            }
                        }
                    }
                }
                alarm[5] = 10;
                if(global.clientID == clientID){
                    ds_list_clear(global.onlineEvent);
                    global.eventChanges = 0;
                }
                ds_list_destroy(event);
                break;
            case 10:
                var tileCount = buffer_read(_buffer, buffer_u16);
                if(tileCount &gt; 0){
                    for(var i=0; i&lt;tileCount; i++){
                        var tileX = buffer_read(_buffer, buffer_u8);
                        var tileY = buffer_read(_buffer, buffer_u8);
                        var tileData = buffer_read(_buffer, buffer_u8);
                        global.dmapPrev[tileX, tileY] = tileData;
                        if(global.dmap[tileX, tileY] != tileData){
                            global.dmap[tileX, tileY] = tileData;
                            
                            if(global.ingame){
                                with (oControl) event_user(2);
                            }
                            
                            if(instance_exists(oMapCursor) &amp;&amp; surface_exists(oSS_Control.s_map)){
                                surface_free(oSS_Control.s_map);
                            }
                        }
                    }
                    var clientID = buffer_read(_buffer, buffer_u8);
                }
                
                alarm[6] = 10;
                break;
            case 11:
                var itemstaken = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; itemstaken != global.itemstaken){
                    global.itemstakenPrev = itemstaken;
                    global.itemstaken = itemstaken;
                } else if(clientID == global.clientID){
                    global.itemstakenPrev = global.itemstaken;
                }
                alarm[7] = 1;
                break;
            case 12:
                var maxmissiles = buffer_read(_buffer, buffer_u16);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; maxmissiles != global.maxmissiles){
                    global.maxmissilesPrev = maxmissiles;
                    global.maxmissiles = maxmissiles;
                } else if(clientID == global.clientID){
                    global.maxmissilesPrev = global.maxmissiles;
                }
                global.missilesPrev = maxmissiles;
                global.missiles = maxmissiles;
                alarm[8] = 1;
                break;
            case 13:
                var maxsmissiles = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; maxsmissiles != global.maxsmissiles){
                    global.maxsmissilesPrev = maxsmissiles;
                    global.maxsmissiles = maxsmissiles;
                } else if(clientID == global.clientID){
                    global.maxsmissilesPrev = global.maxsmissiles;
                }
                global.smissilesPrev = maxsmissiles;
                global.smissiles = maxsmissiles;
                alarm[9] = 1;
                break;
            case 14:
                var maxpbombs = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; maxpbombs != global.maxpbombs){
                    global.maxpbombsPrev = maxpbombs;
                    global.maxpbombs = maxpbombs;
                } else if(clientID == global.clientID){
                    global.maxpbombsPrev = global.maxpbombs;
                }
                global.pbombsPrev = maxpbombs;
                global.pbombs = maxpbombs;
                maxpbombsTimer = 1;
                break;
            case 15:
                var maxhealth = buffer_read(_buffer, buffer_u16);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; maxhealth != global.maxhealth){
                    global.maxhealthPrev = maxhealth;
                    global.maxhealth = maxhealth;
                } else if(clientID == global.clientID){
                    global.maxhealthPrev = global.maxhealth;
                }
                global.playerhealthPrev = maxhealth;
                global.playerhealth = maxhealth;
                maxhealthTimer = 1;
                break;
            case 16:
                var etanks = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; etanks != global.etanks){
                    global.etanksPrev = etanks;
                    global.etanks = etanks;
                } else if(clientID == global.clientID){
                    global.etanksPrev = global.etanks;
                }
                etanksTimer = 1;
                break;
            case 17:
                var mtanks = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; mtanks != global.mtanks){
                    global.mtanksPrev = mtanks;
                    global.mtanks = mtanks;
                } else if(clientID == global.clientID){
                    global.mtanksPrev = global.mtanks;
                }
                mtanksTimer = 1;
                break;
            case 18:
                var stanks = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; stanks != global.stanks){
                    global.stanksPrev = stanks;
                    global.stanks = stanks;
                } else if(clientID == global.clientID){
                    global.stanksPrev = global.stanks;
                }
                stanksTimer = 1;
                break;
            case 19:
                var ptanks = buffer_read(_buffer, buffer_u8);
                var clientID = buffer_read(_buffer, buffer_u8);
                if(clientID != global.clientID &amp;&amp; ptanks != global.ptanks){
                    global.ptanksPrev = ptanks;
                    global.ptanks = ptanks;
                } else if(clientID == global.clientID){
                    global.ptanksPrev = global.ptanks;
                }
                ptanksTimer = 1;
                break;
            case 20:
                var time = buffer_read(_buffer, buffer_s32);
                global.gametime = time;
                break;
            case 21:
                var clientID = buffer_read(_buffer, buffer_u8);
                var dir = buffer_read(_buffer, buffer_s16);
                var sprX = buffer_read(_buffer, buffer_s16);
                var sprY = buffer_read(_buffer, buffer_s16);
                var charge = buffer_read(_buffer, buffer_u8);
                if(ds_list_size(roomListData) &gt; 0 &amp;&amp; clientID != global.clientID){ 
                    for(var i=0; i&lt;ds_list_size(roomListData); i++){
                        var arrDraw = roomListData[| i];
                        var arrID = arrDraw[0];
                        if(clientID == arrID){
                            if(instance_exists(oCharacter)){
                                with(oCharacter){
                                    shoot_beam_receive(sprX, sprY, dir, charge);
                                }
                            }
                        }
                    }
                }
                break;
            case 22:
                var clientID = buffer_read(_buffer, buffer_u8);
                var bombX = buffer_read(_buffer, buffer_s16);
                var bombY = buffer_read(_buffer, buffer_s16);
                if(ds_list_size(roomListData) &gt; 0 &amp;&amp; clientID != global.clientID){ 
                    for(var i=0; i&lt;ds_list_size(roomListData); i++){
                        var arrDraw = roomListData[| i];
                        var arrID = arrDraw[0];
                        if(clientID == arrID){
                            if(instance_exists(oCharacter)){
                                instance_create(bombX, bombY, oBombMulti);
                                sfx_play(sndBombSet);
                            }
                        }
                    }
                }
                break; 
            case 23:
                var clientID = buffer_read(_buffer, buffer_u8);
                var currentWeapon = buffer_read(_buffer, buffer_u8);
                var dir = buffer_read(_buffer, buffer_s16);
                var missileX = buffer_read(_buffer, buffer_s16);
                var missileY = buffer_read(_buffer, buffer_s16);
                if(ds_list_size(roomListData) &gt; 0 &amp;&amp; clientID != global.clientID){ 
                    for(var i=0; i&lt;ds_list_size(roomListData); i++){
                        var arrDraw = roomListData[| i];
                        var arrID = arrDraw[0];
                        if(clientID == arrID){
                            if(instance_exists(oCharacter)){
                                with(oCharacter){
                                    shoot_missile_receive(dir, currentWeapon, missileX, missileY);
                                    show_debug_message("x = " + string(missileX) + " y = " + string(missileY));
                                }
                            }
                        }
                    }
                }
                break;
            case 24:
                var clientID = buffer_read(_buffer, buffer_u8);
                var pbombX = buffer_read(_buffer, buffer_s16);
                var pbombY = buffer_read(_buffer, buffer_s16);
                if(ds_list_size(roomListData) &gt; 0 &amp;&amp; clientID != global.clientID){ 
                    for(var i=0; i&lt;ds_list_size(roomListData); i++){
                        var arrDraw = roomListData[| i];
                        var arrID = arrDraw[0];
                        if(clientID == arrID){
                            if(instance_exists(oCharacter)){
                                instance_create(pbombX, pbombY, oPBombMulti);
                            }
                        }
                    }
                }
                break;
            case 50:
                var resend = false;
                for(var i=0; i&lt;array_length_1d(global.item); i++){
                    var receivedItem = buffer_read(_buffer, buffer_u8);
                    if(receivedItem == 1 &amp;&amp; global.item[i] == 0){
                        global.item[i] = receivedItem;
                        global.itemPrev[i] = global.item[i];
                        
                        if(i == 0){
                            global.bomb = 1;
                            global.bombPrev = global.bomb;
                            popup_text(get_text("Items", "Bombs") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 1){
                            global.powergrip = 1;
                            global.powergripPrev = global.powergrip;
                            popup_text(get_text("Items", "PowerGrip") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 2){
                            global.spiderball = 1;
                            global.spiderballPrev = global.spiderball;
                            popup_text(get_text("Items", "SpiderBall") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 3){
                            global.jumpball = 1;
                            global.jumpballPrev = global.jumpball;
                            popup_text(get_text("Items", "JumpBall") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 4){
                            global.hijump = 1;
                            global.hijumpPrev = global.hijump;
                            popup_text(get_text("Items", "HiJump") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 5){
                            global.currentsuit = 1;
                            global.currentsuitPrev = global.currentsuit;
                            popup_text(get_text("Items", "VariaSuit") + " " + get_text("GlobalOptions", "Enabled"));
                            if(sfx_isplaying(sndSpinJump)){
                                sfx_stop(sndSpinJump);
                            }
                            
                            if(sfx_isplaying(sndSpaceJump)){
                                sfx_stop(sndSpaceJump);
                            }
                            
                            if(sfx_isplaying(sndScrewAttack)){
                                sfx_stop(sndScrewAttack);
                            }
                            
                            if(sfx_isplaying(sndSpaceScrewAttack)){
                                sfx_stop(sndSpaceScrewAttack);
                            }
                        }
                        
                        if(i == 6){
                            global.spacejump = 1;
                            global.spacejumpPrev = global.spacejump;
                            popup_text(get_text("Items", "SpaceJump") + " " + get_text("GlobalOptions", "Enabled"));
                            if(sfx_isplaying(sndSpinJump)){
                                sfx_stop(sndSpinJump);
                            }
                            
                            if(sfx_isplaying(sndSpaceJump)){
                                sfx_stop(sndSpaceJump);
                            }
                            
                            if(sfx_isplaying(sndScrewAttack)){
                                sfx_stop(sndScrewAttack);
                            }
                            
                            if(sfx_isplaying(sndSpaceScrewAttack)){
                                sfx_stop(sndSpaceScrewAttack);
                            }
                        }
                        
                        if(i == 7){
                            global.speedbooster = 1;
                            global.speedboosterPrev = global.speedbooster;
                            popup_text(get_text("Items", "SpeedBooster") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 8){
                            global.screwattack = 1;
                            global.screwattackPrev = global.screwattack;
                            popup_text(get_text("Items", "ScrewAttack") + " " + get_text("GlobalOptions", "Enabled"));
                            if(sfx_isplaying(sndSpinJump)){
                                sfx_stop(sndSpinJump);
                            }
                            
                            if(sfx_isplaying(sndSpaceJump)){
                                sfx_stop(sndSpaceJump);
                            }
                            
                            if(sfx_isplaying(sndScrewAttack)){
                                sfx_stop(sndScrewAttack);
                            }
                            
                            if(sfx_isplaying(sndSpaceScrewAttack)){
                                sfx_stop(sndSpaceScrewAttack);
                            }
                        }
                        
                        if(i == 9){
                            global.currentsuit = 2;
                            global.currentsuitPrev = global.currentsuit;
                            popup_text(get_text("Items", "GravitySuit") + " " + get_text("GlobalOptions", "Enabled"));
                            if(sfx_isplaying(sndSpinJump)){
                                sfx_stop(sndSpinJump);
                            }
                            
                            if(sfx_isplaying(sndSpaceJump)){
                                sfx_stop(sndSpaceJump);
                            }
                            
                            if(sfx_isplaying(sndScrewAttack)){
                                sfx_stop(sndScrewAttack);
                            }
                            
                            if(sfx_isplaying(sndSpaceScrewAttack)){
                                sfx_stop(sndSpaceScrewAttack);
                            }
                        }
                        
                        if(i == 10){
                            global.cbeam = 1;
                            global.cbeamPrev = global.cbeam;
                            popup_text(get_text("Items", "ChargeBeam") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 11){
                            global.ibeam = 1;
                            global.ibeamPrev = global.ibeam;
                            popup_text(get_text("Items", "IceBeam") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 12){
                            global.wbeam = 1;
                            global.wbeamPrev = global.wbeam;
                            popup_text(get_text("Items", "WaveBeam") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 13){
                            global.sbeam = 1;
                            global.sbeamPrev = global.sbeam;
                            popup_text(get_text("Items", "SpazerBeam") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                        
                        if(i == 14){
                            global.pbeam = 1;
                            global.pbeamPrev = global.pbeam;
                            popup_text(get_text("Items", "PlasmaBeam") + " " + get_text("GlobalOptions", "Enabled"));
                        }
                    } else if(receivedItem == 0 &amp;&amp; global.item[i] == 1){
                        resend = true;
                    }
                }
                
                var etankCount = 0;
                for(var i=0; i&lt;array_length_1d(global.item); i++){
                    if(i == 50 || i == 103 || i == 108 || i == 157 || i == 158 || i == 200 || i == 201 || i == 251 || i == 254 || i == 306){
                        if(global.item[i] == 1){
                            etankCount++;
                        }
                    }
                }
                if(etankCount != global.etanks){
                    global.etanks = etankCount;
                    global.maxhealth = ((99 + (100 * global.etanks)) * oControl.mod_etankhealthmult);
                    global.playerhealth = global.maxhealth;
                }
                
                var stankCount = 0;
                for(var i=0; i&lt;array_length_1d(global.item); i++){
                    if(i == 51 || i == 110 || i == 162 || i == 206 || i == 207 || i == 209 || i == 215 || i == 256 || i == 300 || i == 305){
                        if(global.item[i] == 1){
                            stankCount++;
                        }
                    }
                }
                if(stankCount != global.stanks){
                    global.stanks = stankCount;
                    if (global.difficulty &lt; 2) global.maxsmissiles = 2 * global.stanks;
                    if (global.difficulty == 2) global.maxsmissiles = 1 * global.stanks;
                    global.smissiles = global.maxsmissiles;
                }
                
                var ptankCount = 0;
                for(var i=0; i&lt;array_length_1d(global.item); i++){
                    if(i == 58 || i == 59 || i == 112 || i == 160 || i == 212 || i == 213 || i == 253 || i == 258 || i == 301 || i == 302){
                        if(global.item[i] == 1){
                            ptankCount++;
                        }
                    }
                }
                if(ptankCount != global.ptanks){
                    global.ptanks = ptankCount;
                    if (global.difficulty &lt; 2) global.maxpbombs = 2 * global.ptanks;
                    if (global.difficulty == 2) global.maxpbombs = 1 * global.ptanks;
                    global.pbombs = global.maxpbombs;
                }
                
                var mtankCount = 0;
                for(var i=0; i&lt;array_length_1d(global.item); i++){
                    if(i == 52 || i == 53 || i == 54 || i == 55 || i == 56 || i == 57 || i == 60 || i == 100 || i == 101 || i == 102 || i == 104 || i == 105 || i == 106 || i == 107 || i == 109 || i == 111 || i == 150 || i == 151 || i == 152 || i == 153 || i == 154 || i == 155 || i == 156 || i == 159 || i == 161 || i == 163 || i == 202 || i == 203 || i == 204 || i == 205 || i == 208 || i == 210 || i == 211 || i == 214 || i == 250 || i == 252 || i == 255 || i == 257 || i == 259 || i == 303 || i == 304 || i == 307 || i == 308 || i == 309){
                        if(global.item[i] == 1){
                            mtankCount++;
                        }
                    }
                }
                if(mtankCount != global.mtanks){
                    global.mtanks = mtankCount;
                    if (global.difficulty &lt; 2) global.maxmissiles = oControl.mod_Mstartingcount + (5 * global.mtanks);
                    if (global.difficulty == 2) global.maxmissiles = oControl.mod_Mstartingcount + (2 * global.mtanks);
                    global.missiles = global.maxmissiles;
                }
                
                if(resend){
                    var size, type, alignment;
                    size = 1024;
                    type = buffer_grow;
                    alignment = 1;
                    itemBuffer = buffer_create(size, type, alignment);
                    buffer_seek(itemBuffer, buffer_seek_start, 0);
                    buffer_write(itemBuffer, buffer_u8, 50);
                    for(var i=0; i&lt;array_length_1d(global.item); i++){
                        buffer_write(itemBuffer, buffer_u8, global.item[i]);
                    }
                    var bufferSize = buffer_tell(itemBuffer);
                    buffer_seek(itemBuffer, buffer_seek_start, 0);
                    buffer_write(itemBuffer, buffer_s32, bufferSize);
                    buffer_write(itemBuffer, buffer_u8, 50);
                    for(var i=0; i&lt;array_length_1d(global.item); i++){
                        buffer_write(itemBuffer, buffer_u8, global.item[i]);
                    }
                    network_send_packet(socket, itemBuffer, buffer_tell(itemBuffer));
                    buffer_delete(itemBuffer);
                }
                break;
            case 51:
                var resend = false;
                for(var i=0; i&lt;array_length_1d(global.event); i++){
                    if(i &lt; 350){
                        var receivedEvent = buffer_read(_buffer, buffer_u8);
                        if(floor(receivedEvent) &gt; floor(global.event[i]) &amp;&amp; i != 102){
                            global.event[i] = receivedEvent;
                            global.eventPrev[i] = global.event[i];
                            if(i == 308){
                                if(receivedEvent == 1){
                                    if(instance_exists(oCharacter)){
                                        with(oCharacter){
                                            facing = 0;
                                            if (global.currentsuit == 0) sprite_index = scr_suit_sprites(sFront,sFront_fusion);
                                            if (global.currentsuit == 1) sprite_index = scr_suit_sprites(sVFront,sFront_fusion);
                                            if (global.currentsuit == 2) sprite_index = scr_suit_sprites(sGFront,sFront_fusion);
                                            global.enablecontrol = 0;
                                            canbehit = 0;
                                            oControl.displaygui = 0;
                                            xVel = 0;
                                            yVel = 0;
                                            xAcc = 0;
                                            yAcc = 0;
                                        }
                                    }
                                    popup_text_ext("Ship reached", 120);
                                }
                                if(receivedEvent == 2){
                                    oControl.displaygui = 0;
                                    global.enablecontrol = 0;
                                    if(instance_exists(oCharacter)){
                                        with(oCharacter){
                                            xVel = 0;
                                            yVel = 0;
                                            xAcc = 0;
                                            yAcc = 0;
                                        }
                                    }
                                }
                                if(receivedEvent == 3){
                                    instance_create(0, 0, oFinalFadeout);
                                    mus_fadeout(musHatchling);
                                    global.enablecontrol = 0;
                                    if(instance_exists(oCharacter)){
                                        with(oCharacter){
                                            xVel = 0;
                                            yVel = 0;
                                            xAcc = 0;
                                            yAcc = 0;
                                        }
                                    }
                                }
                                if(receivedEvent == 4){
                                    if(instance_exists(oCharacter)){
                                        with(oCharacter){
                                            xVel = 0;
                                            yVel = 0;
                                            xAcc = 0;
                                            yAcc = 0;
                                            canbehit = 1;
                                        }
                                    }
                                    remove_persistent_objects();
                                    sfx_stop_all();
                                    global.vibL = 0;
                                    global.vibR = 0;
                                    global.ingame = 0;
                                    global.darkness = 0;
                                    global.gotolog = -1;
                                    global.enablecontrol = 1;
                                    global.transitiontype = 0;
                                    oControl.displaygui = 1;
                                    room_goto(rm_credits);
                                    mus_stop_all();
                                    mus_play_once(musCredits);
                                }
                            }
                        } else if(floor(receivedEvent) &lt; floor(global.event[i]) &amp;&amp; i != 102){
                            resend = true;
                        }
                    }
                }
                
                if(resend){
                    var size, type, alignment;
                    size = 1024;
                    type = buffer_grow;
                    alignment = 1;
                    eventBuffer = buffer_create(size, type, alignment);
                    buffer_seek(eventBuffer, buffer_seek_start, 0);
                    buffer_write(eventBuffer, buffer_u8, 51);
                    for(var i=0; i&lt;array_length_1d(global.event); i++){
                        buffer_write(eventBuffer, buffer_u8, global.event[i]);
                    }
                    var bufferSize = buffer_tell(eventBuffer);
                    buffer_seek(eventBuffer, buffer_seek_start, 0);
                    buffer_write(eventBuffer, buffer_s32, bufferSize);
                    buffer_write(eventBuffer, buffer_u8, 51);
                    for(var i=0; i&lt;array_length_1d(global.event); i++){
                        buffer_write(eventBuffer, buffer_u8, global.event[i]);
                    }
                    network_send_packet(socket, eventBuffer, buffer_tell(eventBuffer));
                    buffer_delete(eventBuffer);
                }
                break;
            case 52:
                var resend = false;
                for(var i=0; i&lt;array_length_1d(global.metdead); i++){
                    var receivedMetdead = buffer_read(_buffer, buffer_u8);
                    if(receivedMetdead == 1 &amp;&amp; global.metdead[i] == 0){
                        global.metdead[i] = receivedMetdead;
                        global.metdeadPrev[i] = global.metdead[i];
                    } else if(receivedMetdead == 0 &amp;&amp; global.metdead[i] == 1){
                        resend = true;
                    }
                }
                
                if(global.gamemode == 1){
                    var countArea = 0;
                    var countLeft = 0;
                    for(var i=0; i&lt;array_length_1d(global.metdead); i++){
                        if(i &lt;= 45){
                            if(global.metdead[i] == 0){
                                countLeft++;
                            }
                            
                            if(global.lavastate &gt;= 0 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 0){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 1 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 1 || i == 2 || i == 3 || i == 4)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 2 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11 || i == 12)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 3 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 13 || i == 14 || i == 15 || i == 16 || i == 17 || i == 18 || i == 19 || i == 20 || i == 21 || i == 22)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 4 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 23 || i == 24)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 5 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 25 || i == 26)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 6 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 27 || i == 28 || i == 29 || i == 30 || i == 31 || i == 32)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 7 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 33 || i == 34 || i == 35 || i == 36 || i == 37 || i == 38 || i == 39 || i == 40)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 8 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 41){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 9 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 42){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 10 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 43 || i == 44 || i == 45)){
                                countArea++;
                            }
                        }
                    }
                    
                    if(global.lavastate &lt; 11){
                        if(global.event[303] == 0){
                            countLeft++;
                        }
                        
                        if(global.monstersleft != countLeft){
                            global.monstersleft = countLeft;
                        }
                        
                        if(global.monstersarea != countArea){
                            global.monstersarea = countArea;
                        }
                    }
                } else if(global.gamemode &gt; 1){
                    var countArea = 0;
                    var countLeft = 0;
                    for(var i=0; i&lt;array_length_1d(global.metdead); i++){
                        if(i &lt;= 45){
                            if(global.metdead[i] == 0){
                                countLeft++;
                            }
                            
                            if(global.metdead[i] == 0 &amp;&amp; i != 11 &amp;&amp; i != 23 &amp;&amp; i != 24 &amp;&amp; i != 41 &amp;&amp; i != 42 &amp;&amp; i != 43 &amp;&amp; i != 44 &amp;&amp; i != 45){
                                countArea++;
                            }
                            
                            if(global.metdead[i] == 0 &amp;&amp; global.event[109] == 1 &amp;&amp; i == 11){
                                countArea++;
                            }
                            
                            if(global.metdead[i] == 0 &amp;&amp; global.event[171] == 1 &amp;&amp; (i == 23 || i == 24)){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 8 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 41){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 9 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 42){
                                countArea++;
                            }
                            
                            if(global.lavastate &gt;= 10 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 43 || i == 44 || i == 45)){
                                countArea++;
                            }
                        }
                    }
                    
                    if(global.lavastate &lt; 11){
                        if(global.event[303] == 0){
                            countLeft++;
                        }
                        
                        if(global.monstersleft != countLeft){
                            global.monstersleft = countLeft;
                        }
                        
                        if(global.monstersarea != countArea){
                            global.monstersarea = countArea;
                        }
                    }
                }
                
                if(resend){
                    var size, type, alignment;
                    size = 1024;
                    type = buffer_grow;
                    alignment = 1;
                    metdeadBuffer = buffer_create(size, type, alignment);
                    buffer_seek(metdeadBuffer, buffer_seek_start, 0);
                    buffer_write(metdeadBuffer, buffer_u8, 52);
                    for(var i=0; i&lt;array_length_1d(global.metdead); i++){
                        buffer_write(metdeadBuffer, buffer_u8, global.metdead[i]);
                    }
                    var bufferSize = buffer_tell(metdeadBuffer);
                    buffer_seek(metdeadBuffer, buffer_seek_start, 0);
                    buffer_write(metdeadBuffer, buffer_s32, bufferSize);
                    buffer_write(metdeadBuffer, buffer_u8, 52);
                    for(var i=0; i&lt;array_length_1d(global.metdead); i++){
                        buffer_write(metdeadBuffer, buffer_u8, global.metdead[i]);
                    }
                    network_send_packet(socket, metdeadBuffer, buffer_tell(metdeadBuffer));
                    buffer_delete(metdeadBuffer);
                }
                break;
            case 53:
                var part = buffer_read(_buffer, buffer_u8);
                var resend = false;
                for(var i=0; i&lt;array_height_2d(global.dmap); i++){
                    for(var j=0; j&lt;array_length_2d(global.dmap, i); j++){
                        if((part == 1 &amp;&amp; i &lt; 20) || (part == 2 &amp;&amp; i &gt;= 20 &amp;&amp; i &lt; 40) || (part == 3 &amp;&amp; i &gt;= 40 &amp;&amp; i &lt; 60) || (part == 4 &amp;&amp; i &gt;= 60 &amp;&amp; i &lt; 80)){
                            var receiveddmap = buffer_read(_buffer, buffer_u8);
                            if(receiveddmap &gt; global.dmap[i, j]){
                                global.dmap[i, j] = receiveddmap;
                                global.dmapPrev[i, j] = global.dmap[i, j];
                            } else if(receiveddmap &lt; global.dmap[i, j]){
                                resend = true;
                            }
                        }
                    }
                }
                
                if(resend){
                    var size, type, alignment;
                    size = 1024;
                    type = buffer_grow;
                    alignment = 1;
                    dmapBuffer = buffer_create(size, type, alignment);
                    buffer_seek(dmapBuffer, buffer_seek_start, 0);
                    buffer_write(dmapBuffer, buffer_u8, 53);
                    for(var i=0; i&lt;array_height_2d(global.dmap); i++){
                        for(var j=0; j&lt;array_length_2d(global.dmap, i); j++){
                            buffer_write(dmapBuffer, buffer_u8, global.dmap[i, j]);
                        }
                    }
                    var bufferSize = buffer_tell(dmapBuffer);
                    buffer_seek(dmapBuffer, buffer_seek_start, 0);
                    buffer_write(dmapBuffer, buffer_s32, bufferSize);
                    buffer_write(dmapBuffer, buffer_u8, 53);
                    for(var i=0; i&lt;array_height_2d(global.dmap); i++){
                        for(var j=0; j&lt;array_length_2d(global.dmap, i); j++){
                            buffer_write(dmapBuffer, buffer_u8, global.dmap[i, j]);
                        }
                    }
                    network_send_packet(socket, dmapBuffer, buffer_tell(dmapBuffer));
                    buffer_delete(dmapBuffer);
                }
                
                if(global.ingame){
                    with (oControl) event_user(2);
                }
                
                if(instance_exists(oMapCursor) &amp;&amp; surface_exists(oSS_Control.s_map)){
                    surface_free(oSS_Control.s_map);
                }
                break;
        }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="4">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(room == rm_credits){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 19);
    buffer_write(buffer, buffer_s32, global.gametime);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 19);
    buffer_write(buffer, buffer_s32, global.gametime);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(room == rm_score){
    resetTimer = 5;
}

if(room == titleroom){
    seed = undefined;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="3">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(connected){
    buffer_delete(buffer);
    var size, type, alignment;
    size = 1024;
    type = buffer_grow;
    alignment = 1;
    buffer = buffer_create(size, type, alignment);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_u8, 254);
    buffer_write(buffer, buffer_u8, global.clientID);
    var bufferSize = buffer_tell(buffer);
    buffer_seek(buffer, buffer_seek_start, 0);
    buffer_write(buffer, buffer_s32, bufferSize);
    buffer_write(buffer, buffer_u8, 254);
    buffer_write(buffer, buffer_u8, global.clientID);
    var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}

if(!noName){
    network_destroy(socket);
    buffer_delete(buffer);
    ds_grid_destroy(global.onlineList);
    ds_grid_destroy(global.onlineSend);
    ds_grid_destroy(global.onlineReceived);
    ds_list_destroy(global.onlineItem);
    ds_list_destroy(global.onlineMetdead);
    ds_list_destroy(global.onlineEvent);
    ds_list_destroy(roomList);
    ds_list_destroy(roomListData);
    ds_list_destroy(global.idList);
    ds_list_destroy(posData);
    ds_list_destroy(global.hatchlingList);
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="8" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(ds_list_size(roomListData) &gt; 0){ 
    for(var i=0; i&lt;ds_list_size(roomListData); i++){
        var arrDraw = roomListData[| i];
        var arrID = arrDraw[0];
        var arrX = arrDraw[1];
        var arrY = arrDraw[2];
        var arrSprite = arrDraw[3];
        var arrImage = arrDraw[4];
        var arrA1 = arrDraw[5];
        var arrA1X = arrDraw[6];
        var arrA1Y = arrDraw[7];
        var arrA2 = arrDraw[8];
        var arrA2X = arrDraw[9];
        var arrA2Y = arrDraw[10];
        var arrA2A = arrDraw[11];
        var arrMirror = arrDraw[12];
        var arrArmmsl = arrDraw[13];
        var arrRoom = arrDraw[14];
        var arrName = arrDraw[15];
        var arrBlend = arrDraw[16];
        var arrFXTimer = arrDraw[17];
        var arrRoomPrev = arrDraw[18];
        if((arrRoom == room || arrRoom == rm_options || arrRoom == itemroom || arrRoom == subscreenroom || arrRoom == maproom || arrRoom == rm_subscreen) &amp;&amp; instance_exists(oCharacter) &amp;&amp; room != rm_transition){
            if(arrSprite == sSpiderMorphBall || arrSprite == sGSpiderMorphBall || arrSprite == sVSpiderMorphBall || arrSprite == sSpiderMorphBall_fusion || arrSprite == sSpiderMorphBall_fusion_gravity || arrSprite == sSpiderMorphBall_fusion_varia){
                draw_set_blend_mode(bm_add);
                draw_set_alpha(arrFXTimer * 0.1);
                if(global.shaders_compiled &amp;&amp; os_type != os_android){
                    pal_swap_set(oControl.SpiderballPalette, arrID, false);
                    draw_sprite_ext(sSpiderballFX, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                } else if(global.shaders_compiled &amp;&amp; os_type == os_android){
                    switch(arrSprite){
                        case sSpiderMorphBall:
                            draw_sprite_ext(sSpiderballFX, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                            break;
                        case sVSpiderMorphBall:
                            draw_sprite_ext(sSpiderballFXVaria, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                            break;
                        case sGSpiderMorphBall:
                            draw_sprite_ext(sSpiderballFXGravity, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                            break;
                        case sSpiderMorphBall_fusion:
                            draw_sprite_ext(sSpiderballFX_fusion, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                            break;
                        case sSpiderballFXVaria_fusion:
                            draw_sprite_ext(sSpiderballFXVaria_fusion, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                            break;
                        case sSpiderballFXGravity_fusion:
                            draw_sprite_ext(sSpiderballFXGravity_fusion, -1, arrX, arrY, 1, 1, 0, -1, 0.2 + arrFXTimer * 0.1);
                            break;
                    }
                }
                if(global.shaders_compiled){
                    pal_swap_reset();
                    shader_reset();
                }
                draw_set_alpha(1);
                draw_set_blend_mode(bm_normal);
            }
            if(arrRoom != room){
                if(arrRoomPrev == room){
                    draw_character_ext(arrSprite, arrX, arrY, arrA1, arrA1X, arrA1Y, arrA2, arrA2X, arrA2Y, arrA2A, arrMirror, arrBlend, alpha, arrArmmsl, arrImage, arrID);
                }
            } else {
                draw_character_ext(arrSprite, arrX, arrY, arrA1, arrA1X, arrA1Y, arrA2, arrA2X, arrA2Y, arrA2A, arrMirror, arrBlend, alpha, arrArmmsl, arrImage, arrID);
            }
        }
    }
}

if(instance_exists(oMapCursor)){
    if(ds_list_size(posData) &gt; 0){
        for(var i=0; i&lt;ds_list_size(posData); i++){
            var arrMapIcon = posData[| i];
            var arrID = arrMapIcon[0];
            var arrX = arrMapIcon[1];
            var arrY = arrMapIcon[2];
            draw_sprite_ext(oControl.MultitroidMapIcon, (arrID - 1), (arrX * 8), ((arrY * 8) + 32), 1, 1, direction, c_white, oMapCursor.image_alpha);
        }
    }
}

</string>
          </argument>
        </arguments>
      </action>
    </event>
  </events>
  <PhysicsObject>0</PhysicsObject>
  <PhysicsObjectSensor>0</PhysicsObjectSensor>
  <PhysicsObjectShape>0</PhysicsObjectShape>
  <PhysicsObjectDensity>0.5</PhysicsObjectDensity>
  <PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
  <PhysicsObjectGroup>0</PhysicsObjectGroup>
  <PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
  <PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
  <PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
  <PhysicsObjectAwake>-1</PhysicsObjectAwake>
  <PhysicsObjectKinematic>0</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
