Fix Torque GUI new() syntax (no global assignment)

This commit is contained in:
RallyBlock committed 2026-11-09 05:51:30 -05:00
1 parent 7cb33a3ebd
commit 7edd647a89
1 file changed
+13 -16
+13 -16
View File
@@ -1,4 +1,4 @@
// Client_RPG — top-down camera, click-to-move, and RPG windows for GameMode_RPG. // Client_RPG - top-down camera, click-to-move, and RPG windows for GameMode_RPG.
exec("./ui.cs"); exec("./ui.cs");
// The server probes with RPG_Probe; reply with serverCmdRPG_Hello(2) to play. // The server probes with RPG_Probe; reply with serverCmdRPG_Hello(2) to play.
@@ -91,7 +91,7 @@ function RPGClient_EnableOverlay()
{ {
return; return;
} }
%mouse = new GuiMouseEventCtrl(RPGClient_Mouse) new GuiMouseEventCtrl(RPGClient_Mouse)
{ {
className = "RPGClient_Mouse"; className = "RPGClient_Mouse";
horizSizing = "width"; horizSizing = "width";
@@ -282,7 +282,7 @@ function RPGClient_Hud_Ensure()
{ {
return; return;
} }
RPGClient_Hud = new GuiTextCtrl() new GuiTextCtrl(RPGClient_Hud)
{ {
horizSizing = "width"; horizSizing = "width";
vertSizing = "top"; vertSizing = "top";
@@ -334,35 +334,32 @@ function RPGClient_Dialog_Show(%title, %body, %sec)
function RPGClient_List_Begin(%title, %page, %pages) function RPGClient_List_Begin(%title, %page, %pages)
{ {
if (isObject(RPGClient_List)) $RPGClient::ListBody = "";
{ $RPGClient::ListTitle = %title @ " (" @ (%page + 1) @ "/" @ %pages @ ")";
RPGClient_List.delete();
}
RPGClient_List = "";
RPGClient_ListTitle = %title @ " (" @ (%page + 1) @ "/" @ %pages @ ")";
} }
function RPGClient_List_Row(%row) function RPGClient_List_Row(%row)
{ {
RPGClient_List = RPGClient_List @ %row @ "\n"; $RPGClient::ListBody = $RPGClient::ListBody @ %row @ "\n";
} }
function RPGClient_List_End() function RPGClient_List_End()
{ {
if (RPGClient_List !$= "") if ($RPGClient::ListBody !$= "")
{ {
messageBoxOK(RPGClient_ListTitle, RPGClient_List, ""); messageBoxOK($RPGClient::ListTitle, $RPGClient::ListBody, "");
} }
} }
package RPGClient_Disconnect package RPGClient_Cleanup
{ {
function disconnect() function disconnectedCleanup(%doReconnect)
{ {
RPGClient_DisableOverlay(); RPGClient_DisableOverlay();
Parent::disconnect(); RPGClient_UnbindKeys();
Parent::disconnectedCleanup(%doReconnect);
} }
}; };
activatePackage(RPGClient_Disconnect); activatePackage(RPGClient_Cleanup);
echo("Client_RPG loaded (protocol " @ $RPGClient::Version @ ")"); echo("Client_RPG loaded (protocol " @ $RPGClient::Version @ ")");