World Editor Helper

World Editor Helper is a world editor hack, its initial feature was to replace World Editor's JASS syntax checker with PJASS, a 3rd party syntax checker that is much faster than World Editor's and that does not crash/give wrong error messages in case of a syntax error.

Other features include: plugin support, an internal JASS preprocessor for defines and import and a map browser.

1. Table of contents

  1. Table of contents
  2. Running World Editor Helper
  3. Using the new syntax checker
  4. The configuration dialog
  5. The map browser
  6. Plugins
  7. The internal preprocessor
  8. Using Grimoire's War3err
  9. Contact information
  10. Credits

2. Running World Editor Helper

Once World Editor Helper is installed, Desktop, Start Menu and quick launch icons for World Editor Helper might be available depending on the options you chose. Otherwise you can find World Editor Helper in the installation folder. Open the link and World Editor Helper should be able to start World Editor.

World Editor Helper is currently unable to work when double clicking map files directly.

You can recognize that World Editor Helper is working by verifying that a [World Editor Helper] menu has been added to the main window's menu bar.

Registry issues

If an error message like "unable to query registry key value!" is shown then your wc3 is not installed correctly, you can fix this by reinstalling warcraft III or by adding a correct registry key yourself

You can easily fix the registry yourself by creating a file with these contents:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III]
"InstallPathX"="C:\\Program Files\\Warcraft III"
"InstallPath"="C:\\Program Files\\Warcraft III"

Just replace C:\\Program Files\\Warcraft III with your warcraft III folder, notice that double '\' is required. Save this file as wc3.reg , make sure the extension is .reg , then double click the new file, Windows's Registry Editor will ask you a confirmation.

3. Using the new syntax checker

Once World Editor Helper is running correctly, you can test it by opening or creating any map and saving , you should be able to notice a variation in the final process.

Syntax errors

If PJASS finds a syntax error , World Editor Helper will open a syntax error window specifying the error message, line number and the section of the map script with issues. It is analog to World Editor's syntax error window but it supports syntax highlight.

You can keep the syntax error window open while browsing your triggers for the errors and correcing them. Once you no longer need the syntax errors window you can close it by using the title bar's close button.

Custom blizzard.j / common.j

You can use custom blizzard.j or common.j By importing them to your map with the path scripts\blizzard.j or scripts\common.j , World Editor Helper also supports custom common.j/blizzard.j in war3patch.mpq if you are making a big mod or campaign.

Updating PJASS

PJASS might get a new version, and in that case it would be a good idea to update World Editor Helper's PJASS as well.

To update PJASS you can simply replace [World Editor HelperFolder]\PJASS.exe with the new version of PJASS.exe

4. The configuration dialog

You can change many options using World Editor Helper's configuration dialog, [World Editor Helper\Configure...]

General tab

Plugins tab

This tab allows you to browse and configure the installed plugins (if any), you can disable/enable a plugin by checking/unchecking its checkbox. Once a plugin is selected you can also query the configure and about buttons if the plugin supports them.

Notice that if you enable/disable a plugin you might need to restart World Editor Helper in order for the change to take effect.

Preprocessors tab

With this tab you can select wheter a preprocessor is active or not and also control the execution order of preprocessors.

Initially, the only preprocessor available is World Editor Helper's internal preprocessor. Plugins may also add preprocessors that you would have to configure here.

Some preprocessors might fail if not called in the right order, the correct order to use depends on various factors, so it is prefferable that the preprocessor authors explain what is the best order to use.

5. The map browser

The map browser offers an interface that helps you find maps, to open the map folder simply use [World Editor Helper Menu\Map Browser]

The map browser will preview the maps' name and preview image. You can browse different folders, once you find the map you want to open, double click it.

6. Plugins

World Editor Helper supports plugins. A World Editor Helper plugin should be distributed in the form of a .DLL file. To install a plugin, make sure World Editor Helper is closed and simply copy the .dll file to World Editor Helper Folder\Plugins , you can then open World Editor Helper and verify the plugin works by the plugin tab of the configuration dialog.

LikeWEU.DLL

World Editor Helper cannot be loaded by World Editor Unlimited's loader but it is distributed with the LikeWEU.DLL plugin that allows it to apply WEU' updates to data files so you can use it's features.

If you want to use WEU and World Editor Helper at the same time you have to copy LikeWEU.DLL to the plugins folder. You'll also need WEU to have been installed correctly (so LikeWEU can locate it in the registry and load it).

Developing plugins

You can contribute World Editor Helper by developing plugins using C++, C, Pascal (Delphi), or win32 languages. World Editor Helper offers a function library that assists plugins in things like injecting mpq data or processing the map during save. For more information download World Editor Helper's source. And you can also contact Zoxc

7. The internal preprocessor

World Editor Helper comes with an internal JASS preprocessor that adds define and import syntax to JASS. In order to use it make sure it is enabled in the preprocessors tab of the World Editor Helper configuration dialog.

The following is a syntax reference for said extensions.

Imports

