You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
355 lines
11 KiB
355 lines
11 KiB
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
|
|
<object>
|
|
<spriteName><undefined></spriteName>
|
|
<solid>0</solid>
|
|
<visible>0</visible>
|
|
<depth>0</depth>
|
|
<persistent>-1</persistent>
|
|
<parentName><undefined></parentName>
|
|
<maskName><undefined></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("dictionary.json");
|
|
canSend = false;
|
|
connected = false;
|
|
alarm[1] = 300;
|
|
var type;
|
|
type = network_socket_tcp;
|
|
var file = file_text_open_read(working_directory + "\ipaddress.txt");
|
|
ipaddress = file_text_read_string(file);
|
|
file_text_close(file);
|
|
port = 64198;
|
|
socket = network_create_socket(type);
|
|
isConnected = network_connect(socket, ipaddress, port);
|
|
|
|
var size, type, alignment;
|
|
size = 1024;
|
|
type = buffer_grow;
|
|
alignment = 1;
|
|
buffer = buffer_create(size, type, alignment);
|
|
|
|
global.itemlist[0] = 0;
|
|
for(i=0; i<350; i++){
|
|
global.itemlist[i] = i;
|
|
}
|
|
|
|
global.onlineList = ds_grid_create(3, 33);
|
|
global.onlineSend = ds_grid_create(3, 33);
|
|
for(var i=0; i<ds_grid_height(global.onlineList); i++){
|
|
ds_grid_set(global.onlineList, 2, i, i);
|
|
}
|
|
|
|
update_variables("prev");
|
|
|
|
update_variables("onlinevars");
|
|
|
|
alarm[0] = 5;
|
|
</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>network_destroy(socket);
|
|
buffer_delete(buffer);
|
|
ds_grid_destroy(global.onlineList);
|
|
ds_grid_destroy(global.onlineSend);
|
|
if(connected){
|
|
display_itemmsg("Disconnected", "", "", "");
|
|
}
|
|
</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(isConnected < 0){
|
|
isConnected = network_connect(socket, ipaddress, port);
|
|
}
|
|
alarm[1] = 300;
|
|
*/
|
|
</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<ds_grid_height(global.onlineList); i++){
|
|
if(global.onlineList[# 0, i] != global.onlineList[# 1, i] && i != 0 && i != 1 && i != 3){
|
|
global.onlineSend[# 0, i] = global.onlineList[# 0, i];
|
|
global.onlineSend[# 1, i] = global.onlineList[# 1, i];
|
|
global.onlineSend[# 2, i] = global.onlineList[# 2, i];
|
|
canSend = true;
|
|
alarm[0] = 600;
|
|
}
|
|
|
|
if(i == 0){
|
|
for(var f=0; f<array_length_1d(global.item); f++){
|
|
if(global.itemPrev[f] != global.item[f]){
|
|
global.onlineSend[# 0, 0] = global.onlineList[# 0, 0];
|
|
global.onlineSend[# 1, 0] = global.onlineList[# 1, 0];
|
|
global.onlineSend[# 2, 0] = global.onlineList[# 2, 0];
|
|
show_debug_message(string(global.itemPrev[f]) + " " + string(global.item[f]));
|
|
show_debug_message("item changed");
|
|
canSend = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(i == 1){
|
|
for(var f=0; f<array_length_1d(global.metdead); f++){
|
|
if(global.metdeadPrev[f] != global.metdead[f]){
|
|
global.onlineSend[# 0, 1] = global.onlineList[# 0, 1];
|
|
global.onlineSend[# 1, 1] = global.onlineList[# 1, 1];
|
|
global.onlineSend[# 2, 1] = global.onlineList[# 2, 1];
|
|
show_debug_message(string(global.metdeadPrev[f]) + " " + string(global.metdead[f]));
|
|
show_debug_message("metdead changed");
|
|
canSend = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(i == 3){
|
|
for(var f=0; f<array_length_1d(global.event); f++){
|
|
if(global.eventPrev[f] != global.event[f]){
|
|
global.onlineSend[# 0, 3] = global.onlineList[# 0, 3];
|
|
global.onlineSend[# 1, 3] = global.onlineList[# 1, 3];
|
|
global.onlineSend[# 2, 3] = global.onlineList[# 2, 3];
|
|
show_debug_message(string(global.eventPrev[f]) + " " + string(global.event[f]));
|
|
show_debug_message("event changed");
|
|
canSend = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(canSend){
|
|
show_debug_message("missiles");
|
|
show_debug_message(string(global.missilesPrev) + " " + string(global.missiles));
|
|
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_string, strict_compress(ds_grid_write(global.onlineSend)));
|
|
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
|
|
canSend = false;
|
|
}
|
|
|
|
if(!canSend){
|
|
alarm[0] = 30;
|
|
}
|
|
</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 >= 0){
|
|
connected = true;
|
|
display_itemmsg("Connected", "", "", "");
|
|
} else {
|
|
instance_destroy();
|
|
display_itemmsg("Failed to connect", "Please try again", "", "");
|
|
}
|
|
}
|
|
|
|
if(keyboard_check_pressed(vk_f2)){
|
|
instance_destroy();
|
|
}
|
|
|
|
/*
|
|
if(keyboard_check_pressed(vk_f3)){
|
|
var f = 0;
|
|
repeat(41){
|
|
global.metdead[f] = 1;
|
|
f++;
|
|
}
|
|
}
|
|
*/
|
|
</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>
|
|
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");
|
|
show_debug_message(buffer_get_size(_buffer));
|
|
buffer_seek(_buffer, buffer_seek_start, 0);
|
|
ds_grid_read(global.onlineSend, strict_decompress(buffer_read(_buffer, buffer_string)));
|
|
update_variables("disablesame");
|
|
update_variables("replaceglobalvars");
|
|
update_variables("prev");
|
|
alarm[0] = 30;
|
|
ds_grid_clear(global.onlineSend, 0);
|
|
/*
|
|
for(var i=0; i<array_length_1d(vars); i++){
|
|
if(global.onlineVars[i, 1] != vars[i, 1]){
|
|
global.onlineVars[i, 1] = vars[i, 1];
|
|
global.onlineVars[i, 0] = global.onlineVars[i, 1];
|
|
}
|
|
}
|
|
*/
|
|
break;
|
|
}
|
|
|
|
|
|
</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>network_destroy(socket);
|
|
buffer_delete(buffer);
|
|
ds_grid_destroy(global.onlineList);
|
|
ds_grid_destroy(global.onlineSend);
|
|
if(connected){
|
|
display_itemmsg("Disconnected", "", "", "");
|
|
}
|
|
</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>
|