

Local widget w //widget is a handle type with children type unit and destructible For example:įunction Trig_JASS_handle_Example_Child takes widget w, widget w2 returns nothingįunction handle_Example takes real x, real y returns nothing Handle variables may reference its own specific handle type or any children type. Some of these children types have their own children types, and so on.
Warcraft 3 world editor cinematic tutorial free#
Set specialEffect = null //setting the variable to null is not enough, since it is only a reference to the handle įunction garbage_Collection_Example3 takes string effectPath, real x, real y returns nothingĬall DestroyEffect( specialEffect ) //we destroy (clean up) the handle to free up memoryįunction garbage_Collection_Example4 takes effect e returns nothingĪnother property of handle types worth noting is that all handle types are treated as if they were children of the "handle" type. Local effect specialEffect = AddSpecialEffect( effectPath, x, y ) Local effect specialEffect = AddSpecialEffect( effectPath, x, y ) //uncleaned handle types will continue to take up system resourcesįunction garbage_Collection_Example2 takes string effectPath, real x, real y returns nothing Users may experience reduced performance if they are not nullified, though on a much smaller scale.įunction garbage_Collection_Example takes string effectPath, real x, real y returns nothing Also, any references to handles themselves take up some memory space. If they are not nullified properly, handle indices will not be garbage collected and will eventually leak. Additionally, local variables do not properly dereference handles when they go out of scope. This becomes important when dealing with garbage collection because handles, if not properly cleaned up, can cause significant performance issues. Similarly to how Java treats Objects, all variables and parameters in JASS of handle types are treated as values, but in reality those values are nothing but references to the handle objects. Handle types often represent an "object" within the game (units, players, special effects, etc.). Handle types, however, behave more like objects. The native types behave very similarly to primitive types in other programming languages.

The following function creates a string containing the message " Hello, world!" and displays it to all players:įunction Trig_JASS_test_Actions takes nothing returns nothingĬall DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Hello, world!")įunction Trig_JASS_test_Actions takes player p returns nothingĬall DisplayTextToPlayer(p, 0,0, "Hello, world!")Īnd if you want to print the message 90 times and show the iterator:Ĭall DisplayTextToPlayer(p, 0,0, "Hello, world! "+I2S(i))
Warcraft 3 world editor cinematic tutorial mods#
JASS primarily uses procedural programming concepts, though popular user-made mods to Blizzard's World Editor program have since added C++-like object-oriented programming features to the syntax of JASS. It has a syntax similar to Turing and Delphi, although, unlike those languages, it is case sensitive. JASS can also create powerful functions such as trackables, which detects if a mouse goes over or hits a position, GetLocalPlayer(), which can cause disconnects if used improperly (such as using handles with GetLocalPlayer(). It can, for example, execute simple GUI functions such as, giving orders to units, change the weather and time of day, play sounds and display text to the player, and manipulate the terrain.

The language provides an extensive API that gives programmers control over nearly every aspect of the game world.
