Description
While coding on Shadows of Everwood, I realised that it was a real pain to keep triggers with only //! import-directives in the Trigger Editor, so I set out to fix that, and this is the result.
This program is a small application that traverses a folder and its subdirectories, constructing an import-hierarchy along the way.
What is it and what does it do?
Consider the following structure:
Code:
Source\
.
....... sys\
. .
. ....... UnitIndexer.j
. ....... TimerUtils.j
. ....... core\
. .
. ....... GameScript.j
.
....... res\
.
....... SomeScriptFile.j
....... NYI DamageSystem.j
In order to import those files you'd have to write 4 import dirctives:
JASS:
//! import "Source\\sys\\UnitIndexer.j"
//! import "Source\\sys\\TimerUtils.j"
//! import "Source\\sys\\core\\GameScript"
//! import "Source\\res\\SomeScriptFile.j"
Now imagine on a real map, with a lot more than 4 triggers.. that's a lot to write.
The aim was, for me, to only write one import directive:
JASS:
//! import "Source\\import.j"
And that's what I've created - a program that creates a tree of import directives.
After using my program on that folder, it'll look like this:
Code:
Source\
.
....... import.j
....... sys\
. .
. ....... import.j
. ....... UnitIndexer.j
. ....... TimerUtils.j
. ....... core\
. .
. ....... import.j
. ....... GameScript.j
.
....... res\
.
....... import.j
....... SomeScriptFile.j
....... NYI DamageSystem.j
Code:
Source\sys\core\GameScript.j
/
Source\sys\core\import.j
/
Source\sys\import.j - Source\sys\UnitIndexer.j
/ \
Source\import.j Source\sys\TimerUtils.j
\
Source\res\import.j
\
Source\res\SomeScriptFile.j
You may ask "what about the NYI DamageSystem.j?".
- The program ignores files prefixed with 'NYI' (Not Yet Implemented)
Default working directory is "Source\", use param specified below to change!
The program will also accept a couple of command line parameters:
- -d debug mode - output some information that may or may not be useful.
- -f <path> change directory - will work on the specified path instead of "Source\".
- -s silent mode - hides console window & does not ask for user input to start / exit.
- -r root mode - tells program to write all import directives to root import.j-file.
Integrating with JNGP
You can easily integrate this program with JNGP using the jasshelper.conf-file.
Quick-guide:
- Download this program and place it in your jasshelper folder. (\jassnewgenpack5d\jasshelper\)
- Back one folder (to jassnewgenpack5d) and open jasshelper.conf in any text editor software.
(Do not open the jasshelper.conf file inside your jasshelper folder.)
- Find the line where it says
[externaltools]
.
- Add the following line:
"ImportGenerator","jasshelper\\scriptgen.exe"
- Save jasshelper.conf and open up the World Editor (restart it if you already had it opened)
- Write:
//! external ImportGenerator <your command line arguments here>
Root folder is jassnewgenpack5d, so if you'd want to generate import files for the jass folder you'd write:
//! external ImportGenerator -f jass
If you have different projects inside that folder, perhaps something like this would suffice:
//! external ImportGenerator -f jass\\mymapname
- Now add an import line somewhere in your map that imports the root import.j file:
//! import "jass\\mymapname\\import.j"
- Et voilá! Note that the //! external -call will still work even though you're not using JNGP.
(I.e compiling using only jasshelper or clijasshelper)
Requirements
- Admin privileges on Windows Vista or newer.
- Windows-based OS (XP, Vista, Win7)
- Microsoft Visual C++ 2010 Redistributable (32bit, 64bit)
License is bundled with the attached program.
Change log
version 1.1
- New algorithm: recursive & depth-first. (Might run out of stack memory on very large folders.)
- New command line parameter: -r root mode - will stuff all import directives in root import file
- Some new info when starting program.
Please post if you have suggestions, feedback or have found a bug!
Attachments
Last edited: