• 🏆 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!

Some tips with vJass on Linux

Level 8
Joined
Jan 23, 2015
Messages
121
Credits go to Vex, without whom advise I would not manage to get everything else working.
Criticism is welcomed.

As for now, there's no modification (JNGP, Sharpcraft ext.) of World Editor that is able to run under WINE (at least for me), but JassHelper standalone still works almost flawlessly (though I couldn't get lua extensions to work, like ObjMerger read last post, grimext seems to work now). It can be found in JNGP or here. But using JH isn't comfortable by default, as you need to write path to JH.exe, blizzard.j and common.j every time you want to compile something not in the JH directory, so I've discovered my own way.

0. Setting up JassHelper
Probably it would be better to get JH from JNGP, because there you can find almost all you need for JH in one. In one folder with jasshelper you need: sfmpq.dll, and a copy in /bin and in /grimext; Blizzard.j and common.j, probably laying in same folder for simplicity; pjass.exe; grimext folder with lua5.1.dll and all the extensions.
Check wine registry if something won't work, especially for grimext:
The path is: HKEY_CURRENT_USER/Software/Grimoire with string field named War3InstallPath where wined path to wc3 should be placed.
jasshelper.conf should contain full paths to every extension that are used in the community and I strongly recommend enable the [forcemethodevaluate] option to disable unwanted trigger overhead.
Now place JH folder where you want and remember path to it. As for me, I chose ~/.JassHelper.

1. Terminal commands
Probably you would not be happy to write ~/.JassHelper/clijasshelper.exe ~/.JassHelper/common.j ... every time you want to compile something. You can add bash script that will allow you to run jasshelper from terminal without matter about working directory with only one command. It should know JH directory path and take two parameters which is script and map files, then just run JH in wine. Save script in a text file named "jasshelper" (file name is command name) and place it in /bin/ directory, and now you are able to run JH from terminal with command "jasshelper map.w3x script.j", just like some other compilator is used.
Code:
#!/bin/sh
JHDIR="$HOME/.JassHelper"
FILE=$1
SCRIPT=$2
wine "$JHDIR/clijasshelper.exe" "$JHDIR/common.j" "$JHDIR/blizzard.j" "$SCRIPT" "$FILE"
For my own comfort I've added functionality to copy resulting map in wc3 test directory, checks if arguments are present and debug option.
Code:
#!/bin/bash
DIR="$PWD"
JHDIR="$HOME/.JassHelper"
WCDIR="$HOME/.wine/drive_c/Warcraft 3"
FLAGS=""
declare -i CNT=1
while getopts ":d" flag; do
  case "${flag}" in
    d) FLAGS="$FLAGS --debug"; CNT+=1 ;;
    *) echo "Unexpected option ${flag}" ;;
  esac
done
FILE=${!CNT}
CNT+=1
SCRIPT=${!CNT}
if [ -z "$FILE" ]
  then
    echo "Input map file (.w3x) > "
    read FILE
fi
if [ -z "$SCRIPT" ]
  then
    echo "Input map script file (.j) > "
    read SCRIPT
fi
wine "$JHDIR/clijasshelper.exe" $FLAGS "$JHDIR/common.j" "$JHDIR/blizzard.j" "$SCRIPT" "$FILE"
if [ -z "$OUTDIR" ]
  then
      OUTDIR="$WCDIR/Maps/Test"
fi
echo "Output in > $OUTDIR"
cp -f "$FILE" "$OUTDIR"
Note that JH will store its logs and backups dirs into the working directory from where the script was called.

You can also create same commands for wc3 or WE to run maps from terminal with something like this, thanks to -loadfile option in both .exe files:
Code:
#!/bin/sh
WCDIR="$HOME/.wine/drive_c/Warcraft 3"
if [ -z "$1" ]
  then
    echo "Input map file (.w3x) > "
    read 1
fi
echo "$1"
echo "$(winepath -w $1)"
wine "$WCDIR/Frozen Throne.exe" -loadfile "$(winepath -w $1)"
Same for WE, just change .exe in wine command to World Editor.exe.
And remember that your wc3 directory can be different from mine, so don't forget to change WCDIR (or you can write FindWc3 script for everyone's good =) ).

2. Makefiles
Now, after you have terminal commands to compile and to run your maps, you can create makefiles that would compile and debug your project map in one terminal command from your project folder named "make".
Code:
run: map.w3x war3map.j
    jasshelper -d map.w3x war3map.j
    wc3 map.w3x

map: map.w3x war3map.j
    jasshelper -d map.w3x war3map.j

compile: map.w3x war3map.j
    jasshelper map.w3x war3map.j
Considering map's name is map.w3x and its script is script.j

With Vex's advice to place code in external files and some cool text editor like VS Code (with extension for jass syntax) Jass/vJass programming begins to be pretty much similar to C/C++.

After all things done I have more efficient platform to develop my maps than it was on Windows with JNGP, and I guess other people familiar with command prompt would like this too.

I think almost everything of this could be applied also to Windows, but I didn't tried. After all this months of work under Linux Mint I think I'll never return back to win, since linux is much more useful and comfortable for me.

Consider moving on Linux? :)
 
Last edited:
Level 8
Joined
Jan 23, 2015
Messages
121
Oh, nice to hear it works ok

But how did you get the WE to work properly? The game runs flawlessly but the WE always has the toolbar (and some other menus) either completely black or flashing like crazy
The interface bug of WE on wine hasn't been fixed by anyone as far as I know.
You still can use the toolbar and menus, they're working properly but not rendering. It isn't such a problem even then, cause only terrain editor has the bug and win's toolbar should still work as normal.
Since TE's interface replicates same functions in several features, there's at least one feature working for each function for me, so I still can use TE with full functionality.

And if you really care about that toolbar etc., you can install VirtualBox with some windows and share your .wine/drive_c with it, then run WE from there. Probably even JNGP could work there, but I get SecurityPermission alert ticking from findWE(), allowing me not to work at all with it. Oh and then something happened and JNGP just started to run default WE. My own testings of ObjectMerger (which is only issue I have - it can't find wc3 mpq) under VirtualBox Win 8 (I had win8 before I switched to Linux, everything was working flawlessly) showed only crashes, sadly.
 
Level 8
Joined
Jan 23, 2015
Messages
121
JNGP works fine on Linux, aside from a couple graphical issues. I think some Lua/object merger stuff is broken too.

grimoire on linux - Wc3C.net
Hmm... I didn't see that thread before. Thanks, it is probably needed to mention in the guide.

But well, it seems I don't need JNGP anymore, since there's nothing I can't do with .j scripts aside from terrain editing. And it is much more easy for me to use. (It seems that none of the stuff from lua is broken, though I didn't played around too much until now. I didn't check if my old extern scripts do the same thing they were doing on Win, but JH compiles them without throwing any errors)

I'm wonder if there are/would be editors that allow me to create maps completely without WE.
 
Useful tutorial. As far as Linux dev goes, I think Barade has made a lot of useful tools to assist with wc3 modding that you might be interested in.

I apologize for the super late (year long) delay before getting this reviewed. Approved.

P.S. I also recommend anyone reading this thread to check out integrating vJass into VSCode here!
Compiling vJass and Wurst using VSCode
 
Level 8
Joined
Jan 23, 2015
Messages
121
Nah, that's fine. But in last autumn I discovered wurst for myself and since then I have no problems developing in linux since native vscode and it's wurst extension works there out of the box, just show them warcraft 3 path.

Somehow my wine setup, despite being constantly updated from devel branch, has no problems running almost every game I ever got there. What a magic.
 
Top