• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[VJASS] How to check syntax on .j files?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

How can I check the syntax on .j files without using the WEditor?

I tried running jasshelper.exe, but got this error:

1euwpc.png


The same with clijasshelper.exe as well.

Ideally I'd just like to "compile" them like I would with a Java file, e.g.

javac *.java

instead I might do

jasshelper *.j

That way I can fix syntax errors without using the WEditor, which is super slow!

Edit: pjass.exe works only on JASS files--it doesn't parse or understand VJASS.

I am using jasshelper from here: http://www.wc3c.net/showthread.php?t=88142
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Ok thanks. I wonder why the bin folder isn't properly put in the jasshelper folder when unzipping it?

But this tool is still not working.

2gwajqc.png


For some reason it expects a map as an argument.

I only want to check the syntax of individual .j files, e.g. AbilityIds.j is its own VJASS script irrespective of a map.
 
See:
http://www.wc3c.net/vexorian/jasshelpermanual.html#usag

There are a few options:

jasshelper.exe <path_to_common.j> <path_to_blizzard.j> <path_to_map.w3x>
jasshelper.exe <path_to_common.j> <path_to_blizzard.j> <path_to_mapscript.j> <path_to_map.w3x>
jasshelper.exe --scriptonly <path_to_common.j> <path_to_blizzard.j> <path_to_input.j> <path_to_output.j>

You're probably looking for either the 2nd or 3rd one. (you can use clijasshelper as well, it is the same thing but it won't have the GUI and windows)
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
I guess the third one.

However I do have a few relevant questions after reading this manual.

The basic command line syntax is:

jasshelper.exe <path_to_common.j> <path_to_blizzard.j> <path_to_map.w3x>
This will make jasshelper to process the source map, and update the map with a new compiled script. You can extract common.j and blizzard.j from the scripts folder in war3patch.mpq.

Compilation is really just processing vJASS into regular JASS, right? So what the above does, is to turn a vJASS script into a JASS script, and then replace the map.w3x's entire JASS script with the compiled vJASS one, correct?

jasshelper.exe <path_to_common.j> <path_to_blizzard.j> <path_to_mapscript.j> <path_to_map.w3x>
It will ignore the map's script file, and instead consider the given script file as the vJass source. Since the 3 files syntax removes the original vJass source code from the map, this method is more useful, you can generate the source map by exporting the map's script from the editor. (Hint: Use //! import and //! novjass in combination to command line jasshelper and World Editor)

The above seems to do what the first option does. Except I am confused by Vexorian's hint:
Hint: Use //! import and //! novjass in combination to command line jasshelper and World Editor
. What is he referencing here?

jasshelper.exe --scriptonly <path_to_common.j> <path_to_blizzard.j> <path_to_input.j> <path_to_output.j>

This syntax requires no map to be provided, will simply evaluate the input .j file and show syntax errors if necessary. If the compiling is successful, jasshelper will write the output script to the file path you provided.

I tried using this on a stand alone script but I got this as a response (also, why does it need an output file, or is that the compiled vJASS script --> JASS?)

rgwac4.png


I know for certain this script works fine and has no errors. However, it does require two other libraries.

Will JassHelper act like the Java Compiler, and search through the directories for the corresponding libraries and then compile this script in context of those libraries/scopes?

e.g. suppose I use a constant value in one .j script, but it is actually defined in another (that it requires). Will jasshelper search for this library, make sure that constant is defined correctly, or will it just complain that it has no declaration within the .j script being checked?
 
1. Yes, compilation is just turning vJASS into regular JASS. That is all that jasshelper does (and it performs some syntax checking for vJASS features). PJASS will then check the output script.

2. I'm not quite sure what Vex meant there.

3. The output file will the be the output as regular JASS. It won't act as a java compiler. It'll expect a valid map script (which should include a "main" function, as noted). You might be able to require other scripts, but it won't look for them unless you invoke it to do so, e.g. through //! import. So I suppose you could have a directory of files, but you need the //! import. But I don't quite know how it would all work together. I guess you could have a base map script (with the main function and init and all that jazz), and then have a bunch of //! import statements to import the rest of the scripts. I haven't really tried it tbh.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Ah I see.

I tried to use it to import standalone systems in my map, but of course it made it unplayable because it's not the full mapscript.

Where can I get a copy of this base map script?
 
Ah I see.

I tried to use it to import standalone systems in my map, but of course it made it unplayable because it's not the full mapscript.

Where can I get a copy of this base map script?

You can disable your triggers and then save the map. Go to jassnewgenpack/logs/outputwar3map.j (I think that is the correct path, I can't remember). That should be the base script. But you may need to regenerate it occasionally.

A more awesome idea: write a quick tool that runs the command line script for you. It would copy the outputwar3map.j into your working directory, and then it would add the //! import for all files that are in that directory.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Well I actually ended up using Nestharus' notepad++ compilation strategy.
(see http://www.hiveworkshop.com/forums/...s-277/volunteers-needed-notepad-vjass-238264/)

Works brilliantly--I just need one import line and it saves my script each time, without needing to go into the editor.

One thing he did not seem to fix though is that it doesn't work with FileImporter scripts. To make objects you need to save the import statement from the world editor, but it's a minor limitation.
 
Status
Not open for further replies.
Top