AngelScript

One of JJ2+’s biggest features is AngelScript, as written and maintained by Andreas Jönsson of AngelCode.com. This is an entire scripting language with an immense API that lets you edit huge portions of the game! Here are some quick possibilities to get you excited:

Kinds of Scripts

There are two kinds of scripts: level scripts, which are attached to specific levels (e.g. a script castle1.j2as that turns bats blue in Dungeon Dilemma), and mutators, which are run by servers and can affect all the levels hosted by that server.

With very rare exception, the two kinds use all the same syntax, functions, and so on. Learning to write one kind of script will transfer over to the other kind, it's just a question of what you want to write.

Warnings

Your script files must all be syntactically correct AngelScript. Any syntax error anywhere will prevent all AngelScript from running. To be told about errors and warnings in the chatlog, set [General]AngelscriptDebug=True in plus.ini.

Most AngelScript functions only run locally, so in multiplayer, you'll need to find ways to sync gameplay among clients. A few properties are synced automatically such as jjTeamScore or the current gamemode, but most other code—individual items, bullets, graphical effects, etc.—needs to be written more carefully, in particular using the jjSTREAM network communication class. Fortunately, in any server, all players run the same code. (Or if you just want to make Single Player levels, there’s nothing to worry about!)

Topic Guides

This section is still in progress! Let us know if you want to request an article on a particular topic, or if you want to write an article!

  1. Writing a Level Script
  2. Writing a Mutator
  3. jjOBJ
  4. Object behaviors
  5. jjPLAYER
  6. Sprite arrays
  7. Tile IDs
  8. Strings
  9. Enums
  10. jjSTREAM

API

Link to the complete JJ2+ AngelScript API

AngelScript has its own manual for general language syntax. Besides the standard constructs, we offer the string, array, math, and dictionary modules.