Results 1 to 3 of 3
  1. #1

    Insane Limits: AUTOEXEC


    I came up with this quick and dirty "autoexec" limit as a way to make sure certain commands are run every time my BF4 server starts up.

    The way it works is just to check every 60 seconds to see if the server was recently restarted. If it finds that the server has been up for less than 10 minutes, then it will run your startup commands and set a flag indicating that it has done its work. If the limit gets triggered again within 10 minutes after startup and sees that the startup flag is set, then it will do nothing (so your commands only get run at most once after every startup). Once the uptime is more than 10 minutes, the limit resets the flag (and after that it will not do anything until the server is restarted again).

    As one example of what it's useful for: I used it to fix some weirdness that happens with my Official mode server's map list at startup. When running Official mode, the server will try to start up with a default standard map list that is all vanilla maps in whatever game mode the server is running. I use Ultimate Map Manager to manage my map rotation, which works fine 99% of the time, and it automatically upshifts and downshifts between Conquest Small and Conquest Large rotations depending on the player count.

    I noticed, however, that when the server first starts, UMM and the server try to do conflicting things with the map list, so the server often would wind up stuck on Siege of Shanghai, Conquest Large (the default Official mode first map), even though 0 or only 2-3 players were connected. To fix that, I use this script to make sure that every time the server starts up, regardless of what state it was or is in, the map list will be cleared and set to my preferred CQ Small startup rotation.


    1. Create a limit with trigger OnIntervalServer and interval 60 seconds
    2. Set first_check to Code and second_check to Disabled
    3. Add your startup commands to the code below, in the designated block, and paste the code into your new limit

    if (server.TimeUp > 600) {
    	if (plugin.Data.issetBool("_AUTOEXEC_")) {
    		plugin.ConsoleWrite("AUTOEXEC> Cleared startup flag.");
    } else if (!plugin.Data.issetBool("_AUTOEXEC_")) {
    	// Startup map list
    	//plugin.ServerCommand("mapList.add", "MP_Siege", "ConquestSmall0", "1");
    	//plugin.ServerCommand("mapList.add", "MP_Abandoned", "ConquestSmall0", "1");
    	//plugin.ServerCommand("mapList.add", "MP_TheDish", "ConquestSmall0", "1");
    	//plugin.ServerCommand("mapList.add", "MP_Naval", "ConquestSmall0", "1");
    	//plugin.ServerCommand("mapList.add", "MP_Journey", "ConquestSmall0", "1");
    	//plugin.ServerCommand("mapList.add", "MP_Tremors", "Domination0", "1");
    	//plugin.ServerCommand("mapList.setNextMapIndex", "0");
    	//plugin.ConsoleWrite("AUTOEXEC> Startup map list loaded.");
    	plugin.Data.setBool("_AUTOEXEC_", true);
    return false;
    Last edited by DownArrowMagnet; 22-09-2014 at 15:30.

  2. #2
    Considering you are using this for maplist changes, why not just modify the maplist.txt server side?

  3. #3
    Quote Originally Posted by ColColonCleaner View Post
    Considering you are using this for maplist changes, why not just modify the maplist.txt server side?
    Official mode ignores the maplist.txt entirely when it loads up and goes straight to its default rotation, which is base maps only, in the default sequence, on conquest large (for a conquest server). UMM can override that at run time, as the server is running, which works fine most of the time, and it basically does the same thing I'm doing in the limit.

    The problem is that the server might load the default map selection after UMM thinks it already has fixed things up, and then UMM won't change it back until the first round ends. And sometimes the state between the server and procon even gets weirdly out of wack, where if you query the loaded map in procon it says one thing, but if you connect to the server it's actually on the default map, not what procon thinks is loaded.

    So this limit just forces the running map list to a known state, regardless of who won the argument between UMM and Official mode over what the initial state should be.



Posting Permissions

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