PDA

View Full Version : Quick way to convert ET to HL2 ?


Smilie
19th October 2005, 16:25
Ok im going to convert capslocktrojans and my map to HL2 ready for DODS and it seems to be going ok but ive only done 21 brushes of 1500 :\

I need a quick way to turn


// brush 22
{
( -3064 264 1608 ) ( -3016 264 1608 ) ( -3016 312 1608 )
( -3016 312 1656 ) ( -3016 264 1656 ) ( -3064 264 1656 )
( -3016 320 1632 ) ( -3064 320 1632 ) ( -3064 320 1608 )
( -3064 312 1632 ) ( -3064 264 1632 ) ( -3064 264 1608 )
( -3064 264 1632 ) ( -3016 264 1632 ) ( -3016 264 1608 )
( -3016 264 1624 ) ( -3016 312 1624 ) ( -3016 312 1600 )
}


into

{
( -3032 512 1560 ) ( -2904 512 1560 ) ( -3032 160 1560 )
( -3096 512 1632 ) ( -3096 160 1632 ) ( -3096 160 1568 )
( -2904 512 1632 ) ( -3032 512 1632 ) ( -3032 512 1568 )
( -2896 160 1648 ) ( -2896 512 1648 ) ( -2896 512 1584 )
( -3032 160 1632 ) ( -2904 160 1632 ) ( -2904 160 1568 )
( -2904 512 1552 ) ( -3032 512 1552 ) ( -3032 160 1552 )
}


*edit it needs to remove the //brush no. and add a tab infront of the location of each brush

Rookie One
19th October 2005, 17:16
Why don't you write a script or a program to parse all this?

kamikazee
19th October 2005, 17:58
AWK scripting could do that. There's a free version from GNU, called gawk.

Smilie
19th October 2005, 19:04
Ok how does gawk work ? is there a download somewhere

kamikazee
19th October 2005, 19:20
If you work under Linux you can surely install it.
If it's for windows, see http://gnuwin32.sourceforge.net/packages/gawk.htm Full package installer should work.

To parse you're map file you'd use a script like this: (not guaranteed to work perfect here)
BEGIN { if( !output) output= "output.map" }
$0 ~ /{/ || $0 ~ /(/ { print "\t" $0 >output }
END{ close( output ) }
If you would save this script in a file named parsemap.awk, you would call gawk like this:
gawk -f parsemap.awk -v output="mynewmap.map" originalmap.map
If you leave the -v <variable>=<value> part, it defaults to output.map.

You see it uses a special form of the C syntax, but this scripting tool could save you quite some work.

Smilie
20th October 2005, 16:08
:D thx gonna try it now

*edit* im new to this :( when you say call gawk how do i do it.

zeh
22nd October 2005, 11:34
Or you could use any other random text editor that accepts regular expressions (regexp). Like ultraedit, among many more.

kamikazee
22nd October 2005, 11:48
With calling it I mean you need to run it from a command prompt or from the "run" dialog in Windows.