Need help for browsing and sorting out maps

Interesting mapping tools and mapping help.

Moderator: Morax

Need help for browsing and sorting out maps

Postby Scrontch » 08 Sep 2013, 11:14

Hi,
here's my problem: I have about 680 additonal third party maps installed in my maps directory. The most of it are utter crap. I want to sort them out. Problem is that the names of the map as shown in the game do not always correspond to the name of the map folder. So when i browse the maps visually from within the game, i don't always find the folder that i want to delete.

Is there any way to link the two. Ideally i would like to have a script that i run on the maps folder and gives me a list of pairs ingame-name -vs- folder-name.

Or even better, is there a way to visually browse the maps in the order of the folders, outside of the game?

Thanks,
scrontch
Scrontch
 
Posts: 4
Joined: 23 Apr 2012, 21:10
Has liked: 0 time
Been liked: 0 time

Re: Need help for browsing and sorting out maps

Postby Prince__ » 08 Sep 2013, 14:50

Well , I would delete ALL maps. The map you'll be playing you download anyways before you join the game.

But to answere your questions..,I might have an idea:
Download the unofficial map editor from hazard. If you wanna open a map it's shown with the mapname (directory path I guess) and has a picture of the map.
DL link: http://www.hazardx.com/details.php?file=76
User avatar
Prince__
Priest
 
Posts: 302
Joined: 29 Aug 2011, 11:39
Has liked: 0 time
Been liked: 4 times
FAF User Name: UES_Prince

Re: Need help for browsing and sorting out maps

Postby Deep_ » 09 Sep 2013, 20:18

If you open the folder of a map you will find the scenario.lua.
Open it with the notepad and you will see the name of the map immedientely
Deep_
Crusader
 
Posts: 13
Joined: 31 Jul 2013, 22:53
Has liked: 0 time
Been liked: 0 time
FAF User Name: Deep_

Re: Need help for browsing and sorting out maps

Postby Prince__ » 09 Sep 2013, 20:54

Deep_ wrote:If you open the folder of a map you will find the scenario.lua.
Open it with the notepad and you will see the name of the map immedientely


Thats taking alot of time.Too much time.
User avatar
Prince__
Priest
 
Posts: 302
Joined: 29 Aug 2011, 11:39
Has liked: 0 time
Been liked: 4 times
FAF User Name: UES_Prince

Re: Need help for browsing and sorting out maps

Postby Scrontch » 09 Sep 2013, 21:47

Not if you automate the task 8-)

I have written a small Python script which i want to share here:
Code: Select all
#! /usr/bin/env python
import sys, os, re
# From https://github.com/SirAnthony/slpp
import slpp

result = {}
for dirpath, dirnames, filenames in os.walk('.'):
  for filename in filenames:
    if 'scenario.lua' in filename:
      with open (os.path.join(dirpath, filename), "r") as myfile:
        filecontent = myfile.read()
        data = slpp.slpp.decode('{' + filecontent + '}')
        name = ''
        try:
          name = data['ScenarioInfo']['name']
          result[name] = dirpath
        except:
          print('Error:' + dirpath)

for name in sorted(result.iterkeys()):
  print(name + ' -> ' + result[name])


It is not perfect (it bugs on some maps that have a scenario.lua that isn't 100% lua conforming), but it is sufficient for what i am looking for.
When run from the maps folder it produces output in the form map name -> path
100_Acre_Wood -> .\100_Acre_Wood
2V2 Sand Box -> .\2v2 sand box.v0001
2v2 S_D -> .\PREMIERE MAP.v0001
2vs2 my game -> .\bob ile.v0001
[...]

Maybe it will be helpful for others too. Credits welcome! :mrgreen:
Scrontch
 
Posts: 4
Joined: 23 Apr 2012, 21:10
Has liked: 0 time
Been liked: 0 time


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest