Fangames > Programming Questions

GameMaker 8.1 to Studio: Error loading death time

(1/1)

RandomFangamer:
So I have been moving my game to GameMaker Studio
But when I try to play the game it gives me this error.
I haven't done anything to this object so I don't know what could be happening.

Error
(click to show/hide)___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object world:

Error reading byte.
 at gml_Script_loadDeathTime (line 35) -     global.microtime = file_bin_read_byte(f)*1000000;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_loadDeathTime (line 35)
called from - gml_Object_world_CreateEvent_1 (line 10) - loadDeathTime();
Code
(click to show/hide)god_mode = false;

global.savenum = 1;//�Z�[�u�t�@�C���ԍ�
global.difficulty = 3;//�Q�[���̓�Փx�i�ȒP�F�O���R�F����j
global.room_caption_def = "";//�f�o�b�O�p

//���S���ƌo�ߎ���
global.death[1] = 0;
global.death[2] = 0;
global.death[3] = 0;
global.time[1] = 0;
global.time[2] = 0;
global.time[3] = 0;

//���S���ƌo�ߎ��Ԃ̓ǂݍ���
loadDeathTime();

Thanks for reading this!
Atleast the watermark is gone :Kappa:

klazen108:
In order to fix this issue, you need to compare your save/load scripts and make sure they're writing/reading the same number of times. Make sure one doesn't cut short (Error Reading Byte means that you've already reached the end of the file, but you're still trying to read). Maybe you're reading an empty file? Check to make sure the file exists first.

Maybe the save script skips to a different spot to write the deathtime and you didn't do the same in load? The error mentions the first microtime read - how many reads are done before that? That will give you a clue of where to look in your save script. Maybe the save script stops just before that write in some cases. Maybe your save script isn't saving the 'microtime'. If you don't need that you can just remove the microtime lines from the load script.

Starz0r:
One of GameMaker Studio's downfalls is their sandboxed functions, unfortunately that extends to accessing files outside of the sandbox folder.

RandomFangamer:
Here are the save & load scripts.

Save:
(click to show/hide)var f,tem;
f = file_bin_open("save"+string(global.savenum),1);

for (i=0; i<global.bossBytes; i+=1){
file_bin_write_byte(f,global.boss[i,global.savenum])};

for (i=0; i<global.itemBytes; i+=1){
file_bin_write_byte(f,global.item[i,global.savenum])};

for (i=0; i<global.blankByte; i+=1){
file_bin_write_byte(f,global.BLANKBYTESPACE)};

tem = room;
file_bin_write_byte(f,floor(tem/10000));
tem -= floor(tem/10000)*10000;
file_bin_write_byte(f,floor(tem/100));
tem -= floor(tem/100)*100;
file_bin_write_byte(f,tem);

if(global.grav=0){
tem = player.x;
file_bin_write_byte(f,floor(tem/10000));
tem -= floor(tem/10000)*10000;
file_bin_write_byte(f,floor(tem/100));
tem -= floor(tem/100)*100;
file_bin_write_byte(f,tem);
tem = player.y;
file_bin_write_byte(f,floor(tem/10000));
tem -= floor(tem/10000)*10000;
file_bin_write_byte(f,floor(tem/100));
tem -= floor(tem/100)*100;
}
if(global.grav=1){
tem = player2.x;
file_bin_write_byte(f,floor(tem/10000));
tem -= floor(tem/10000)*10000;
file_bin_write_byte(f,floor(tem/100));
tem -= floor(tem/100)*100;
file_bin_write_byte(f,tem);
tem = player2.y;
file_bin_write_byte(f,floor(tem/10000));
tem -= floor(tem/10000)*10000;
file_bin_write_byte(f,floor(tem/100));
tem -= floor(tem/100)*100;
}
file_bin_write_byte(f,tem);
file_bin_write_byte(f,global.difficulty);
file_bin_write_byte(f,global.grav);



file_bin_close(f);

//���S���Ǝ��Ԃ̕ۑ�
saveDeathTime();
Load:
(click to show/hide)var f;

if(instance_exists(player) == false){
  instance_create(0,0,player);
}

f = file_bin_open("temp",1);
file_bin_write_byte(f,global.savenum);
file_bin_close(f);
saveExe();
game_restart();
Because studio wont save the game either, is there any other way to get rid of the watermark?

Edit: I got rid of the watermark and am not using Gamemaker Studio, so everything is working  :atkHappy:

Navigation

[0] Message Index

Go to full version