Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChapterMaster.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@
{"id":{"name":"spr_fleet_inquisition","path":"sprites/spr_fleet_inquisition/spr_fleet_inquisition.yy",},},
{"id":{"name":"spr_tooltip1","path":"sprites/spr_tooltip1/spr_tooltip1.yy",},},
{"id":{"name":"spr_fleet_chaos","path":"sprites/spr_fleet_chaos/spr_fleet_chaos.yy",},},
{"id":{"name":"__init_external","path":"scripts/__init_external/__init_external.yy",},},
{"id":{"name":"spr_fleet_ork","path":"sprites/spr_fleet_ork/spr_fleet_ork.yy",},},
{"id":{"name":"spr_fleet_necron","path":"sprites/spr_fleet_necron/spr_fleet_necron.yy",},},
{"id":{"name":"spr_fleet_tau","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},},
Expand Down
5 changes: 0 additions & 5 deletions objects/obj_controller/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,6 @@ if (window_get_fullscreen()=1){
cheatcode=0;
cheatyface=0;
// ** Debugging file created **
debug_lines=0;
ini_open("debug_log.ini");
debug_lines=ini_read_real("Main","lines",0);
ini_close();

debugl("=========Controller Created");
// ** Creates saves.ini with default settings **
ini_open("saves.ini");
Expand Down
22 changes: 0 additions & 22 deletions objects/obj_main_menu/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ tim3=0;
tim4=0;
tim5=0;

if (!directory_exists("ErrorLogs")) {
directory_create("ErrorLogs");
}


// TODO: maybe replace the OG debug_log.ini with something like this.
// if (!directory_exists("SessionLogs")) {
// directory_create("SessionLogs");
Expand All @@ -146,23 +141,6 @@ if (!directory_exists("ErrorLogs")) {
// file_text_close(global.session_log_file);


global.build_date = "unknown build";
global.game_version = "unknown version";

var _version_file_path = working_directory + "\\main\\version.json";
var _parsed_json = json_to_gamemaker(_version_file_path, json_parse);

if (_parsed_json != undefined) {
var _build_date = _parsed_json[$ "build_date"];
_build_date = string_replace(_build_date, "BS", "");
_build_date = string_replace(_build_date, "BE", "");
var _version = _parsed_json[$ "version"];
_version = string_replace(_version, "VSv", "");
_version = string_replace(_version, "VE", "");
global.build_date = _build_date;
global.game_version = _version;
}

/* */
action_set_alarm(1, 3);
action_set_alarm(30, 4);
Expand Down
40 changes: 40 additions & 0 deletions scripts/__init_external/__init_external.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
gml_pragma( "global", "__init_external();");

function __init_external() {
// Delete leftover files from old versions;
// Remove these lines after a couple of months;
// ========================
if (directory_exists("ErrorLogs")) {
directory_destroy("ErrorLogs");
}
if (file_exists("debug_log.ini")) {
file_delete("debug_log.ini");
}
if (file_exists("message_log.log")) {
file_delete("message_log.log");
}
// ========================

if (!directory_exists("logs")) {
directory_create("logs");
}
var _log_file = file_text_open_write($"logs/last_messages.log");
file_text_close(_log_file);

global.build_date = "unknown build";
global.game_version = "unknown version";

var _version_file_path = working_directory + "\\main\\version.json";
var _parsed_json = json_to_gamemaker(_version_file_path, json_parse);

if (_parsed_json != undefined) {
var _build_date = _parsed_json[$ "build_date"];
_build_date = string_replace(_build_date, "BS", "");
_build_date = string_replace(_build_date, "BE", "");
var _version = _parsed_json[$ "version"];
_version = string_replace(_version, "VSv", "");
_version = string_replace(_version, "VE", "");
global.build_date = _build_date;
global.game_version = _version;
}
}
11 changes: 11 additions & 0 deletions scripts/__init_external/__init_external.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions scripts/__init_global/__init_global.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ function __init_global() {
// set any global defaults
layer_force_draw_depth(true,0); // force all layers to draw at depth 0
draw_set_colour( c_black );


}
36 changes: 6 additions & 30 deletions scripts/debugl/debugl.gml
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
function debugl(argument0) {

// argument0: string to add to debug log

if (instance_exists(obj_controller)){
obj_controller.debug_lines+=1;

var numeral;numeral="";
if (obj_controller.debug_lines<10) then numeral="0000"+string(obj_controller.debug_lines);
if (obj_controller.debug_lines>=10) and (obj_controller.debug_lines<100) then numeral="000"+string(obj_controller.debug_lines);
if (obj_controller.debug_lines>=100) and (obj_controller.debug_lines<1000) then numeral="00"+string(obj_controller.debug_lines);
if (obj_controller.debug_lines>=1000) and (obj_controller.debug_lines<10000) then numeral="0"+string(obj_controller.debug_lines);
if (obj_controller.debug_lines>=10000) and (obj_controller.debug_lines<100000) then numeral=string(obj_controller.debug_lines);

ini_open("debug_log.ini");
ini_write_real("Main","lines",obj_controller.debug_lines);
// ini_write_string("Main",string(obj_controller.debug_lines),string(argument0));
ini_write_string("Main",string(numeral),string(argument0));
ini_close();
}

if (!instance_exists(obj_controller)){
ini_open("debug_log.ini");
var dbl;dbl=ini_read_real("Main","lines",0)+1;
ini_write_real("Main","lines",dbl);
ini_write_string("Main",string(dbl),string(argument0));
ini_close();
}


/// @desc Writes a string into the last_messages.log.
/// @param {string} _string
function debugl(_string) {
var _log_file = file_text_open_append("logs/" + $"last_messages.log");

file_text_write_string(_log_file, _string + "\n");
file_text_close(_log_file);
}
1 change: 1 addition & 0 deletions scripts/macros/macros.gml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ function macros() {
#macro DEFAULT_TOOLTIP_VIEW_OFFSET 32
#macro DEFAULT_LINE_GAP -1
#macro LB_92 "############################################################################################"
#macro START_DATE_TIME_1 $"{current_day}-{current_month}-{current_year}-{current_hour}{current_minute}{current_second}"

enum luck {
bad = -1,
Expand Down
8 changes: 4 additions & 4 deletions scripts/scr_log/scr_log.gml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// @function log_into_file
/// @description Creates an error_log file in ErrorLogs folder and puts _message there.
/// @description Creates an error file in the logs folder and puts _message there.
/// @param {string} _message string to put into the error log.
function log_into_file(_message) {
if (string_length(_message) > 0) {
var _entry = string(_message);
var _date_time = $"{current_day}-{current_month}-{current_year}_{current_hour}{current_minute}{current_second}";
var _log_file = file_text_open_write("ErrorLogs/" + $"error_{_date_time}.log");
var _date_time = $"{START_DATE_TIME_1}";
var _log_file = file_text_open_write("logs/" + $"{_date_time}_error.log");

file_text_write_string(_log_file, _entry);
file_text_close(_log_file);
Expand All @@ -32,7 +32,7 @@ function handle_exception(_exception, custom_title = STR_error_message_head, cus
#macro STR_error_message_head "Your game just encountered and caught an error :("
#macro STR_error_message_head2 "Your game just encountered a critical error :("
#macro STR_error_message_head3 "Your game just encountered and caught an error ({0}) :("
#macro MSG_error_message $"The error log is automatically copied into your clipboard and a copy is created at: \nC:>Users>(UserName)>AppData>Local>ChapterMaster>ErrorLogs \n\nPlease, do the following: \n\n1) Create a bug report on the bug-report-forum in our 'Chapter Master Discord' server. \n\n2) Press CTRL+V to paste the error log into the bug report. \n\n3) Title your report by cutting and pasting the first line of the main message (it contains game version and file that caused the error). \n\n4) If for some reason the error log wasn't pasted, find the location that is mentioned above and attach the latest (sort by time) error_*date-time*.log to your bug report. In this case you can name your report as you wish. \n\n\nThank you :)"
#macro MSG_error_message $"The error log is automatically copied into your clipboard and a copy is created at: \nC:>Users>(UserName)>AppData>Local>ChapterMaster>ErrorLogs \n\nPlease, do the following: \n\n1) Create a bug report on the bug-report-forum in our 'Chapter Master Discord' server. \n\n2) Press CTRL+V to paste the error log into the bug report. \n\n3) Title your report by cutting and pasting the first line of the main message (it contains game version and file that caused the error). \n\n4) If for some reason the error log wasn't pasted, find the location that is mentioned above and attach the latest (sort by time) _error.log to your bug report. In this case you can name your report as you wish. \n\n\nThank you :)"
#macro MSG_error_message_ps $"P.S. You can ALT-TAB and try to continue playing - if the error is not severe, the game should continue working, just try to avoid what caused it. \n\nBut it's recommended to wait for a response on the bug-report forum, otherwise you may make the issue worse."

var _popup_header = $"{custom_title}\n\n";
Expand Down