ET Trial henesy Posted October 1, 2024 ET Trial Posted October 1, 2024 Not sure if this is useful to anyone else or if a better option exists, but I use this to generate my map rotation server files from all maps in a directory: https://git.sr.ht/~henesy/et-utils/tree 4 Quote
TomekKromek Posted October 2, 2024 Posted October 2, 2024 Cool that you shared this and showed how something can be automated. Could you also explain how to run it and how it works? Not everyone is a programmer, and maybe someone might want to use it. There's a bit of a problem with the script, though. It doesn't account for the fact that pk3 package names don't match the .bsp names, so the script won't work. Sometimes a pk3 can have more than one map, or none at all, because someone could’ve thrown in a random pk3 that just changes character looks. If you uploaded that to the server, it could crash. It’d be great if you could add a check in each file to see what bsp files are inside. unzip -l etdo_f2.pk3 | grep .bsp | cut -d'/' -f2 OUTPUT: etdo1.bsp etdo2.bsp etdo3.bsp etdo4.bsp etdo5.bsp etdo6.bsp etdotj.bsp 1 2 Quote
ET Trial henesy Posted October 2, 2024 Author ET Trial Posted October 2, 2024 Thanks! This is super helpful. I did not know about the '.bsp' file distinction, probably explains my server instability problems I *think* the latest commit should follow your advice, the example command was very helpful: https://git.sr.ht/~henesy/et-utils/commit/f66cd30f4526e9f6c20677a57aee3f3ffbe28611 README also present now for ease of reference with examples: https://git.sr.ht/~henesy/et-utils 2 Quote
phir0x Posted October 2, 2024 Posted October 2, 2024 (edited) Nice one I use a python script for the same, saves a lot of time editing manually. ///// import os import zipfile pk3_dir = r"C:\Users\Phirox\Downloads\pk3" pk3_files = [f for f in os.listdir(pk3_dir) if f.endswith(".pk3")] #get .bsp name from a pk3 file def get_bsp_name(pk3_file): with zipfile.ZipFile(pk3_file, 'r') as zip_ref: bsp_files = [f for f in zip_ref.namelist() if f.endswith(".bsp")] if bsp_files: # Return the first .bsp file found return os.path.splitext(os.path.basename(bsp_files[0]))[0] return None config_lines = [] for i, pk3_file in enumerate(pk3_files, 1): pk3_path = os.path.join(pk3_dir, pk3_file) bsp_name = get_bsp_name(pk3_path) if bsp_name: next_map = f"d{i+1}" if i < len(pk3_files) else "d1" config_lines.append(f'set d{i} "set g_gametype 6 ; map {bsp_name}; set nextmap vstr {next_map}"') else: print(f"Warning: No .bsp file found in {pk3_file}") config_lines.append("vstr d1") with open("map_rotation.cfg", "w") as f: f.write("\n".join(config_lines)) print("Config file generated: map_rotation.cfg") /////// for example see screens Edited October 2, 2024 by phir0x spaces 2 1 Quote
ET Trial henesy Posted October 2, 2024 Author ET Trial Posted October 2, 2024 Ah excellent! Looks like we do more or less the same thing! One thing I haven't looked at, but would like to is if there are any other rotations than mapvote and plain ol' ordinal rotation that I should account for. I haven't used any others, I only really play mapvote on my own servers. 1 Quote
phir0x Posted October 3, 2024 Posted October 3, 2024 (edited) I don't think that will be used much. But if I understand you correctly you mean this right ? This was a simple adjustment though. The prompt: print("Select the gametype:") print("2 = Objective, 3 = Stopwatch, 4 = Campaign, 5 = LMS, 6 = Mapvote") gametype = input("Enter the gametype number (e.g., 6 for Mapvote): ") The validation: if gametype not in ['2', '3', '4', '5', '6']: print("Invalid gametype selected. Defaulting to '6 = Mapvote'.") gametype = '6' Config generation: config_lines.append(f'set d{i} "set g_gametype {gametype} ; map {bsp_name}; set nextmap vstr {next_map}"') Edited October 3, 2024 by phir0x spaces Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.