From 9af897350d3aa98832e45283050a110ae34b0716 Mon Sep 17 00:00:00 2001 From: NC Date: Wed, 15 May 2024 17:54:40 +0300 Subject: [PATCH 1/2] DebugMsg fix --- .../Scripts/Builtin Scripts/DebugMsg.csx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx b/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx index 1fe1142c0..6f279e22f 100644 --- a/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx +++ b/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx @@ -1,23 +1,23 @@ -ScriptError("This script is temporarily disabled as it doesn't work properly, causing the game to crash, sorry about that."); -return; +EnsureDataLoaded(); +ScriptMessage("DebugMsg - Displays dialogue messages\nwhile debug mode is enabled.\n\nAuthor: krzys-h, Kneesnap"); -if (false) -{ - EnsureDataLoaded(); - ScriptMessage("DebugMsg - Displays dialogue messages\nwhile debug mode is enabled.\n\nAuthor: krzys-h, Kneesnap"); +var code = Data.GameObjects.ByName("obj_time").EventHandlerFor(EventType.Draw, EventSubtypeDraw.DrawGUI, Data.Strings, Data.Code, Data.CodeLocals); - var code = Data.GameObjects.ByName("obj_time").EventHandlerFor(EventType.Draw, EventSubtypeDraw.DrawGUI, Data.Strings, Data.Code, Data.CodeLocals); - - code.ReplaceGML(@" +code.AppendGML(@" if (global.debug == 1) { draw_set_color(0xFFFF); - for (var i = 0; i < 100; i++) - draw_text(50, (i * 15) + 50, global.msg[i]); - + var trueI = 0 + for (var i = 0; i < array_length_1d(global.msg); i++) + { + if ((!(global.msg[i] == ""%%%"")) && (!(global.msg[i] == ""%%"")) && (!(global.msg[i] == ""%""))) + { + trueI++ + draw_text(50, (trueI * 15 + 50), global.msg[i]) + } + } with (OBJ_WRITER) draw_text(70, 30, mystring); }", Data); - ChangeSelection(code); - ScriptMessage("DebugMsg - Finished."); -} \ No newline at end of file +ChangeSelection(code); +ScriptMessage("DebugMsg - Finished."); \ No newline at end of file From 5b93bc9ad677c0b3c1763b196ce366d5daeecbb4 Mon Sep 17 00:00:00 2001 From: NC Date: Sat, 1 Jun 2024 20:36:54 +0300 Subject: [PATCH 2/2] Update DebugMsg.csx --- .../Scripts/Builtin Scripts/DebugMsg.csx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx b/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx index 6f279e22f..fb111c9c7 100644 --- a/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx +++ b/UndertaleModTool/Scripts/Builtin Scripts/DebugMsg.csx @@ -4,19 +4,19 @@ ScriptMessage("DebugMsg - Displays dialogue messages\nwhile debug mode is enable var code = Data.GameObjects.ByName("obj_time").EventHandlerFor(EventType.Draw, EventSubtypeDraw.DrawGUI, Data.Strings, Data.Code, Data.CodeLocals); code.AppendGML(@" -if (global.debug == 1) { - draw_set_color(0xFFFF); - var trueI = 0 +if global.debug +{ + draw_set_color(c_white); + var drawYPosition = 0 for (var i = 0; i < array_length_1d(global.msg); i++) { - if ((!(global.msg[i] == ""%%%"")) && (!(global.msg[i] == ""%%"")) && (!(global.msg[i] == ""%""))) + var currentMessage = global.msg[i] + if ((!(currentMessage == ""%%%"")) && (!(currentMessage == ""%%"")) && (!(currentMessage == ""%""))) { - trueI++ - draw_text(50, (trueI * 15 + 50), global.msg[i]) + drawYPosition++ + draw_text(10, (drawYPosition * 15 + 50), currentMessage) } } - with (OBJ_WRITER) - draw_text(70, 30, mystring); }", Data); ChangeSelection(code);