Results 1 to 15 of 16

Thread: Create maps script

Threaded View

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    2

    Create maps script

    Here a quick script I wrote to combine the layers and convert black liines to gray. Just download all the maps you want from mapfiend and run this on your windows box and it will create a new folder where ever you run it from and place a combined layer map for each zone in that folder.

    Code:
    ' Combines layers and converts black lines to Grey
    
    Dim sZone
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    ForReading = 1
    
    'You can comment out the line below and then uncomment the next 
    'line and put a path in if you wish to set the path static.
    Path = InputBox("Enter the path to the maps directory.", "path to Maps", "")
    'Path = "C:\Documents and Settings\user\Desktop\test"
    
    Set Folder = FSO.GetFolder(Path)
    Set ColFiles = Folder.Files
    
    if fso.folderexists("New Maps") then
        wscript.echo "New Maps Folder already exist."
        WScript.quit
    End If
    
    Set NewFolder = fso.CreateFolder("New Maps")
    
    For Each myFile in ColFiles
        sExtension = mid(myFile, inStr(myFile, ".") + 1, 3)
        if sExtension = "txt" then
    
            strPath = myFile.Path
            Set Test = fso.GetFile(strPath)
    
            If Test.Size > 0 Then
                Set myFile = fso.OpenTextFile(strPath, ForReading)
                strContents = myFile.ReadAll
    
                if inStr(test.Name, "_") > 0 then
                    sZone = left(test.Name, inStr(test.Name, "_") - 1)
    
                    If fso.FileExists("New Maps\" & sZone & ".txt") Then
                        Set OutFile = fso.openTextFile("New Maps\" & sZone & ".txt", 8)
                    Else
                        Set OutFile = fso.CreateTextFile("New Maps\" & sZone & ".txt", 1)
                    End If
    
                    OutFile.Writeline(replace(strContents, "0, 0, 0", "128, 128, 128"))
                    OutFile.Close
                End If
            Else
    '            Wscript.Echo strPath & " is empty."
            End If
        End If
    Next
    
    WScript.quit
    purple: Added code tags for readability
    Last edited by purple; 03-27-2007 at 06:29 AM. Reason: Added code tags for readability

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

You may post new threads
You may post replies
You may post attachments
You may edit your posts
HTML code is Off
vB code is On
Smilies are On
[IMG] code is On