Results 1 to 5 of 5

Thread: how to precache menu

  1. #1
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts

    how to precache menu

    hello i make new menu , how precache ?
    i add :

    PHP Code:
    init()
    {
        
    game["menu_ingame"] = "ingame";
        
    game["menu_status"] = "status";
        
    game["menu_team"] = "team_" game["allies"] + game["axis"];
        
    game["menu_weapon_allies"] = "weapon_" game["allies"];
        
    game["menu_weapon_axis"] = "weapon_" game["axis"];

        
    precacheMenu(game["menu_ingame"]);
        
    precacheMenu(game["menu_team"]);
        
    precacheMenu(game["menu_weapon_allies"]);
        
    precacheMenu(game["menu_weapon_axis"]);
        
    precacheMenu(game["menu_status"]); 

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    If you cannot figure out how to precache a menu by looking at the code you posted yourself, I'd advise you to look for another hobby besides cod2 scripting.

  3. #3
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    what he means, is, that precacheMenu() is already precaching the menus
    timescale 0.01

  4. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Which should be quite clear by the function name.
    Let dissect that one for a bit, shall we?

    precacheMenu() consists of 2 parts, namely:
    Code:
    precache
    and
    Code:
    Menu
    The goal of function names is to be descriptive.
    Following said convention, this function should do something with a Menu, whereas the action might be closely related to the word precache.

    As to return to your original question:
    hello i make new menu , how precache ?
    You obviously are trying to do something with menus, which might be fulfilled by the above function. As your question is on "how to precache a menu", it might be quite clear which function you need to use, not in the least because the code you quoted is indeed the stock cod2 code to precache the menus from a stock cod2 installation. The correct syntaxis is thus
    Code:
    precacheMenu(menuname_goes_here);
    Now, to return to your question about exactly how to precache menus, this is quite simple. As you know, .menu files have a filename and a title (defined within the file). These two should match (although it might be allowed to use different filenames, which could work, but make your mod much harder to debug should something fail). By then, you should have a name for that .menu file, lets call it
    Code:
    typing_this_is_actually_quite_boring
    So, by then you could recall the syntax for the precacheMenu function. To re-iterate:
    Code:
    precacheMenu(menuname_goes_here);
    As you now know the menu-name, you can call the function as follows:
    Code:
    precacheMenu("typing_this_is_actually_quite_boring");
    This should precache your menu.

    I hope this answers your question, if not, feel free not to post about it.

  5. #5
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by iznogod View Post
    if you cannot figure out how to precache a menu by looking at the code you posted yourself, i'd advise you to look for another hobby besides cod2 scripting.
    ^this^

    code10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •