Author Topic: Weird DeathTime Error  (Read 1267 times)

RandomFangamer

  • Cherry Eater
  • Posts: 71
  • Pico Pico Piiiiiii
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 43.0.2357.130 Chrome 43.0.2357.130
    • View Profile
  • Playstyle: Keyboard
Weird DeathTime Error
« on: June 27, 2015, 03:17:36 PM »
Hello
I am working on a game using the lemon engine, but for some reason whenever it is played it always works the first time then breaks the second.YoSniper discovered that the problem was with the DeathTime file, but I can't find anything wrong with it. If someone could help me with this error, I would really appreciate it. :IceFairy:

SaveDeathTime:
Note: R) = R ) (noSpace)
(click to show/hide)


LoadDeathTime:
(click to show/hide)

« Last Edit: June 27, 2015, 03:50:59 PM by RandomFangamer »




:ItsBoshyTime: o o o o o :denProgress: o o o o o :paraKid:

WetWookie

  • Cherry Eater
  • Posts: 90
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Firefox 38.0 Firefox 38.0
    • View Profile
  • Playstyle: Keyboard
Re: Weird DeathTime Error
« Reply #1 on: June 27, 2015, 03:59:58 PM »
It looks like the array indexing got removed from both.
Try these

Code: [Select]
//�o�C�i���`���Ž��S�”‚Œo�Ž��‚�‘�
var f,i,tem;
f = file_bin_open("DeathTime",1);
for(i = 1; i <= 3; i += 1){
 
  tem = global.death[i];
  file_bin_write_byte(f,floor(tem/1000000));
  tem -= floor(tem/1000000)*1000000;
  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 = global.time[i];
  file_bin_write_byte(f,floor(tem/1000000));
  tem -= floor(tem/1000000)*1000000;
  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 = global.microtime[i];
  file_bin_write_byte(f,floor(tem/1000000));
  tem -= floor(tem/1000000)*1000000;
  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.L);
file_bin_write_byte(f,global.R);
file_bin_write_byte(f,global.stopMusic);
file_bin_close(f);

Code: [Select]
var f,i;
if(file_exists("DeathTime") == false){
  f = file_bin_open("DeathTime",1);
  for(i = 1; i <= 3; i += 1){
   
    file_bin_write_byte(f,global.death[i]);
    file_bin_write_byte(f,global.death[i]);
    file_bin_write_byte(f,global.death[i]);
    file_bin_write_byte(f,global.death[i]);
   
    file_bin_write_byte(f,global.time[i]);
    file_bin_write_byte(f,global.time[i]);
    file_bin_write_byte(f,global.time[i]);
    file_bin_write_byte(f,global.time[i]);
   
    file_bin_write_byte(f,global.microtime[i]);
    file_bin_write_byte(f,global.microtime[i]);
    file_bin_write_byte(f,global.microtime[i]);
    file_bin_write_byte(f,global.microtime[i]);
  }
  file_bin_close(f);
}else{
  f = file_bin_open("DeathTime",0);
  for(i = 1; i <= 3; i += 1){
   
    global.death[i] = file_bin_read_byte(f)*1000000;
    global.death[i] += file_bin_read_byte(f)*10000;
    global.death[i] += file_bin_read_byte(f)*100;
    global.death[i] += file_bin_read_byte(f);
   
    global.time[i] = file_bin_read_byte(f)*1000000;
    global.time[i] += file_bin_read_byte(f)*10000;
    global.time[i] += file_bin_read_byte(f)*100;
    global.time[i] += file_bin_read_byte(f);
   
    global.microtime[i] = file_bin_read_byte(f)*1000000;
    global.microtime[i] += file_bin_read_byte(f)*10000;
    global.microtime[i] += file_bin_read_byte(f)*100;
    global.microtime[i] += file_bin_read_byte(f);
  }
global.L = file_bin_read_byte(f);
global.R = file_bin_read_byte(f);
global.music = file_bin_read_byte(f);
  file_bin_close(f);
}
« Last Edit: June 27, 2015, 04:03:14 PM by WetWookie »