UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 8

235

We define the maximum number of pages available, as shown by IndexMax,
and changing its value depending on how far we've scrolled in the list.


  1. We're going to need a way to get in and out of the pages. Let's add the following
    code snippet for executing the chosen debug item:
    /*****

    • Executes chosen debug item
      ***/
      exec function DoDebugCommand()
      {
      local DebugCommand command;
      if (bShowDebugMenu)
      {
      /* Leave menu & execute the chosen cmnd /
      if (CurrentPage != -1)
      {
      command = CommandDebugPages[CurrentPage].
      PageCommands[CurrentIndex];
      ToggleDebug();
      ConsoleCommand(command.Command);
      }
      else
      {
      /
      Next page */
      CurrentPage = CurrentIndex;
      CurrentIndex = 0;
      }
      }
      }




Add the following code snippet to come out of the selected page:
/*****************************************************************
* Back out of currently selected page
*****************************************************************/
exec function DebugBack()
{
if (bShowDebugMenu)
{
if (CurrentPage != -1)// We're at the main menu
{
CurrentPage = -1;
CurrentIndex = 0;
}
Free download pdf