UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 8

239

CommandDebugPages(2)=(PageName="Collision |
Pathfinding", PageCommands[0]=
(CommandName=" Show Collision",Command="ShowDebug
COLLISION"),PageCommands[1]=(CommandName=" Show
Paths",Command="Show PATHS"))
}

It looks like a lot is thrown at you at once, so let's break it down carefully.
We've already seen CurrentPage and CurrentIndex used as local variables
in the preceding functions, so we're aware of what they do.
CommandDebugPages is an array of our pages, or screens. We set the name of the
page to be relevant to whatever we will fill the page with. For example, the third one is
called Collision | Pathfinding as it holds all of our debug functions for those
two categories.
Next, we add the command name as we want it displayed, for example, Show
Collision. Following that we issue the actual command. These can be found
in the UDKInput.ini file, so feel free to browse through those to find more.


  1. Let's bind our inputs now, so that we can execute the functions we just created.
    Open up your DefaultInput.ini file, located at UDK/DirectoryName/
    UDKGame/Config.
    ;----------------------- -----------------------------------------
    ; CUSTOM BINDINGS FOR TUTORIALS
    ;----------------- -----------------------------------------------
    ;Bindings for Debug Menu
    .Bindings=(Name="GBA_ToggleDebug" ,Command="ToggleDebug")
    .Bindings=(Name="H" ,Command="GBA_ToggleDebug")
    .Bindings=(Name="GBA_NextItem" ,Command="NextItem")
    .Bindings=(Name="I" ,Command="GBA_NextItem")
    .Bindings=(Name="GBA_PreviousItem" ,Command="PreviousItem")
    .Bindings=(Name="U" ,Command="GBA_PreviousMenuItem")
    .Bindings=(Name="GBA_DoDebugCommand" ,Command="DoDebugCommand")
    .Bindings=(Name="O" ,Command="GBA_DoDebugCommand")
    .Bindings=(Name="GBA_DebugBack" ,Command="DebugBack")
    .Bindings=(Name="P" ,Command="GBA_DebugBack")


You could obviously bind the functions to any key of your choice, but I found that
these work well for me. I use H to bring up my menu, and navigate with my I, U, O,
and P keys.
Alternatively, you could just as easily bind these to the game pad.
Free download pdf