PDA

View Full Version : Create maps script



bond007
03-26-2007, 08:18 PM
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.



' 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

tanner
03-26-2007, 11:23 PM
Might be wrong here, but too bad you picked a programming language that most showeq people and showeq-map people won't be able to use.

Fatal
03-27-2007, 05:43 PM
Wouldn't you just save it and then run wscript?




To Run Scripts Using the Windows-Based Script Host (Wscript.exe)
1. At a command prompt type wscript.exe, and then press ENTER.
2. Set the script host properties you want, and then click OK.
3. In Windows Explorer or My Computer, double-click the script file you want to run.
NOTE: If you double-click a script file whose extension has not yet been associated with Wscript.exe, an Open With dialog box appears, prompting you for the program that should be used to open the file. After you choose Windows Based Script Host (wscript.exe), if you select the Always use this program to open these files check box, Wscript.exe is registered as the default program for all files having the same extension as the one you double-clicked.

You can also set properties for an individual script by right-clicking a script file in My Computer or Windows Explorer, clicking Properties, and then clicking the Script tab.



?

bond007
03-27-2007, 06:27 PM
To run just save the code as a .vbs file (vbs files can be dangerous) and double click it. pretty much anyone that plays EQ runs it on a win2k or winXP box. WSH is installed by default on XP and I think it was on 2K also. I wrote it for windows because I download the maps to my gaming box to use in game and when the seq is not available to me. Converting them on the windows box and then scp'in them takes less effort than to download them twice. and it may be friendlier to our windows community( I work in linux all day everyday ). I'll try to do a quick bash script and post it when i get the time.

Cryonic
03-27-2007, 09:55 PM
http://showeq.net/forums/showthread.php?t=4429
http://showeq.net/forums/showthread.php?t=3126
http://showeq.net/forums/showthread.php?p=29330#post29330
http://showeq.net/forums/showthread.php?t=3556

purple
03-28-2007, 06:58 AM
The first script you linked turns grey0 to black in the showeq maps available from mapfiend. Except mapfiend doesn't make available showeq maps any longer. So that's useless.

Your second, third, and fourth links turn an EQ map into a showeq map. This is all well and good, but not at all what the script in this thread does.

None of them do what the original post in this thread does, which is to take multiple EQ maps (for the 4 separate layers in the EQ map window) and combine them into one layer while changing black lines to be 128, 128, 128 (a darkish gray). This combined map is then suitable for running through the above linked awk scripts or just opening directly in showeq, which will convert EQ maps to showeq maps. The benefit of the awk scripts is batchability.

Chains20
04-19-2007, 01:23 PM
Thanks for the script, bond007.

Would I be correct that after running this the files just have to be copied to /usr/share/showeq/maps and renamed to *.map thus?


cd /usr/share/showeq/maps
for x in `ls *.txt | cut -d '.' -f1`
do
mv $x.txt $x.map
done

Fatal
04-20-2007, 04:04 PM
You don't have to rename it. You just move it to you map folder or point seq to where your maps are now.

I would recommend optimizing the map after you combine them. SOE supplies base level maps for some zones and it is basically an exact clone of the layer 1 maps from Mapfiend. Map files are big enough as it is due to SOE's automap feature. No point in having a complete second map in there.

Razzle
01-01-2008, 08:14 PM
I took the vbs script a step further. I had problems with it not working right. So I made it combine the layers of SOE maps, and convert them to SEQ format.
Just unzip it to a folder with the maps you are converting, and run it. Its a windows VBScript.

Enjoy

Razzle

uRit1u2CBBA=
01-01-2008, 10:07 PM
Does that handle the black lines to white? I may take that as pseudo-code and write something in C for myself that's a little easier to use than the perl script I've been using to re-color (and using SEQ to convert the maps).

Razzle
01-02-2008, 06:39 AM
It handles black to white. I was just playing with wscript when I did it. I will convert it over to c if I get a chance.

Razzle

BlueAdept
01-02-2008, 11:04 AM
Holy old threads batman....

This is probably the simplest script to convert the maps. It was done by ksmith



#!env perl -pi

# Description: Converts black lines and points in EQ-style maps to black.
# Usage: whitelines.pl file [file2 file3 ...]

s/(,\s*0){3}(\s*)$/, 255, 255, 255$2/;

uRit1u2CBBA=
01-02-2008, 12:30 PM
yeah, I use a variant of that for changing colors - but it would be nice to have a one-step conversion utility to go from EQ maps to SEQ maps. Right now, it's about a 3 or 4 step process.

BlueAdept
01-02-2008, 01:00 PM
other than changing black to white, what else do you need it to do?

For me it was a one step process. I just have all the 1's, then run the perl script on *.txt

uRit1u2CBBA=
01-02-2008, 02:26 PM
I had run it through SEQ to re-format the maps in that format in addition to color changing.

cann
01-18-2008, 03:30 AM
thanks bond007 and Razzle for the script(s) its works and very easy to use. just what i been looking for =)