From 384fd0cca18e06588426b642e2070c5ed84bd8ff Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Thu, 20 Feb 2025 02:05:31 +0100 Subject: [PATCH] Allow GUI scripts to do debug printing to the console Example: onActivate { set "print" "this windowDefs rect:" "$rect"; } (added to the Desktop of a GUI) prints "GUI debug: this windowDefs rect: 0 0 640 480" to the ingame console --- neo/ui/GuiScript.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/neo/ui/GuiScript.cpp b/neo/ui/GuiScript.cpp index 488420fe..5c208c52 100644 --- a/neo/ui/GuiScript.cpp +++ b/neo/ui/GuiScript.cpp @@ -63,6 +63,18 @@ void Script_Set(idWindow *window, idList *src) { } return; } + + // DG: allow debugprinting to the console with `set "print" "this windowDefs rect:" "$rect"` + if (idStr::Icmp(*dest, "print") == 0) { + idStr msg; + int parmCount = src->Num(); + for (int i=1; ic_str(); + msg += " "; + } + common->Printf("GUI debug: %s\n", msg.c_str()); + return; + } } (*src)[0].var->Set((*src)[1].var->c_str()); (*src)[0].var->SetEval(false);