The import command is equivalent to other languages' #include , require_once and uses. Simply let's you use scripts in an external file.

To use it, simply follow the //! import "file" syntax.

import attempts to get .j files from the map's folder and if the file is not found there it also looks up the World Editor Helper\imports\ folder

In case you are placing the external .j file in the map"s folder, then you"d have to either change World Editor" option of where to save files for testmap or to avoid to use testmap without saving first.

For example:

//! import "src\\supersystem"
//! import src\superfunction
//! import "x lib"
//! import "src\\superfunction"
function importtest takes nothing returns nothing
    call x_lib_Init()
    call SuperFunction(SuperSystem_GetId())
endfunction

You can see some variations of the import command, in this case the files it will use are mapsfolder\src\supersystem.j , mapsfolder\src\superfunction.j and x lib.j or World Editor Helper\imports\src\supersystem.j , World Editor Helper\imports\src\superfunction.j and World Editor Helper\imports\x lib.j . The difference between using or not " for the file names is that quoted file names can have spaces, but they need double \\ for the \ , and non-quoted file names only need one \ but cannot have spaces.

Notice that the same file is used in 2 instances of an import command, if World Editor Helper finds another import command then it will just ignore it.

Defines

The define command creates text macros for JASS allowing the user to define tokens that can be replaced by plenty of things when evaluated. Everything done by define happens in compile time so it is faster than constant variables/functions and has different uses as well.

There are two syntaxes for define: //! define IDENTIFIER DESCRIPTION or //! define IDENTIFIER(ARG1,ARG2,...,ARG3) DESCRIPTION.

It is easier to explain by some examples:

//! define DEFPI 3.141567
//! define INC(a) set a=a+1
function DefineTest takes nothing returns nothing
 local real x=DEFPI
    INC(x)
endfunction

Will be converted into:

function DefineTest takes nothing returns nothing
 local real x=3.141567
    set x=x+1
endfunction

Notice how it didn't matter that we used INC's argument as variable in the assignment.

Another example:

//! define Nested 12.0
//! define Formula34(l,y,z) l*500.0+Nested+y+z
//! define Author "This is the author value"
function DefineTest takes nothing returns nothing
    call BJDebugMsg(Author+Formula34(1,24.,35.))
endfunction

This becomes:

function DefineTest takes nothing returns nothing
    call BJDebugMsg("This is the author value"+1*500.0+12.0+24.+35.)
endfunction

This will cause a syntax error later, notice that //! define won' protect you from errors, it doesn't add parenthesis on its own either, if you want parenthesis you have to add them in the definition yourself.

We exchange safety with flexibility here, defines are so flexible that you can even use them to override natives and blizzard.j functions:

function CreateTimerDummy takes nothing returns nothing
    call BJDebugMsg("Created Timer")
    return CreateTimer()
endfunction
//! define CreateTimer CreateTimerDummy
//! define UnitAddAbilityBJ(a,u) UnitAddAbility(u,a)

function DefineTest takes nothing returns nothing
 local timer t=CreateTimer()
     call UnitAddAbilityBJ('Aloc',GetTriggerUnit())
     call TimerStart(t,0.5,true, function DoNothing)
 set t=null
endfunction

Would become into:

function CreateTimerDummy takes nothing returns nothing
    call BJDebugMsg("Created Timer")
    return CreateTimer()
endfunction

function DefineTest takes nothing returns nothing
 local timer t=CreateTimerDummy()
     call UnitAddAbility(GetTriggerUnit(),'Aloc')
     call TimerStart(t,0.5,true, function DoNothing)
 set t=null
endfunction

Globals merger

The gobal merger will look for globals statement and combine them at the top. This means that you can add many globals sections and don't have to use World Editor's Variable Editor to create globals.

globals
    integer Number1
    string Text1
endglobals

function Something takes nothing returns nothing
 call BJDebugMsg(Text1)
endfunction

globals
    integer Number2
    string Text2
endglobals

Would become into:

globals
    integer Number1
    string Text1
    integer Number2
    string Text2
endglobals

function Something takes nothing returns nothing
 call BJDebugMsg(Text1)
endfunction

8. Using Grimoire's War3err

War3err improves warcraft's jass virtual machine. There are several extremely difficult to run down scripting errors that will pass a syntax check. War3err catches them, stops warcraft from crashing if it normally would, and tells you where the problem is, so that you can fix it at your leisure. War3err is compatible with battle.net-you can have it running only on your computer while you play long test games with your friends. Currently, war3err takes care of these common issues: Other JASS related crashes (e.g., any of the other crash happy natives) can be tracked down by enabling the bytecode tracer in war3err.conf, by adding the line "bytecodetrace = on" without the quotes. To enable this open the Configure dialog. Go to General Settings. Select [Use custom loader]. Write bin\exehack.exe -s war3.lua in Executeble and put your Grimoire folder in the Working folder.

9. Contact information

Message Zoxc at www.wc3campaigns.net or send a mail to zoxc32@gmail.com

10. Credits