Petition for autorun directory and set of useful hooks for GMod main menu.

Copy and pasted from the Mantis page.

I know that many people have thought of, requested and tried to make accessories for the start-up menu. Unfortunately, none of them progressed far due to the lack of support.
If there was an autorun directory for the menu, a small set of hooks (some handy ones listed in additional information), the needed set of libraries (math, string, etc), and the possibility to load your own libraries/modules, I’m sure some awesome addons would appear.

There’s lots of ideas, including:

  • Custom server browser
  • Custom friends network (These are more wanted than you think!)
  • New options for starting single player and listen server matches (Such as wire limit convars)
  • New ‘settings’ windows
  • Music players (MuseX, WinAmp interface)
  • (More coming when I’m not so tired, Facepunchers, suggest more!)
    The ideas go on!

A good use of having a menu Lua environment is that (I think) it stays loaded even when the client/server Lua environments are created and destroyed. That means that music players such as MuseX can stay open in the menu Lua environment without having to be reloaded every map change/server connect.

With new ‘settings’ windows and new settings for game-startup-panes, this is were some handy hooks would come in.
I can think of some hooks such as GenerateGameConVarList and GenerateGModSettingsTabs that are called like the BuildCPanel hook where you can add the wanted objects/panels/etc.

I’m hoping that this will get some consideration.
I’ll make a post in the Lua forum to get some support.

Ideas for hooks:

  • GenerateGameConVarList: Explained above.
    Possible use: Adding Wire (and other mods) limit convars to the settings list.

  • GenerateGModSettingsTabs: Explained above. The DPropertySheet that you use (if that is what you use) should be given as an argument so that people can add tabs.
    Possible use: Making use of a generic settings window to keep all game settings together in one place.

  • PreBuildServerList: Called when a server-list query is sent to the master server(s). A table of params such as tags and filters should be given as arguments. It should work like the CalcView hook, where people can return an edited version of the table.
    Possible use: Custom server browser.

  • PostBuildServerList: Just like Pre except it’s called post (obviously) and has a table of all the servers on the list (that may or may not work like the CalcView hook).
    Possible use: Custom server browser.

  • PreQueryServer: Called just as a server is about to be queried with the IP and Port. Should be able to return true to stop the query.
    Possible use: See phenex’s hidefakes module: [^]

  • PostQueryServer: Called after a server has been queried with all the returned info in a table as an argument. Should work like the CalcView hook.
    Possible use: Custom server browser.

  • GameInitialize: Called when the client-side Lua environment has initialized. This can be handy for doing game-related stuff only when the client is in a game, and not in the menu.
    Possible use: Creating a dynamic music mod that works in the menu as a standard music player and in game with the action music, spooky music, etc

  • GameShutdown: See above.

Ideas for functions:

  • RefreshServerList(bool not_quick_refresh, table filter, string tags)
    Returns: nothing
  • QueryServer(string ip, integer port)
    Returns: nothing

For the good of making better stuff for GMod, say yes!

I’d love to interact with the menu without having to use modules, so I’m game for this, but I can’t see any long-term benefit for this for gamemodes or development.


I concur.

Ground Zero Hosting

I would say yes, I may not understand or may never use all of these, but they do look useful.

I don’t think it’s possible to run Lua while you’re connecting to a server.

Please re-read what I said and think about it.

From what I’ve observed, there are three Lua environments:

  • Client-side
  • Server-side
  • Menu

The Menu environment, I believe, is always active and is only cleared on the closing of GMod.

Weren’t threads with “petition” in them bannable? But yeah, since we have(mostly) everything for the game, it’s time to move on to the menu.


It is always active. Create singleplayer and multiplayer menus are all made in Lua. Just in a seperate instance.

I agree, this stuff would be very nice to have.

Doubt it will happen, but maybe just maybe Garry will be nice to us.

Would definitely produce some interesting addons, I too am all for it.


I meant actually running Lua while it’s loading the map. I don’t think there are available resources for that.

I want the in-game mod manager back, that thing was awesome.

this. It’d be quite nice actually.

Have you seen the loading menu? The one with the gmod logo and the spinning balls?

You can probably setup some custom hooks by overwriting some functions in the various lua/menu functions but having some built in hooks would be good. The only problem with the lua menu state is that it doesn’t interact with any other lua states. So if you have 1 part of your script in lua/menu and the other part in lua/autorun it just wouldn’t work. Everything is sort of local’D to the current state.

The loading menu was made in Lua:

Why dont you just replace the existing lua files which from the main menu is buildt from and make sure that the replacing lua file actually just runs all other scripts in something autorun folder.

With this method you should be even able to add shortcut buttons to your main menu which run whatever command they’re made to run. Eg: Join something specific server.

I’m pretty sure the files get replaced with the original ones.

This sound like a good idea, it could save a lot of time joining servers only problem, is if it encounters a problem as it could render gmod into a more crashable state.