Single-key toggling of debug modes
by Alex Rice · in Torque Game Builder · 06/01/2006 (11:21 pm) · 1 replies
Using this script you can use the number pad 0-5 keys to rapidly turn on and off the various scenegraph debug modes. Hope it is useful for someone.
function MLtoggleDebugInfo( %pLevel )
{
// replace with your sceneGraph name
%tSceneGraph = MLEggsSceneGraph;
// toggle the scenegraph setting
if( %tSceneGraph.getDebugOn( %pLevel ))
%tSceneGraph.setDebugOff( %pLevel );
else
%tSceneGraph.setDebugOn( %pLevel );
// provide some feedback
switch(%pLevel)
{
case 0:
%tDescr = "Statistics Debug Banner";
case 1:
%tDescr = "Bounding, Collision, and Clipping Boxes";
case 2:
%tDescr = "Mount Nodes";
case 3:
%tDescr = "Mount Force Lines";
case 4:
%tDescr = "World Limit";
case 5:
%tDescr = "Collision Bounds";
}
if (%tSceneGraph.getDebugOn( %pLevel ))
%tDescr = %tDescr NL "ON";
else
%tDescr = %tDescr NL "OFF";
MessagePopup("SceneGraph Debug", %tDescr );
schedule(800, 0, CloseMessagePopup);
}
if ($runWithEditors)
{
GlobalActionMap.bindCmd(keyboard, "shift escape", "", "quit();"); // doesn't work in DebugActionMap?
new ActionMap(DebugActionMap);
DebugActionMap.bindCmd(keyboard, "f5", "", "runGame();");
DebugActionMap.bindCmd(keyboard, "numpad0", "", "MLtoggleDebugInfo(0);");
DebugActionMap.bindCmd(keyboard, "numpad1", "", "MLtoggleDebugInfo(1);");
DebugActionMap.bindCmd(keyboard, "numpad2", "", "MLtoggleDebugInfo(2);");
DebugActionMap.bindCmd(keyboard, "numpad3", "", "MLtoggleDebugInfo(3);");
DebugActionMap.bindCmd(keyboard, "numpad4", "", "MLtoggleDebugInfo(4);");
DebugActionMap.bindCmd(keyboard, "numpad5", "", "MLtoggleDebugInfo(5);");
DebugActionMap.push();
}About the author
Torque Owner Alex Rice
Default Studio Name
DebugActionMap.bindCmd(keyboard, "ctrl numpad0", "", "MLtoggleDebugInfo(0);"); DebugActionMap.bindCmd(keyboard, "ctrl numpad1", "", "MLtoggleDebugInfo(1);"); DebugActionMap.bindCmd(keyboard, "ctrl numpad2", "", "MLtoggleDebugInfo(2);"); DebugActionMap.bindCmd(keyboard, "ctrl numpad3", "", "MLtoggleDebugInfo(3);"); DebugActionMap.bindCmd(keyboard, "ctrl numpad4", "", "MLtoggleDebugInfo(4);"); DebugActionMap.bindCmd(keyboard, "ctrl numpad5", "", "MLtoggleDebugInfo(5);");