Search code examples
unreal-development-kitunrealscript

UDK "Error, Unrecognized member 'OpenMenu' in class 'GameUISceneClient'"


Upon compiling, I am getting the following error:

C:\UDK\UDK-2010-03\Development\Src\FixIt\Classes\ZInteraction.uc(41) : Error, Unrecognized member 'OpenMenu' in class 'GameUISceneClient'

Line 41 is the following:

GetSceneClient().OpenMenu("ZInterface.ZNLGWindow");

But when I search for OpenMenu, I find that it is indeed defined in GameUISceneClient.uc of the UDK:

Line 1507: exec function OpenMenu( string MenuPath, optional int PlayerIndex=INDEX_NONE )

It looks like I have everything correct. So what's wrong? Why can't it find the OpenMenu function?


Solution

  • From the wiki page on Legacy:Exec Function:

    Exec Functions are functions that a player or user can execute by typing its name in the console. Basically, they provide a way to define new console commands in UnrealScript code.

    Okay, so OpenMenu has been converted to a console command. Great. But still, how do I execute it in code? The page doesn't say!

    More searching revealed this odd documentation page, which contains the answer:

    Now then, there is also a function within class Console called 'bool ConsoleCommand(coerce string s)'. to call your exec'd function, 'myFunction' from code, you type:

    * bool isFunctionThere; //optional
      isFunctionThere = ConsoleCommand("myFunction myArgument");
    

    So, I replaced my line with the following:

    GetSceneClient().ConsoleCommand("OpenMenu ZInterface.ZNLGWindow");
    

    Now this causes another error which I covered in my other question+answer a few minutes ago. But that's it!