JASS (Just Another Scripting Syntax)

From Bauman National Library
This page was last modified on 21 May 2016, at 23:44.
JASS
Paradigm scripting, event-driven
Developer Blizzard Entertainment
First appeared 2001
Typing discipline static
Filename extensions .j, .ai.
Website None

JASS - event-driven scripting programming language created by Blizzard Entertainment, used in games such as Warcraft and Starcraft.

Description

In the game Warcraft III JASS scripts language used to control the objects of the game world and computer opponents. It gives almost complete freedom to control gameplay to create custom scripts Warcraft III.

World Editor is equipped with only basic interpreter and editor JASS, in which there is no syntax highlighting, making it difficult to work. This is one of the main reasons for the dislike newcomers modostroeniya Warcraft III to this language.

In addition to the standard editor, there are special programs that make it easier to work with Jass-scripts. These are include JASS Craft (former JASS Shop Pro). You can create templates for triggers, functions, and to optimize the code with the help of this program.

Among modders Warcraft III in 2007, became popular add-on for an amateur Editor Warcraft III - JASS New Gen Pack.

The main differences the JASS from triggers editor

In contrast to the use of a graphical editor triggers in World Editor, writing code on the card JASS kartodelu gives a number of advantages:

  • Local variables.
  • More compact and easy code.
  • Plugging memory leaks. TO
  • Cycles.
  • Pause.
  • Additional features.
  • Writing custom or third-party import functions that can be called Call command.
  • Using Exploit Preload for the destruction of Windows or Warcraft.

Types

JASS is statically-typed and has two classes: natives and handles. The native types are:

  • integer (32-bit signed)
  • real (32-bit floating point numbers, similar to the float type in Java)
  • string (limit is 1023 signs, actually to provide save/load compatibility it's required to use only 1013 signs)
  • boolean
  • code

Example

The following function creates a string containing the message "Hello, world!" And displays it for all players:

function Trig_JASS_test_Actions takes nothing returns nothing
 call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Hello, world!")
endfunction

If you want it just for one player:

function Trig_JASS_test_Actions takes player p returns nothing
 call DisplayTextToPlayer(p, 0,0, "Hello, world!")
endfunction

JASS supports one-dimensional arrays of any type. Syntax announces arrays and access members in the array and is described in the following code.

function array_Example takes nothing returns nothing
  //arrays cannot be initialized at declaration and their members will hold arbitrary values
  local integer array numbers
  local unit array units
  local boolean array booleans
  local integer i = 1  set numbers[0] = 1 //the syntax to initialize an array member is identical to that for any other variable, only a set of
                     //brackets: [] must immediately follow the variable name with the index value of the specific member
                     //to initialize inside the brackets
  set units[0] = CreateUnit( 'hfoo', 0, 0 ) //indexes for arrays always start at 0  loop
    exitwhen ( i > 8191 ) //the maximum size for arrays in JASS is 8192, which means that the last index of any array can
                          //only be 8191,  to provide save/load compatibility it's required to use maximum index 8190
    set numbers[i] = i    //variables can substitute for constants when specifying the index value in the brackets
    set units[numbers[i]] = null //array members can also substitute
    set booleans[i-1] = true //arithmetic (or functional) operations are also acceptable
    set i = i + 1 //increments the index value
  endloop  if booleans[200] then //to access an array member, again the syntax is the same as for normal variables, only
                                   //with the addition of the brackets with the index value inside
    set numbers[200] = -200 //you can re-assign members of the array to different values
  endif
endfunction

External links

  1. An Introduction To JASS
  2. vJASS - Uncomplicating the Complicated
  3. JASS Tools
  4. Jass New Generation Pack (JNGP)
  5. vrJASS