Global namespace
Namespaces
- namespace AIR JJ2+
- What the jump key does in the air
- namespace ANIM JJ2+
- Animation sets
- namespace AREA JJ2+
- Event types of the tiles of the level
- namespace BEHAVIOR JJ2+
- Built-in behaviors of objects
- namespace CHAR JJ2+
- Playable characters
- namespace CHAT JJ2+
- Kinds of chat messages
- namespace COLOR JJ2+
- Components of a color
- namespace CREATOR JJ2+
- What created an object
- namespace DIRECTION JJ2+
- Directions a player can face
- namespace FLIGHT JJ2+
- Ways a player can fly
- namespace GAME JJ2+
- Game modes, their custom variants, game states and connection types
- namespace GEM JJ2+
- Colors of gems
- namespace GROUND JJ2+
- What the jump key does on the ground
- namespace HANDLING JJ2+
- How objects react to players and bullets
- namespace HELP JJ2+
- Layout of help pages, kept for compatibility
- namespace LAYERSPEEDMODEL JJ2+
- How layers scroll
- namespace LIGHT JJ2+
- Light types and lighting enforcement modes
- namespace MLLE JJ2+
- Support for levels made with extended level editing tools
- namespace OBJECT JJ2+
- Types of objects, as placed by events
- namespace PARTICLE JJ2+
- Types of particles
- namespace RABBIT JJ2+
- Animations of a playable character within its animation set
- namespace SHIELD JJ2+
- Types of shields
- namespace SNOWING JJ2+
- Types of weather
- namespace SOUND JJ2+
- Sound samples
- namespace SPREAD JJ2+
- How a weapon spreads its shots
- namespace SPRITE JJ2+
- Sprite drawing modes and flips
- namespace STATE JJ2+
- States of objects
- namespace STRING JJ2+
- Text sizes, alignments and modes
- namespace SURFACE JJ2+
- Surfaces of textured backgrounds
- namespace TEAM JJ2+
- Team colors
- namespace TEXTURE JJ2+
- Textures and styles of textured backgrounds
- namespace TILE JJ2+
- Tile quadrants and tile flags
- namespace TIMER JJ2+
- States of the timer of a player
- namespace WATERINTERACTION JJ2+
- How players interact with water
- namespace WATERLIGHT JJ2+
- Lighting under water
- namespace WEAPON JJ2+
- Weapons and their styles
Built-in classes
- class array<T> built-in
- Dynamic array of elements of type
T - class Color by value built-in
- Color with floating-point red, green, blue and alpha channels
- class dictionary built-in
- Collection of values of any type, stored under string keys
- class dictionaryValue by value built-in
- Value of any type stored in a dictionary
- class ref by value built-in
- Handle to an object of any reference type
- class string by value built-in
- Text string
- class vec2 by value built-in
- Two-dimensional vector with floating-point components
- class vec2i by value built-in
- Two-dimensional vector with integer components
- class vec3 by value built-in
- Three-dimensional vector with floating-point components
- class vec3i by value built-in
- Three-dimensional vector with integer components
- class vec4 by value built-in
- Four-dimensional vector with floating-point components
- class vec4i by value built-in
- Four-dimensional vector with integer components
Classes
- class jjANIMATION JJ2+
- A sprite animation consisting of a sequence of frames
- class jjANIMFRAME JJ2+
- A single frame of a sprite animation
- class jjANIMSET JJ2+
- A set of related sprite animations
- class jjBEHAVIOR by value JJ2+
- What drives an object every tick
- class jjCANVAS JJ2+
- Drawing surface passed to the HUD and layer drawing hooks
- class jjCHARACTER JJ2+
- Character profile
- class jjCOLORMAP JJ2+
- Editable 32-bit image with alpha
- class jjCONTROLPOINT JJ2+
- Control point of Domination, see jjControlPoints
- class jjHELPPAGE JJ2+
- A page of help
- class jjHELPPARAGRAPH JJ2+
- A paragraph of a help page
- class jjLAYER JJ2+
- Layer of tiles
- class jjLAYERCYLINDER no handles JJ2+
- Properties of the cylinder effect of a layer, see jjLAYER::cylinder
- class jjLAYERMENU no handles JJ2+ partially supported
- Properties of the menu effect of a layer, see jjLAYER::menu
- class jjLAYERREFLECTION no handles JJ2+
- Properties of the reflection effect of a layer, see jjLAYER::reflection
- class jjLAYERTILEMENU no handles JJ2+
- Properties of the tile menu effect of a layer, see jjLAYER::tileMenu
- class jjLAYERTUNNEL no handles JJ2+
- Properties of the tunnel effect of a layer, see jjLAYER::tunnel
- class jjLAYERWARPHORIZON no handles JJ2+
- Properties of the warp horizon effect of a layer, see jjLAYER::warpHorizon
- class jjLAYERWAVE no handles JJ2+
- Properties of the wave effect of a layer, see jjLAYER::wave
- class jjMASKMAP JJ2+
- Editable collision mask of a tile
- class jjOBJ JJ2+
- An object of the level
- class jjPAL JJ2+
- A palette of 256 colors
- class jjPALCOLOR by value JJ2+
- A single color of a palette or a 32-bit image
- class jjPARTICLE JJ2+
- A simple visual effect in the level
- class jjPARTICLEFIRE by value JJ2+ deprecated
- Extra properties of a PARTICLE::FIRE particle, see jjPARTICLE::fire
- class jjPARTICLEFLOWER by value JJ2+ deprecated
- Extra properties of a PARTICLE::FLOWER particle, see jjPARTICLE::flower
- class jjPARTICLEICETRAIL by value JJ2+
- Extra properties of a PARTICLE::ICETRAIL particle, see jjPARTICLE::icetrail
- class jjPARTICLELEAF by value JJ2+ deprecated
- Extra properties of a PARTICLE::LEAF particle, see jjPARTICLE::leaf
- class jjPARTICLEPIXEL by value JJ2+ deprecated
- Extra properties of a PARTICLE::PIXEL particle, see jjPARTICLE::pixel
- class jjPARTICLERAIN by value JJ2+ deprecated
- Extra properties of a PARTICLE::RAIN particle, see jjPARTICLE::rain
- class jjPARTICLESMOKE by value JJ2+ deprecated
- Extra properties of a PARTICLE::SMOKE particle, see jjPARTICLE::smoke
- class jjPARTICLESNOW by value JJ2+ deprecated
- Extra properties of a PARTICLE::SNOW particle, see jjPARTICLE::snow
- class jjPARTICLESPARK by value JJ2+ deprecated
- Extra properties of a PARTICLE::SPARK particle, see jjPARTICLE::spark
- class jjPARTICLESTAR by value JJ2+ deprecated
- Extra properties of a PARTICLE::STAR particle, see jjPARTICLE::star
- class jjPARTICLESTRING by value JJ2+ deprecated
- Extra properties of a PARTICLE::STRING particle, see jjPARTICLE::string
- class jjPIXELMAP JJ2+
- Editable 8-bit image
- class jjPLAYER JJ2+ partially supported
- A player in the level
- class jjPLAYERDRAW JJ2+
- How a player is drawn in this tick
- class jjRNG JJ2+
- A seedable pseudo-random number generator
- class jjSTREAM JJ2+
- A buffer of bytes for storing data and exchanging it with files
- class jjTEXTAPPEARANCE by value JJ2+
- Layout and styling options for drawn text
- class jjTILE JJ2+
- Static or animated tile of the level
- class jjWEAPON JJ2+
- Options of one weapon
Interfaces
- interface jjBEHAVIORINTERFACE JJ2+
- Base for script classes that act as object behaviors
- interface jjPUBLICINTERFACE JJ2+ partially supported
- Interface a script module implements to offer functionality to other modules
Funcdefs
- funcdef void jjVOIDFUNC() JJ2+
- Callback that takes no arguments
- funcdef void jjVOIDFUNCOBJ(jjOBJ@) JJ2+
- Signature of a behavior function, see jjOBJ::behavior
- funcdef void jjVOIDFUNCPLAYER(jjPLAYER@) JJ2+
- Callback that takes a player
Built-in functions
- float abs(float) built-in
- Absolute value of a floating-point number
- float acos(float) built-in
- Arc cosine in radians
- float asin(float) built-in
- Arc sine in radians
- float atan(float) built-in
- Arc tangent in radians
- float atan2(float, float) built-in
- Angle of a direction vector in radians
- float ceil(float) built-in
- Rounds up to the nearest whole number
- bool closeTo(float, float, float = 0.00001f) built-in
- Returns whether two floating-point numbers are nearly equal
- bool closeTo(double, double, double = 0.0000000001) built-in
- Returns whether two double-precision numbers are nearly equal
- float cos(float) built-in
- Cosine of an angle given in radians
- float cosh(float) built-in
- Hyperbolic cosine
- float floor(float) built-in
- Rounds down to the nearest whole number
- string formatFloat(double val, const string&in options = "", uint width = 0, uint precision = 0) built-in
- Formats a floating-point number as text
- string formatInt(int64 val, const string&in options = "", uint width = 0) built-in
- Formats a signed integer as text
- string formatUInt(uint64 val, const string&in options = "", uint width = 0) built-in
- Formats an unsigned integer as text
- float fpFromIEEE(uint) built-in
- Reinterprets 32 bits as a
float - double fpFromIEEE(uint64) built-in
- Reinterprets 64 bits as a
double - uint fpToIEEE(float) built-in
- Raw IEEE 754 bits of a
float - uint64 fpToIEEE(double) built-in
- Raw IEEE 754 bits of a
double - float fraction(float) built-in
- Fractional part of a number
- string join(const array<string>&in, const string&in) built-in
- Joins an array of strings into one string
- float log(float) built-in
- Natural (base e) logarithm
- float log10(float) built-in
- Base 10 logarithm
- double parseFloat(const string&in, uint&out byteCount = 0) built-in
- Parses a floating-point number from the beginning of a string
- int64 parseInt(const string&in, uint base = 10, uint&out byteCount = 0) built-in
- Parses a signed integer from the beginning of a string
- uint64 parseUInt(const string&in, uint base = 10, uint&out byteCount = 0) built-in
- Parses an unsigned integer from the beginning of a string
- float pow(float, float) built-in
- Raises a number to a power
- float sin(float) built-in
- Sine of an angle given in radians
- float sinh(float) built-in
- Hyperbolic sine
- float sqrt(float) built-in
- Square root
- float tan(float) built-in
- Tangent of an angle given in radians
- float tanh(float) built-in
- Hyperbolic tangent
Functions
- int jjAddObject(uint8 eventID, float xPixel, float yPixel, uint16 creatorID = 0, CREATOR::Type creatorType = CREATOR::OBJECT, BEHAVIOR::Behavior behavior = BEHAVIOR::DEFAULT) JJ2+
- Creates a new object
- int jjAddObject(uint8 eventID, float xPixel, float xPixel, uint16 creatorID, CREATOR::Type creatorType, jjVOIDFUNCOBJ@ behavior) JJ2+
- Creates a new object driven by a behavior function
- jjPARTICLE@ jjAddParticle(PARTICLE::Type type) JJ2+
- Creates a new particle
- void jjAddParticlePixelExplosion(float xPixel, float yPixel, int curFrame, int direction, int mode) JJ2+ partially supported
- Bursts a sprite frame into pixel particles
- void jjAddParticleTileExplosion(uint16 xTile, uint16 yTile, uint16 tile, bool collapseSceneryStyle) JJ2+ partially supported
- Breaks a tile into falling pieces, like destroyed scenery
- void jjAlert(const string&in text, bool sendToAll = false, STRING::Size size = STRING::SMALL) JJ2+ partially supported
- Shows a message to the local player
- void jjChat(const string&in text, bool teamchat = false) JJ2+ partially supported
- Sends a line of chat
- void jjConsole(const string&in text, bool sendToAll = false) JJ2+ partially supported
- Writes a console message
- float jjCos(uint angle) JJ2+
- Returns the cosine of an angle from a 1024-step table
- uint jjCRC32(const jjSTREAM&in input, uint crc = 0) JJ2+
- Returns the CRC-32 checksum of the contents of a stream
- void jjDebug(const string&in text, bool timestamp = false) JJ2+ partially supported
- Writes debugging text to the log
- void jjDeleteObject(int objectID) JJ2+
- Removes an object from the level
- void jjDrawPixel(float xPixel, float yPixel, uint8 color, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a single pixel into the level
- void jjDrawRectangle(float xPixel, float yPixel, int width, int height, uint8 color, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a filled rectangle into the level
- void jjDrawResizedSprite(float xPixel, float yPixel, int setID, uint8 animation, uint8 frame, float xScale, float yScale, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a scaled frame of an animation set into the level
- void jjDrawResizedSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, float xScale, float yScale, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a scaled frame given by its index in jjAnimFrames into the level
- void jjDrawRotatedSprite(float xPixel, float yPixel, int setID, uint8 animation, uint8 frame, int angle, float xScale = 1, float yScale = 1, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a rotated and scaled frame of an animation set into the level
- void jjDrawRotatedSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, int angle, float xScale = 1, float yScale = 1, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a rotated and scaled frame given by its index in jjAnimFrames into the level
- void jjDrawSprite(float xPixel, float yPixel, int setID, uint8 animation, uint8 frame, int8 direction = 0, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a frame of an animation set into the level
- void jjDrawSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, int8 direction = 0, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a frame given by its index in jjAnimFrames into the level
- void jjDrawString(float xPixel, float yPixel, const string&in text, const jjANIMATION&in animation, STRING::Mode mode = STRING::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws text into the level using the frames of an animation as the font
- void jjDrawString(float xPixel, float yPixel, const string&in text, const jjANIMATION&in animation, const jjTEXTAPPEARANCE&in appearance, uint8 param1 = 0, SPRITE::Mode spriteMode = SPRITE::PALSHIFT, uint8 param2 = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws text into the level using the frames of an animation as the font, with a custom appearance
- void jjDrawString(float xPixel, float yPixel, const string&in text, STRING::Size size = STRING::SMALL, STRING::Mode mode = STRING::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws text in one of the built-in font sizes into the level
- void jjDrawString(float xPixel, float yPixel, const string&in text, STRING::Size size, const jjTEXTAPPEARANCE&in appearance, uint8 param1 = 0, SPRITE::Mode spriteMode = SPRITE::PALSHIFT, uint8 param2 = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws text in one of the built-in font sizes into the level, with a custom appearance
- void jjDrawSwingingVineSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, int length, int curvature, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a frame bent like a swinging vine into the level
- void jjDrawTile(float xPixel, float yPixel, uint16 tile, TILE::Quadrant tileQuadrant = TILE::ALLQUADRANTS, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+ partially supported
- Draws a tile of the tile set into the level
- void jjEnableEachASFunction() JJ2+
- Sets every entry of jjEnabledASFunctions back to
true - int jjEventGet(uint16 xTile, uint16 yTile) JJ2+
- Returns the event ID placed on a tile of the sprite layer
- void jjEventSet(uint16 xTile, uint16 yTile, uint8 newEventID) JJ2+ partially supported
- Replaces the event placed on a tile
- void jjGenerateSettableTileArea(uint8 layer, int xTile, int yTile, int width, int height) JJ2+
- Prepares a rectangular area of one of the original layers for jjTileSet()
- jjPALCOLOR jjGetFadeColors() JJ2+ C++
- Returns the fade color of the textured background, see jjSetFadeColors()
- int jjGetModOrder() JJ2+
- Returns the current position in the order list of the playing module music
- int jjGetModRow() JJ2+
- Returns the current row of the playing module music
- int jjGetModSpeed() JJ2+
- Returns the speed (ticks per row) of the playing module music
- int jjGetModTempo() JJ2+
- Returns the tempo of the playing module music, in beats per minute
- uint16 jjGetStaticTile(uint16 tileID) JJ2+ partially supported
- Returns the frame an animated tile currently shows
- int jjGetStringWidth(const string&in text, const jjANIMATION&in animation, const jjTEXTAPPEARANCE&in style) JJ2+
- Returns the width of text drawn with an animation as the font
- int jjGetStringWidth(const string&in text, STRING::Size size, const jjTEXTAPPEARANCE&in style) JJ2+
- Returns the width of text in one of the built-in font sizes
- void jjKillObject(int objectID) JJ2+
- Kills an object
- array<jjLAYER@>@ jjLayerOrderGet() JJ2+
- Returns the layers in the order they're drawn, from the front to the back
- bool jjLayerOrderSet(const array<jjLAYER@>&in order) JJ2+ partially supported
- Changes which layers are drawn and in what order
- array<jjLAYER@>@ jjLayersFromLevel(const string&in filename, const array<uint>&in layerIDs, int tileIDAdjustmentFactor = 0) JJ2+
- Creates new layers from the layers of another level
- bool jjMaskedHLine(int xPixel, int lineLength, int yPixel) JJ2+
- Returns whether any pixel of a horizontal line in the sprite layer is solid
- bool jjMaskedHLine(int xPixel, int lineLength, int yPixel, uint8 layer) JJ2+ partially supported
- Returns whether any pixel of a horizontal line is solid, see jjMaskedHLine()
- bool jjMaskedPixel(int xPixel, int yPixel) JJ2+
- Returns whether a pixel of the sprite layer is solid
- bool jjMaskedPixel(int xPixel, int yPixel, uint8 layer) JJ2+ partially supported
- Returns whether a pixel is solid, see jjMaskedPixel()
- int jjMaskedTopVLine(int xPixel, int yPixel, int lineLength) JJ2+
- Returns where the topmost solid pixel of a vertical line in the sprite layer is
- int jjMaskedTopVLine(int xPixel, int yPixel, int lineLength, uint8 layer) JJ2+ partially supported
- Returns where the topmost solid pixel of a vertical line is, see jjMaskedTopVLine()
- bool jjMaskedVLine(int xPixel, int yPixel, int lineLength) JJ2+
- Returns whether any pixel of a vertical line in the sprite layer is solid
- bool jjMaskedVLine(int xPixel, int yPixel, int lineLength, uint8 layer) JJ2+ partially supported
- Returns whether any pixel of a vertical line is solid, see jjMaskedVLine()
- bool jjMusicLoad(string&in filename, bool forceReload = false, bool temporary = false) JJ2+
- Loads a music file and starts playing it
- void jjMusicPause() JJ2+
- Pauses the current music
- void jjMusicPlay() JJ2+
- Starts playing the current music, or restarts it
- void jjMusicResume() JJ2+
- Resumes the music paused by jjMusicPause()
- void jjMusicStop() JJ2+
- Stops the current music
- void jjNxt(const string&in filename, bool warp = false, bool fast = false) JJ2+ partially supported
- Ends the level and continues with the given level
- void jjNxt(bool warp = false, bool fast = false) JJ2+
- Ends the level and continues with the next one
- int jjParameterGet(uint16 xTile, uint16 yTile, int offset, int length) JJ2+ partially supported
- Returns one parameter of the event placed on a tile
- void jjParameterSet(uint16 xTile, uint16 yTile, int8 offset, int8 length, int newValue) JJ2+ partially supported
- Changes one parameter of the event placed on a tile
- void jjPrint(const string&in text, bool timestamp = false) JJ2+ partially supported
- Writes text to the log
- uint jjRandom() JJ2+ C++
- Returns a random 32-bit number
- bool jjRegexIsValid(const string&in expression) JJ2+
- Checks whether a string is a valid regular expression
- bool jjRegexMatch(const string&in text, const string&in expression, bool ignoreCase = false) JJ2+
- Checks whether a regular expression matches the whole text
- bool jjRegexMatch(const string&in text, const string&in expression, array<string>&out results, bool ignoreCase = false) JJ2+
- Checks whether a regular expression matches the whole text, with captured groups
- string jjRegexReplace(const string&in text, const string&in expression, const string&in replacement, bool ignoreCase = false) JJ2+
- Replaces every match of a regular expression in the text
- bool jjRegexSearch(const string&in text, const string&in expression, bool ignoreCase = false) JJ2+
- Checks whether a regular expression matches any part of the text
- bool jjRegexSearch(const string&in text, const string&in expression, array<string>&out results, bool ignoreCase = false) JJ2+
- Checks whether a regular expression matches any part of the text, with captured groups
- void jjResetWaterGradient() JJ2+
- Restores the default colors of the water
- void jjSample(float xPixel, float yPixel, SOUND::Sample sample, int volume = 63, int frequency = 0) JJ2+
- Plays a sound sample at a position in the level
- bool jjSampleIsLoaded(SOUND::Sample sample) JJ2+ C++
- Returns whether a sound sample is available to play
- bool jjSampleLoad(SOUND::Sample sample, string&in filename) JJ2+
- Loads a sound sample from a file and returns whether it succeeded
- int jjSampleLooped(float xPixel, float yPixel, SOUND::Sample sample, int channel, int volume = 63, int frequency = 0) JJ2+
- Plays a looping sound sample at a position in the level and returns its channel
- void jjSamplePriority(SOUND::Sample sample) JJ2+ C++
- Plays a sound sample at full volume regardless of where the players are
- bool jjSendPacket(const jjSTREAM&in packet, int toClientID = 0, uint toScriptModuleID = ::jjScriptModuleID) JJ2+ partially supported
- Sends a stream of data between the server and clients in multiplayer
- void jjSetDarknessColor(jjPALCOLOR color = jjPALCOLOR()) JJ2+
- Sets the color of darkness used by ambient lighting
- void jjSetFadeColors(uint8 red, uint8 green, uint8 blue) JJ2+
- Sets the fade color of the textured background
- void jjSetFadeColors(uint8 paletteColorID = 207) JJ2+
- Sets the fade color of the textured background to the color of a palette entry
- void jjSetFadeColors(jjPALCOLOR color) JJ2+ C++
- Sets the fade color of the textured background
- void jjSetLayerXSpeed(uint8 layerID, float newspeed, bool newSpeedIsAnAutoSpeed) JJ2+
- Changes the horizontal speed or automatic speed of one of the original layers
- void jjSetLayerYSpeed(uint8 layerID, float newspeed, bool newSpeedIsAnAutoSpeed) JJ2+
- Changes the vertical speed or automatic speed of one of the original layers
- void jjSetModPosition(int order, int row, bool reset) JJ2+ partially supported
- Jumps to a row of a position in the order list of the playing module music
- void jjSetModSpeed(uint8 speed) JJ2+ partially supported
- Sets the speed (ticks per row) of the playing module music, until the module sets another one
- void jjSetModTempo(uint8 tempo) JJ2+ partially supported
- Sets the tempo of the playing module music, until the module sets another one
- void jjSetWaterGradient(uint8 red1, uint8 green1, uint8 blue1, uint8 red2, uint8 green2, uint8 blue2) JJ2+ partially supported
- Sets the colors of the water from two RGB colors
- void jjSetWaterGradient(jjPALCOLOR color1, jjPALCOLOR color2) JJ2+
- Sets the colors of the water from two palette colors
- void jjSetWaterGradient() JJ2+
- Sets the colors of the water from the textured background colors of the palette
- float jjSetWaterLevel(float yPixel, bool instant) JJ2+
- Moves the water surface to a new height
- float jjSin(uint angle) JJ2+
- Returns the sine of an angle from a 1024-step table
- void jjSlideModChannelVolume(int channel, float volume, int milliseconds) JJ2+ partially supported
- Gradually changes the volume of a channel of the playing module music
- int jjSpriteModeFirstFreeMapping() JJ2+
- Returns the lowest mapping index not defined yet, or -1 if all 256 are in use
- jjPAL@ jjSpriteModeGetColorMapping(uint8 index) JJ2+
- Returns a copy of the color mapping with the given index
- array<uint8>@ jjSpriteModeGetIndexMapping(uint8 index) JJ2+
- Returns a copy of the index mapping with the given index
- bool jjSpriteModeIsMappingUsed(uint8 index) JJ2+
- Returns whether a mapping with the given index was defined by jjSpriteModeSetMapping()
- void jjSpriteModeSetMapping(uint8 index, const array<uint8>&in indexMapping, const jjPAL&in rgbMapping) JJ2+ partially supported
- Defines a color mapping for SPRITE::MAPPING, with colors of its own
- void jjSpriteModeSetMapping(uint8 index, const array<uint8>&in indexMapping) JJ2+ partially supported
- Defines a color mapping for SPRITE::MAPPING
- void jjSpy(const string&in text) JJ2+
- Writes text to the log
- bool jjSwitchTrigger(uint8 id) JJ2+
- Flips the state of a level trigger
- uint16 jjTileGet(uint8 layer, int xTile, int yTile) JJ2+
- Returns the tile at a position in tiles in one of the original layers
- uint16 jjTileSet(uint8 layer, int xTile, int yTile, uint16 newTile) JJ2+
- Changes the tile at a position in tiles in one of the original layers
- bool jjTilesFromTileset(const string&in filename, uint firstTileID, uint tileCount, const array<uint8>@ paletteColorMapping = null) JJ2+
- Appends tiles of another tile set to the end of the level's tile set
- bool jjTilesFromTileset32(const string&in filename, uint firstTileID, uint tileCount, const jjPAL@ palette = null) JJ2+
- Appends tiles of another tile set as 32-bit tiles
- void jjTriggerRock(uint8 id) JJ2+
- Starts every rolling rock with the given rock ID
- uint64 jjUnixTimeMs() JJ2+ C++
- Returns the current UTC time as milliseconds since 1 January 1970
- uint64 jjUnixTimeSec() JJ2+ C++
- Returns the current UTC time as whole seconds since 1 January 1970
- void jjUpdateTexturedBG() JJ2+ deprecated
- Redraws the textured background from the tiles of its layer
- bool jjZlibCompress(const jjSTREAM&in input, jjSTREAM&out output) JJ2+
- Compresses the contents of a stream with zlib
- bool jjZlibUncompress(const jjSTREAM&in input, jjSTREAM&out output, uint size) JJ2+
- Decompresses zlib data from a stream
Variables
- uint jjActiveGameTicks read-only JJ2+ partially supported
- Number of game ticks elapsed while the game was actually running
- const bool jjAllowsFireball JJ2+
- Whether weapon 8 is the fireball instead of the pepper spray
- jjTILE@ jjAnimatedTiles[uint16] read-only JJ2+
- The animated tiles of the level by their index
- jjANIMATION@ jjAnimations[uint] read-only JJ2+
- The animation at a global index
- jjANIMFRAME@ jjAnimFrames[uint] read-only JJ2+
- The animation frame at a global index
- jjANIMSET@ jjAnimSets[uint] read-only JJ2+ C++
- The animation set of an ANIM::Set value
- const bool jjAutoWeaponChange JJ2+
- Whether picking up ammo of a new weapon switches to it automatically
- const jjPAL jjBackupPalette JJ2+
- Original palette of the level, as it was when the script was loaded
- int jjBorderHeight read-only JJ2+ partially supported
- The height of the black border on the top and bottom side of each subscreen
- int jjBorderWidth read-only JJ2+ partially supported
- The width of the black border on the left and right side of each subscreen
- jjPLAYER@ jjBottomFeeder read-only JJ2+
- Player with the fewest points in Roast Tag, anyone can roast them, or
null - jjCHARACTER@ jjCharacters[CHAR::Char] read-only JJ2+
- The profile of the given character
- const int jjColorDepth JJ2+
- Color depth of the display in bits per pixel
- const jjCONTROLPOINT@ jjControlPoints[int] read-only JJ2+
- Control points of Domination, ordered from top to bottom and then from left to right
- const bool jjDeactivatingBecauseOfDeath JJ2+ partially supported
- Whether objects are being unloaded because the player died
- bool jjDelayGeneratedCrateOrigins JJ2+ partially supported
- Whether crates made by a generator take their parameters from the tile where they land
- int jjDifficulty JJ2+ partially supported
- Current difficulty
- int jjDifficultyNext JJ2+ partially supported
- Difficulty to use for the next level
- const int jjDifficultyOrig JJ2+
- Difficulty the level was started with
- bool jjDoZombiesAlreadyExist read-only JJ2+
- Whether any player is a zombie in Pestilence
- int jjEcho JJ2+ partially supported
- Strength of the echo effect, as set by the Echo event
- bool jjEnabledASFunctions[uint8] JJ2+
- Whether each numbered
onFunction#callback may be called by Text events - bool jjEnabledTeams[uint8] read-only JJ2+ partially supported
- Whether a team is enabled in the current game
- LIGHT::Enforce jjEnforceLighting JJ2+
- How much of the lighting players are allowed to turn off
- uint8 jjEventAtLastMaskedPixel read-only JJ2+
- The event of the tile where a mask function last found a solid pixel
- int jjFPS read-only JJ2+ C++
- Average number of frames drawn per second
- const GAME::Connection jjGameConnection JJ2+ partially supported
- Whether players from other computers can join, and over which network
- const GAME::Custom jjGameCustom JJ2+
- Custom mode of the current game, if any
- const GAME::Mode jjGameMode JJ2+
- Base mode of the current game
- GAME::State jjGameState read-only JJ2+ partially supported
- The state of the multiplayer game
- const int jjGameTicks JJ2+
- Number of game ticks elapsed in the level
- string jjHelpStrings[uint] JJ2+
- Text strings of the level, indexed from 0
- bool jjIsAdmin read-only JJ2+ partially supported
- Whether the local player is logged in as an administrator of the server
- const bool jjIsServer JJ2+ partially supported
- Whether this instance of the game hosts a multiplayer server
- bool jjIsSnowing JJ2+
- Whether a weather effect is active
- bool jjIsSnowingOutdoorsOnly JJ2+
- Whether the weather effect is limited to outdoor areas of the level
- const bool jjIsTSF JJ2+
- Whether content of the later game version with Lori is available
- bool jjKey[uint8] read-only JJ2+
- Whether a key or a mouse button is currently held down
- uint8 jjKeyChat JJ2+ partially supported
- Virtual-key code of the key that opens the chat prompt
- bool jjLayerHasTiles[uint8] JJ2+
- Whether the original layers are drawn, indexed by layer number from 1 to 8
- int jjLayerHeight[uint8] read-only JJ2+
- The height of the original layers in tiles, indexed by layer number from 1 to 8
- bool jjLayerLimitVisibleRegion[uint8] JJ2+
- Whether the original layers are shifted down depending on the resolution, indexed by layer number from 1 to 8
- jjLAYER@ jjLayers[int] read-only JJ2+
- The layers of the level by their original number, from 1 to 8
- bool jjLayerTileHeight[uint8] JJ2+
- Whether the original layers repeat vertically, indexed by layer number from 1 to 8
- bool jjLayerTileWidth[uint8] JJ2+
- Whether the original layers repeat horizontally, indexed by layer number from 1 to 8
- int jjLayerWidth[uint8] read-only JJ2+
- The width of the original layers in tiles, indexed by layer number from 1 to 8
- int jjLayerWidthReal[uint8] read-only JJ2+
- The width of the original layers in tiles including widening for tiling, indexed by layer number from 1 to 8
- int jjLayerWidthRounded[uint8] read-only JJ2+
- The width of the original layers in groups of four tiles, indexed by layer number from 1 to 8
- float jjLayerXAutoSpeed[uint8] JJ2+
- The horizontal automatic scrolling speed of the original layers, indexed by layer number from 1 to 8
- float jjLayerXOffset[uint8] JJ2+
- The horizontal offset of the original layers in pixels, indexed by layer number from 1 to 8
- float jjLayerXSpeed[uint8] JJ2+
- The horizontal parallax speed of the original layers, indexed by layer number from 1 to 8
- float jjLayerYAutoSpeed[uint8] JJ2+
- The vertical automatic scrolling speed of the original layers, indexed by layer number from 1 to 8
- float jjLayerYOffset[uint8] JJ2+
- The vertical offset of the original layers in pixels, indexed by layer number from 1 to 8
- float jjLayerYSpeed[uint8] JJ2+
- The vertical parallax speed of the original layers, indexed by layer number from 1 to 8
- string jjLevelFileName read-only JJ2+
- The file name of the current level
- string jjLevelName JJ2+
- The title of the current level
- const int jjLocalPlayerCount JJ2+
- The number of local players
- jjPLAYER@ jjLocalPlayers[uint8] read-only JJ2+
- The local player with the given index
- const bool jjLowDetail JJ2+
- Whether the low detail video option is enabled
- int jjMaxHealth read-only JJ2+
- The highest health a player can have
- const int jjMaxScore JJ2+
- Score needed to win a competitive game, 0 outside of multiplayer
- int jjMouseX read-only JJ2+
- The horizontal position of the mouse cursor
- int jjMouseY read-only JJ2+
- The vertical position of the mouse cursor
- bool jjMusicActive read-only JJ2+
- Whether music is enabled in the settings
- string jjMusicFileName read-only JJ2+
- File name of the music currently playing
- int jjMusicVolume read-only JJ2+
- Volume of music set in the settings
- const int jjObjectCount JJ2+
- One past the highest object ID in use
- const int jjObjectMax JJ2+
- Maximum number of objects that can exist at once, currently 2048
- jjOBJ@ jjObjectPresets[uint8] read-only JJ2+
- The templates of new objects, indexed by event ID
- jjOBJ@ jjObjects[int] read-only JJ2+
- All objects of the level, indexed by object ID
- jjPLAYER@ jjP read-only JJ2+ deprecated
- The current player
- jjPAL jjPalette JJ2+ partially supported
- Palette the game currently draws with
- jjPARTICLE@ jjParticles[int] read-only JJ2+ C++
- All particles of the level, indexed from 0 to 1023
- const int jjPlayerCount JJ2+ C++
- The number of players in the level
- jjPLAYER@ jjPlayers[uint8] read-only JJ2+
- The player with the given index
- const int jjRenderFrame JJ2+
- Frame counter used to time drawing and automatic layer movement
- const int jjResolutionHeight JJ2+
- Height of the game view in pixels
- const int jjResolutionMaxHeight JJ2+
- Largest height a subscreen may have in the current level
- const int jjResolutionMaxWidth JJ2+
- Largest width a subscreen may have in the current level
- const int jjResolutionWidth JJ2+
- Width of the game view in pixels
- const int jjScriptModuleID JJ2+
- Identifier of the script module that reads it
- const bool jjShowMaxHealth JJ2+
- Whether missing health is shown as empty hearts in the HUD
- uint8 jjSnowingIntensity JJ2+
- Intensity of the weather effect
- SNOWING::Type jjSnowingType JJ2+
- Kind of the weather effect
- bool jjSoundEnabled read-only JJ2+
- Whether the game produces any audio
- bool jjSoundFXActive read-only JJ2+
- Whether sound effects are enabled in the settings
- int jjSoundFXVolume read-only JJ2+
- Volume of sound effects set in the settings
- int jjStartHealth read-only JJ2+
- The health a player starts with
- const bool jjStrongPowerups JJ2+
- Whether the server enabled stronger powered-up weapons
- const int jjSubscreenHeight JJ2+
- Height of a player's subscreen in pixels
- const int jjSubscreenWidth JJ2+
- Width of a player's subscreen in pixels
- bool jjSugarRushAllowed JJ2+ partially supported
- Whether players may get a sugar rush in this level
- bool jjSugarRushesAllowed JJ2+
- Alternative name of jjSugarRushAllowed
- int jjTeamScore[TEAM::Color] read-only JJ2+ partially supported
- The current score of a team in team-based game modes
- float jjTexturedBGFadePositionX JJ2+
- The horizontal fade position of the textured background
- float jjTexturedBGFadePositionY JJ2+
- The vertical fade position of the textured background
- bool jjTexturedBGStars JJ2+
- Whether the textured background shows stars
- TEXTURE::Style jjTexturedBGStyle JJ2+
- The effect the textured background is drawn with
- TEXTURE::Texture jjTexturedBGTexture JJ2+
- The texture of the textured background
- bool jjTexturedBGUsed JJ2+
- Whether
jjLayers[8]is drawn textured - const uint jjTileCount JJ2+
- Number of static tiles currently available in the level
- bool jjTileIs32Bit[uint16] read-only JJ2+
- Whether a tile uses 32-bit colors, indexed by tile ID
- const jjTILE@ jjTiles[uint16] read-only JJ2+
- The tiles of the level by tile ID, read-only
- string jjTilesetFileName read-only JJ2+
- The file name of the tile set used by the current level
- uint8 jjTileType[uint16] JJ2+ partially supported
- The type of a tile, indexed by tile ID
- jjPLAYER@ jjTokenOwner read-only JJ2+
- Player holding Eva's Ring in Roast Tag, or
null - bool jjTriggers[uint8] JJ2+
- State of the level triggers, indexed by trigger ID
- bool jjUseLayer8Speeds JJ2+
- Whether the background layer moves by its own speeds
- bool jjVerticalSplitscreen JJ2+ partially supported
- Whether the screen is split vertically when there are exactly two local players
- bool jjWarpsTransmuteCoins JJ2+
- Whether a coin warp in single player turns the remaining coins into gems
- float jjWaterChangeSpeed JJ2+
- Speed of the water surface after a non-instant jjSetWaterLevel()
- WATERINTERACTION::WaterInteraction jjWaterInteraction JJ2+ partially supported
- How local players move underwater
- int jjWaterLayer JJ2+ partially supported
- Layer the water is drawn in front of
- float jjWaterLevel read-only JJ2+
- Current height of the water surface in pixels
- WATERLIGHT::wl jjWaterLighting JJ2+ partially supported
- How ambient lighting behaves when the level has water
- float jjWaterTarget read-only JJ2+
- Height in pixels the water surface is moving towards
- jjWEAPON@ jjWeapons[int] read-only JJ2+
- The options of the given weapon
- jjPLAYER@ p read-only JJ2+ deprecated
- Alias of jjP, the only global without the
jjprefix
Hooks
Functions a level script can define, the game calls them automatically.
- bool onCheat(string&in cheat) JJ2+
- Called when a player enters a cheat code in the console
- bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Called when the HUD draws the weapon and ammo of a player
- bool onDrawGameModeHUD(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+ partially supported
- Called when the HUD draws the information of the game mode of a multiplayer game
- bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Called when the HUD draws the health of a player
- void onDrawLayer1(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 1
- void onDrawLayer2(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 2
- void onDrawLayer3(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 3
- void onDrawLayer4(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 4, the sprite layer
- void onDrawLayer5(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 5
- void onDrawLayer6(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 6
- void onDrawLayer7(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 7
- void onDrawLayer8(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Draws into the level at layer 8, the background
- bool onDrawLives(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Called when the HUD draws the lives of a player
- bool onDrawPlayerTimer(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
- Called when the HUD draws the timer of a player
- bool onDrawScore(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+ partially supported
- Called when the HUD draws the score of a player
- void onFunction0(jjPLAYER@ player, uint8 param) JJ2+
- Called by a Script Callback event of the level, numbered from 0 to 255
- void onLevelBegin() JJ2+
- Called once when the level begins
- void onLevelLoad() JJ2+
- Called once when the level is loaded
- void onLevelReload() JJ2+
- Called after the level returns to the last checkpoint
- void onMain() JJ2+
- Called once in every game tick
- void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) JJ2+
- Called when an object with scripted collisions is hit
- void onPlayer(jjPLAYER@ player) JJ2+
- Called in every game tick for each player, after onMain()
- void onPlayerDraw(jjPLAYERDRAW& draw) JJ2+
- Called in every game tick for each player to adjust how it is drawn
- void onPlayerInput(jjPLAYER@ player) JJ2+
- Called in every game tick for each player, before onMain()
- void onPlayerTimerEnd(jjPLAYER@ player) JJ2+
- Called when the timer of a player runs out
- void onRoast(jjPLAYER@ victim, jjPLAYER@ killer) JJ2+ partially supported
- Called when a player dies
Funcdef documentation
funcdef void jjVOIDFUNCOBJ(jjOBJ@) JJ2+
Signature of a behavior function, see jjOBJ::behavior
A function taking the object it drives, called once per tick. A delegate of a class method with the same signature works too.
Function documentation
int jjAddObject(uint8 eventID, float xPixel, float yPixel, uint16 creatorID = 0, CREATOR::Type creatorType = CREATOR::OBJECT, BEHAVIOR::Behavior behavior = BEHAVIOR::DEFAULT) JJ2+
Creates a new object
| Parameters | |
|---|---|
| eventID | Event of the object, usually an OBJECT::Object constant |
| xPixel | Horizontal position in pixels |
| yPixel | Vertical position in pixels |
| creatorID | Object or player that created the object, see jjOBJ::creatorID |
| creatorType | Kind of the creator, see jjOBJ::creatorType |
| behavior | Behavior to use instead of the template's, BEHAVIOR::DEFAULT keeps the template's |
| Returns | Object ID of the new object (an index of jjObjects), or 0 on failure |
The object is built from the template in jjObjectPresets for eventID and placed at the given position, which also becomes its jjOBJ::xOrg and jjOBJ::yOrg. Its behavior runs once right away while the object is still in STATE::START, so passing behavior here is not the same as assigning jjOBJ::behavior afterward, when the template's behavior has already initialized the object. The same applies to the creator.
int jjAddObject(uint8 eventID, float xPixel, float xPixel, uint16 creatorID, CREATOR::Type creatorType, jjVOIDFUNCOBJ@ behavior) JJ2+
Creates a new object driven by a behavior function
| Parameters | |
|---|---|
| eventID | Event of the object, usually an OBJECT::Object constant |
| xPixel | Vertical position in pixels |
| xPixel | Vertical position in pixels |
| creatorID | Object or player that created the object, see jjOBJ::creatorID |
| creatorType | Kind of the creator, see jjOBJ::creatorType |
| behavior | Behavior function of the new object |
| Returns | Object ID of the new object (an index of jjObjects), or 0 on failure |
Works like the other overload, but the new object gets the given function as its jjOBJ::behavior, and the function runs once right away.
jjPARTICLE@ jjAddParticle(PARTICLE::Type type) JJ2+
Creates a new particle
| Parameters | |
|---|---|
| type | Type of the particle, PARTICLE::INACTIVE is not allowed |
| Returns | The new particle, or null if all particle slots are in use or the type is invalid |
The particle starts at position 0, 0 with default values for its type, so at least set its position afterward.
void jjAddParticlePixelExplosion(float xPixel, float yPixel, int curFrame, int direction, int mode) JJ2+
Bursts a sprite frame into pixel particles
| Parameters | |
|---|---|
| xPixel | Horizontal position in pixels |
| yPixel | Vertical position in pixels |
| curFrame | Frame to burst, an index of jjAnimFrames |
| direction | Negative to flip the frame horizontally |
| mode | Currently ignored, every mode looks the same |
The pieces take the shape of the frame, drawn as it would be at the given position.
void jjAlert(const string&in text, bool sendToAll = false, STRING::Size size = STRING::SMALL) JJ2+
Shows a message to the local player
| Parameters | |
|---|---|
| text | Text of the message |
| sendToAll | Currently ignored |
| size | STRING::Size of the text |
Small text is added to the messages at the bottom of the screen, other sizes are shown in big letters the way a Text event shows text.
void jjChat(const string&in text, bool teamchat = false) JJ2+
Sends a line of chat
| Parameters | |
|---|---|
| text | Text of the message |
| teamchat | Currently ignored |
The text is added to the messages at the bottom of the screen. Of the commands, text starting with /, /smhealth sets the maximum health of the players, /maxresolution sets what jjResolutionMaxWidth and jjResolutionMaxHeight report and /difficulty sets jjDifficulty, the other ones are ignored.
void jjDeleteObject(int objectID) JJ2+
Removes an object from the level
The same as calling jjOBJ::delete() on jjObjects[objectID].
void jjDrawPixel(float xPixel, float yPixel, uint8 color, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a single pixel into the level
Unlike the jjCANVAS methods, the jjDraw* functions only queue the drawing; it happens later in the frame, in the order of the calls. Coordinates are in level pixels. layerZ selects the layer the graphic appears in front of, 4 being the sprite layer; if the layer order was changed, its distance from 4 counts from the sprite layer.
void jjDrawRectangle(float xPixel, float yPixel, int width, int height, uint8 color, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a filled rectangle into the level
The level counterpart of jjCANVAS::drawRectangle(); see jjDrawPixel() for the layer and player parameters.
void jjDrawResizedSprite(float xPixel, float yPixel, int setID, uint8 animation, uint8 frame, float xScale, float yScale, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a scaled frame of an animation set into the level
The level counterpart of jjCANVAS::drawResizedSprite(); see jjDrawPixel() for the layer and player parameters.
void jjDrawResizedSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, float xScale, float yScale, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a scaled frame given by its index in jjAnimFrames into the level
The level counterpart of jjCANVAS::drawResizedSpriteFromCurFrame(); see jjDrawPixel() for the layer and player parameters.
void jjDrawRotatedSprite(float xPixel, float yPixel, int setID, uint8 animation, uint8 frame, int angle, float xScale = 1, float yScale = 1, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a rotated and scaled frame of an animation set into the level
The level counterpart of jjCANVAS::drawRotatedSprite(); see jjDrawPixel() for the layer and player parameters.
void jjDrawRotatedSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, int angle, float xScale = 1, float yScale = 1, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a rotated and scaled frame given by its index in jjAnimFrames into the level
The level counterpart of jjCANVAS::drawRotatedSpriteFromCurFrame(); see jjDrawPixel() for the layer and player parameters.
void jjDrawSprite(float xPixel, float yPixel, int setID, uint8 animation, uint8 frame, int8 direction = 0, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a frame of an animation set into the level
The level counterpart of jjCANVAS::drawSprite(); see jjDrawPixel() for the layer and player parameters.
void jjDrawSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, int8 direction = 0, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a frame given by its index in jjAnimFrames into the level
The level counterpart of jjCANVAS::drawSpriteFromCurFrame(); see jjDrawPixel() for the layer and player parameters.
void jjDrawString(float xPixel, float yPixel, const string&in text, const jjANIMATION&in animation, STRING::Mode mode = STRING::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws text into the level using the frames of an animation as the font
void jjDrawString(float xPixel, float yPixel, const string&in text, const jjANIMATION&in animation, const jjTEXTAPPEARANCE&in appearance, uint8 param1 = 0, SPRITE::Mode spriteMode = SPRITE::PALSHIFT, uint8 param2 = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws text into the level using the frames of an animation as the font, with a custom appearance
void jjDrawString(float xPixel, float yPixel, const string&in text, STRING::Size size = STRING::SMALL, STRING::Mode mode = STRING::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws text in one of the built-in font sizes into the level
The level counterpart of jjCANVAS::drawString(); see jjDrawPixel() for the layer and player parameters.
void jjDrawString(float xPixel, float yPixel, const string&in text, STRING::Size size, const jjTEXTAPPEARANCE&in appearance, uint8 param1 = 0, SPRITE::Mode spriteMode = SPRITE::PALSHIFT, uint8 param2 = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws text in one of the built-in font sizes into the level, with a custom appearance
See jjDrawPixel() for the layer and player parameters.
void jjDrawSwingingVineSpriteFromCurFrame(float xPixel, float yPixel, uint sprite, int length, int curvature, SPRITE::Mode mode = SPRITE::NORMAL, uint8 param = 0, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a frame bent like a swinging vine into the level
The level counterpart of jjCANVAS::drawSwingingVineSpriteFromCurFrame(); see jjDrawPixel() for the layer and player parameters.
void jjDrawTile(float xPixel, float yPixel, uint16 tile, TILE::Quadrant tileQuadrant = TILE::ALLQUADRANTS, int8 layerZ = 4, uint8 layerXY = 4, int8 playerID = -1) JJ2+
Draws a tile of the tile set into the level
The level counterpart of jjCANVAS::drawTile(); see jjDrawPixel() for the layer and player parameters. The tile is only drawn, it doesn't become solid.
int jjEventGet(uint16 xTile, uint16 yTile) JJ2+
Returns the event ID placed on a tile of the sprite layer
Tiles are addressed by xTile and yTile. The number uses the event numbering of the original game, so it can be compared with OBJECT::Object and AREA::Area constants.
void jjEventSet(uint16 xTile, uint16 yTile, uint8 newEventID) JJ2+
Replaces the event placed on a tile
newEventID is the new event number, e.g. an OBJECT::Object or AREA::Area constant. Only the event ID changes, the parameters already stored on the tile are kept.
void jjGenerateSettableTileArea(uint8 layer, int xTile, int yTile, int width, int height) JJ2+
Prepares a rectangular area of one of the original layers for jjTileSet()
Has no effect, every tile can already be changed on its own.
int jjGetModOrder() JJ2+
Returns the current position in the order list of the playing module music
-1 if no module music plays.
int jjGetModRow() JJ2+
Returns the current row of the playing module music
-1 if no module music plays.
int jjGetModSpeed() JJ2+
Returns the speed (ticks per row) of the playing module music
-1 if no module music plays.
int jjGetModTempo() JJ2+
Returns the tempo of the playing module music, in beats per minute
-1 if no module music plays.
uint16 jjGetStaticTile(uint16 tileID) JJ2+
Returns the frame an animated tile currently shows
A tile that isn't animated is returned as it is.
int jjGetStringWidth(const string&in text, const jjANIMATION&in animation, const jjTEXTAPPEARANCE&in style) JJ2+
Returns the width of text drawn with an animation as the font
Measured in pixels as jjCANVAS::drawString() would lay the text out with the appearance; for text of several lines, the width of the widest one.
int jjGetStringWidth(const string&in text, STRING::Size size, const jjTEXTAPPEARANCE&in style) JJ2+
Returns the width of text in one of the built-in font sizes
Measured in pixels, taking spacing and the treatment of line feeds from the appearance into account; for text of several lines, the width of the widest one. Works before the HUD exists, e.g. in onLevelLoad().
void jjKillObject(int objectID) JJ2+
Kills an object
Unlike jjDeleteObject(), the object dies the regular way first, so whatever it does on death still happens.
array<jjLAYER@>@ jjLayerOrderGet() JJ2+
Returns the layers in the order they're drawn, from the front to the back
Includes every layer currently drawn, the ones a script added by jjLayerOrderSet() too.
bool jjLayerOrderSet(const array<jjLAYER@>&in order) JJ2+
Changes which layers are drawn and in what order
The first layer of the array is drawn in front, the last one at the back. Layers left out aren't drawn. The array must contain jjLayers[4] and no null handles, otherwise nothing changes and false is returned. A layer that appears more than once is placed by its first appearance.
jjLayers and the global functions that take a layer number keep referring to the original eight layers after the order changes.
array<jjLAYER@>@ jjLayersFromLevel(const string&in filename, const array<uint>&in layerIDs, int tileIDAdjustmentFactor = 0) JJ2+
Creates new layers from the layers of another level
layerIDs are the numbers of the layers to take, from 1 to 8. The level is read from the Source directory, or the layers are copied as they are now if it's the current level. tileIDAdjustmentFactor is added to every non-empty, non-animated tile, which helps when the tiles were added by jjTilesFromTileset(); animated tiles refer to the animated tiles of this level. The new layers aren't drawn until they're included in jjLayerOrderSet().
Returns an empty array if the level can't be read or any of the numbers is invalid.
bool jjMaskedHLine(int xPixel, int lineLength, int yPixel) JJ2+
Returns whether any pixel of a horizontal line in the sprite layer is solid
The line starts at xPixel,yPixel and is lineLength pixels long to the right. Returns false if lineLength isn't positive. Sets jjEventAtLastMaskedPixel like jjMaskedPixel().
bool jjMaskedHLine(int xPixel, int lineLength, int yPixel, uint8 layer) JJ2+
Returns whether any pixel of a horizontal line is solid, see jjMaskedHLine()
bool jjMaskedPixel(int xPixel, int yPixel) JJ2+
Returns whether a pixel of the sprite layer is solid
Coordinates are in pixels. When a solid pixel is found, jjEventAtLastMaskedPixel is set to the event of its tile.
bool jjMaskedPixel(int xPixel, int yPixel, uint8 layer) JJ2+
Returns whether a pixel is solid, see jjMaskedPixel()
int jjMaskedTopVLine(int xPixel, int yPixel, int lineLength) JJ2+
Returns where the topmost solid pixel of a vertical line in the sprite layer is
The line starts at xPixel,yPixel and is lineLength pixels long downwards. The result counts from 1, so it's 1 if yPixel itself is solid, and lineLength + 1 if no pixel of the line is. Useful for finding slopes under an object. Sets jjEventAtLastMaskedPixel like jjMaskedPixel().
int jjMaskedTopVLine(int xPixel, int yPixel, int lineLength, uint8 layer) JJ2+
Returns where the topmost solid pixel of a vertical line is, see jjMaskedTopVLine()
bool jjMaskedVLine(int xPixel, int yPixel, int lineLength) JJ2+
Returns whether any pixel of a vertical line in the sprite layer is solid
The line starts at xPixel,yPixel and is lineLength pixels long downwards. Returns false if lineLength isn't positive. Sets jjEventAtLastMaskedPixel like jjMaskedPixel().
bool jjMaskedVLine(int xPixel, int yPixel, int lineLength, uint8 layer) JJ2+
Returns whether any pixel of a vertical line is solid, see jjMaskedVLine()
bool jjMusicLoad(string&in filename, bool forceReload = false, bool temporary = false) JJ2+
Loads a music file and starts playing it
| Returns | Whether the music was loaded or is already playing |
|---|
With forceReload, the file is started again even if it is already playing. With temporary, the music isn't kept as the level's music, so it plays only until the level's own music is restored, e.g. after the player dies.
int jjParameterGet(uint16 xTile, uint16 yTile, int offset, int length) JJ2+
Returns one parameter of the event placed on a tile
| Parameters | |
|---|---|
| xTile | |
| yTile | |
| offset | Position of the first bit, relative to the first parameter |
| length | Number of bits, negative for a signed value |
The parameter is selected the same way the event definitions of the original level editor describe it.
lengthis the bit count of the parameter; a negative value marks a signed parameter.offsetis the sum of the absolute lengths of all parameters stored before the requested one, so the first parameter is at offset 0.
An offset of -4 with a length of 2 reads the difficulty bits of the event instead. Returns 0 if the requested bits fall outside the event data.
void jjParameterSet(uint16 xTile, uint16 yTile, int8 offset, int8 length, int newValue) JJ2+
Changes one parameter of the event placed on a tile
| Parameters | |
|---|---|
| xTile | |
| yTile | |
| offset | Position of the first bit, relative to the first parameter |
| length | Number of bits, negative for a signed value |
| newValue | Value to store |
offset and length select the bits exactly as in jjParameterGet(); the new value is truncated to fit them. Objects that already exist may have read their parameters when they were created and won't notice the change, areas that affect the player and objects created later will.
bool jjRegexIsValid(const string&in expression) JJ2+
Checks whether a string is a valid regular expression
Expressions follow the ECMAScript grammar. Unlike the other regex functions, an invalid expression is not reported as an error here, so call this first whenever the expression comes from user input.
bool jjRegexMatch(const string&in text, const string&in expression, bool ignoreCase = false) JJ2+
Checks whether a regular expression matches the whole text
A match of only part of the text is not enough, use jjRegexSearch() for that. If ignoreCase is true, letter case is ignored. An invalid expression logs an error and returns false.
bool jjRegexMatch(const string&in text, const string&in expression, array<string>&out results, bool ignoreCase = false) JJ2+
Checks whether a regular expression matches the whole text, with captured groups
results receives the whole match first and then each captured group, or nothing if there's no match.
string jjRegexReplace(const string&in text, const string&in expression, const string&in replacement, bool ignoreCase = false) JJ2+
Replaces every match of a regular expression in the text
The replacement may refer to captured groups as $1, $2 and so on, $0 being the whole match. If ignoreCase is true, letter case is ignored. An invalid expression logs an error and returns the text unchanged.
bool jjRegexSearch(const string&in text, const string&in expression, bool ignoreCase = false) JJ2+
Checks whether a regular expression matches any part of the text
If ignoreCase is true, letter case is ignored. An invalid expression logs an error and returns false.
bool jjRegexSearch(const string&in text, const string&in expression, array<string>&out results, bool ignoreCase = false) JJ2+
Checks whether a regular expression matches any part of the text, with captured groups
results receives the first match first and then each captured group, or nothing if there's no match.
void jjSample(float xPixel, float yPixel, SOUND::Sample sample, int volume = 63, int frequency = 0) JJ2+
Plays a sound sample at a position in the level
The position is in level pixels and makes the sound louder or quieter depending on the distance to the players. volume is on a scale where 64 is full volume, and 0 or less is silent. frequency is the playback rate in Hz, 0 plays the sample at its own rate.
bool jjSampleLoad(SOUND::Sample sample, string&in filename) JJ2+
Loads a sound sample from a file and returns whether it succeeded
The loaded sound replaces the sample for every later use of that SOUND::Sample value in the script.
int jjSampleLooped(float xPixel, float yPixel, SOUND::Sample sample, int channel, int volume = 63, int frequency = 0) JJ2+
Plays a looping sound sample at a position in the level and returns its channel
Pass 0 as channel the first time, then the returned channel on every following call, once per game tick for as long as the sound should continue; the sound follows the latest position and stops when the calls stop. Returns 0 if the sample can't be played. volume and frequency work as in jjSample().
bool jjSendPacket(const jjSTREAM&in packet, int toClientID = 0, uint toScriptModuleID = ::jjScriptModuleID) JJ2+
Sends a stream of data between the server and clients in multiplayer
void jjSetDarknessColor(jjPALCOLOR color = jjPALCOLOR()) JJ2+
Sets the color of darkness used by ambient lighting
The dark parts of the level fade to this color instead of black, black by default. Takes effect at once and lasts until the level is left.
void jjSetFadeColors(uint8 red, uint8 green, uint8 blue) JJ2+
Sets the fade color of the textured background
The same as calling setFadeColor() on warpHorizon of the textured background layer, which is jjLayers[8], or if that layer isn't textured but another one is, the farthest textured layer.
void jjSetFadeColors(uint8 paletteColorID = 207) JJ2+
Sets the fade color of the textured background to the color of a palette entry
The default, 207, is the last color of the gradient most textures use.
void jjSetLayerXSpeed(uint8 layerID, float newspeed, bool newSpeedIsAnAutoSpeed) JJ2+
Changes the horizontal speed or automatic speed of one of the original layers
A shortcut for jjLAYER::setXSpeed() of jjLayers[layerID].
void jjSetLayerYSpeed(uint8 layerID, float newspeed, bool newSpeedIsAnAutoSpeed) JJ2+
Changes the vertical speed or automatic speed of one of the original layers
A shortcut for jjLAYER::setYSpeed() of jjLayers[layerID].
void jjSetModPosition(int order, int row, bool reset) JJ2+
Jumps to a row of a position in the order list of the playing module music
The jump is heard at once. While the music is paused, it continues from there once it's resumed.
void jjSetModSpeed(uint8 speed) JJ2+
Sets the speed (ticks per row) of the playing module music, until the module sets another one
void jjSetModTempo(uint8 tempo) JJ2+
Sets the tempo of the playing module music, until the module sets another one
void jjSetWaterGradient(jjPALCOLOR color1, jjPALCOLOR color2) JJ2+
Sets the colors of the water from two palette colors
See the other overload.
void jjSetWaterGradient() JJ2+
Sets the colors of the water from the textured background colors of the palette
The colors of palette indices 176 and 207, the gradient the textured background of the original game fades through.
float jjSetWaterLevel(float yPixel, bool instant) JJ2+
Moves the water surface to a new height
| Returns | The requested height |
|---|
The height is in pixels, unlike the Water Level event, which uses tiles (32 pixels each). If instant is true, the surface jumps there immediately. Otherwise jjWaterTarget is set and the surface moves by jjWaterChangeSpeed pixels every tick until it gets there; a negative target is treated as 0.
void jjSlideModChannelVolume(int channel, float volume, int milliseconds) JJ2+
Gradually changes the volume of a channel of the playing module music
From its current volume to volume (0 to 1) in milliseconds, a new slide of the channel replaces the previous one.
jjPAL@ jjSpriteModeGetColorMapping(uint8 index) JJ2+
Returns a copy of the color mapping with the given index
Returns the colors given to jjSpriteModeSetMapping(); for a mapping defined without them, or not defined at all, the colors of jjPalette the index mapping points to. Never returns null.
array<uint8>@ jjSpriteModeGetIndexMapping(uint8 index) JJ2+
Returns a copy of the index mapping with the given index
The array always has 256 elements. For a mapping that wasn't defined, each index maps to itself.
void jjSpriteModeSetMapping(uint8 index, const array<uint8>&in indexMapping, const jjPAL&in rgbMapping) JJ2+
Defines a color mapping for SPRITE::MAPPING, with colors of its own
Like the overload without rgbMapping, but also stores a color for each of the 256 indices.
void jjSpriteModeSetMapping(uint8 index, const array<uint8>&in indexMapping) JJ2+
Defines a color mapping for SPRITE::MAPPING
index is the mapping number used as the parameter of SPRITE::MAPPING and SPRITE::TRANSLUCENTMAPPING. indexMapping gives the new palette index for each index; indices past its end map to themselves.
bool jjSwitchTrigger(uint8 id) JJ2+
Flips the state of a level trigger
| Returns | New state of the trigger |
|---|
Behaves like the switch option of Trigger Zone and Trigger Crate events.
bool jjTilesFromTileset(const string&in filename, uint firstTileID, uint tileCount, const array<uint8>@ paletteColorMapping = null) JJ2+
Appends tiles of another tile set to the end of the level's tile set
Takes tileCount tiles starting at firstTileID and increases jjTileCount by that many. If paletteColorMapping has at least 256 entries, every pixel of an 8-bit tile is replaced by the entry at its palette index, to fit the colors into the current palette. Returns false on failure.
bool jjTilesFromTileset32(const string&in filename, uint firstTileID, uint tileCount, const jjPAL@ palette = null) JJ2+
Appends tiles of another tile set as 32-bit tiles
The same as jjTilesFromTileset(), but 8-bit tiles are converted to true color, either in the colors of palette or, if it's null, in the tile set's own palette, so they keep their colors whatever the level's palette is.
void jjTriggerRock(uint8 id) JJ2+
Starts every rolling rock with the given rock ID
Same as touching a Trigger Rock event.
void jjUpdateTexturedBG() JJ2+
Redraws the textured background from the tiles of its layer
Changes to textured layers are applied automatically, so this is never needed.
bool jjZlibCompress(const jjSTREAM&in input, jjSTREAM&out output) JJ2+
Compresses the contents of a stream with zlib
The compressed data replaces the contents of output; input is left unchanged. Returns whether it succeeded, which is always false in builds without zlib support.
bool jjZlibUncompress(const jjSTREAM&in input, jjSTREAM&out output, uint size) JJ2+
Decompresses zlib data from a stream
The decompressed data replaces the contents of output. Fails if input isn't valid compressed data or its decompressed size exceeds size bytes, and always in builds without zlib support.
bool closeTo(float, float, float = 0.00001f) built-in
Returns whether two floating-point numbers are nearly equal
Takes the two values and an optional tolerance. Equal values always match. If either value is zero, the absolute difference is compared to the tolerance. Otherwise the test is relative: the difference divided by the sum of both absolute values must be less than the tolerance.
string formatFloat(double val, const string&in options = "", uint width = 0, uint precision = 0) built-in
Formats a floating-point number as text
| Parameters | |
|---|---|
| val | Value to format |
| options | Formatting flags, see above |
| width | Minimum number of characters, the result is never cut to fit |
| precision | Number of digits after the decimal point |
The options string may contain any of these characters:
l— align to the left withinwidth(pads on the right with spaces)0— pad with zeros instead of spaces (ignored together withl)+— always write the sign, also for positive numbers(space) — write a space in place of the sign for positive numberse— use exponent notation with a lowercasee, e.g.1.5e+03E— use exponent notation with an uppercaseE
The decimal separator is always .. The value is rounded to the requested number of decimal places, so with the default precision of 0 no decimal places are written at all.
string formatInt(int64 val, const string&in options = "", uint width = 0) built-in
Formats a signed integer as text
| Parameters | |
|---|---|
| val | Value to format |
| options | Formatting flags, see above |
| width | Minimum number of characters, the result is never cut to fit |
The options string may contain any of these characters:
l— align to the left withinwidth(pads on the right with spaces)0— pad with zeros instead of spaces (ignored together withl)+— always write the sign, also for positive numbers(space) — write a space in place of the sign for positive numbersh— write as lowercase hexadecimalH— write as uppercase hexadecimal
Hexadecimal output of a negative number shows its 64-bit two's complement form.
string formatUInt(uint64 val, const string&in options = "", uint width = 0) built-in
Formats an unsigned integer as text
| Parameters | |
|---|---|
| val | Value to format |
| options | Formatting flags, see formatInt() |
| width | Minimum number of characters, the result is never cut to fit |
Accepts the same options as formatInt(), the sign options have no effect on unsigned values.
float fpFromIEEE(uint) built-in
Reinterprets 32 bits as a float
The bits are taken as an IEEE 754 single-precision number without any numeric conversion.
double fpFromIEEE(uint64) built-in
Reinterprets 64 bits as a double
The bits are taken as an IEEE 754 double-precision number without any numeric conversion.
double parseFloat(const string&in, uint&out byteCount = 0) built-in
Parses a floating-point number from the beginning of a string
| Parameters | |
|---|---|
| byteCount out | Receives the number of bytes that were read, 0 if nothing could be parsed |
| Returns | Parsed value, or 0 if the string doesn't start with a number |
Skips leading whitespace, then reads an optional sign, digits with . as the decimal separator (regardless of the system language) and an optional exponent such as e-3. Parsing stops at the first character that doesn't belong to the number.
int64 parseInt(const string&in, uint base = 10, uint&out byteCount = 0) built-in
Parses a signed integer from the beginning of a string
| Parameters | |
|---|---|
| base | Number base, only 10 and 16 are supported, any other base returns 0 |
| byteCount out | Receives the number of bytes that were read, 0 if nothing could be parsed |
| Returns | Parsed value, or 0 if the string doesn't start with a number |
Reads an optional + or - sign followed by digits and stops at the first character that doesn't belong to the number. Leading whitespace and prefixes like 0x are not accepted. Values that don't fit into 64 bits overflow silently.
uint64 parseUInt(const string&in, uint base = 10, uint&out byteCount = 0) built-in
Parses an unsigned integer from the beginning of a string
| Parameters | |
|---|---|
| base | Number base, only 10 and 16 are supported, any other base returns 0 |
| byteCount out | Receives the number of bytes that were read, 0 if nothing could be parsed |
| Returns | Parsed value, or 0 if the string doesn't start with a number |
Reads digits and stops at the first character that doesn't belong to the number. No sign is accepted, leading whitespace and prefixes like 0x neither. Values that don't fit into 64 bits overflow silently.
Variable documentation
uint jjActiveGameTicks read-only JJ2+
Number of game ticks elapsed while the game was actually running
Meant to exclude time spent paused or waiting for a multiplayer game to start.
const bool jjAllowsFireball JJ2+
Whether weapon 8 is the fireball instead of the pepper spray
Always false.
jjTILE@ jjAnimatedTiles[uint16] read-only JJ2+
The animated tiles of the level by their index
jjAnimatedTiles[i] is the same object as jjTiles[i | TILE::ANIMATED], but it can be changed. Returns null if the level has no such animated tile.
jjANIMATION@ jjAnimations[uint] read-only JJ2+
The animation at a global index
The animations of a set start at jjANIMSET::firstAnim.
jjANIMFRAME@ jjAnimFrames[uint] read-only JJ2+
The animation frame at a global index
Indices are the ones used by jjANIMATION::firstFrame and by the curFrame of objects and players.
const bool jjAutoWeaponChange JJ2+
Whether picking up ammo of a new weapon switches to it automatically
Always true.
int jjBorderHeight read-only JJ2+
The height of the black border on the top and bottom side of each subscreen
int jjBorderWidth read-only JJ2+
The width of the black border on the left and right side of each subscreen
The value is the size of one border, not of both together.
jjCHARACTER@ jjCharacters[CHAR::Char] read-only JJ2+
The profile of the given character
Indexed by CHAR::Char. Currently every character shares one placeholder profile whose changes have no effect.
const int jjColorDepth JJ2+
Color depth of the display in bits per pixel
Always 16, so scripts use their full-color code paths.
const jjCONTROLPOINT@ jjControlPoints[int] read-only JJ2+
Control points of Domination, ordered from top to bottom and then from left to right
There are always 16 of them, an unused one has an empty name, zero positions and TEAM::NEUTRAL.
const bool jjDeactivatingBecauseOfDeath JJ2+
Whether objects are being unloaded because the player died
Meant to tell apart the two reasons for STATE::DEACTIVATE: the player dying or the object being too far away.
bool jjDelayGeneratedCrateOrigins JJ2+
Whether crates made by a generator take their parameters from the tile where they land
Instead of the tile of the generator.
int jjDifficulty JJ2+
Current difficulty
0 for Easy, 1 for Normal and 2 for Hard. Assigning it also changes jjDifficultyNext.
int jjDifficultyNext JJ2+
Difficulty to use for the next level
Starts as the current difficulty. Values outside 0 to 2 keep the current difficulty.
const int jjDifficultyOrig JJ2+
Difficulty the level was started with
Unlike jjDifficulty, it doesn't change when a script assigns a new difficulty.
bool jjEnabledASFunctions[uint8] JJ2+
Whether each numbered onFunction# callback may be called by Text events
All entries start as true. When a Text event with the vanish option calls onFunction#, the entry with the same number becomes false and further Text events skip the callback until it is enabled again.
bool jjEnabledTeams[uint8] read-only JJ2+
Whether a team is enabled in the current game
Indexed by TEAM::Color.
LIGHT::Enforce jjEnforceLighting JJ2+
How much of the lighting players are allowed to turn off
Defaults to LIGHT::OPTIONAL. The value is only stored, the game has no option to turn lighting off, so it's always shown as with LIGHT::COMPLETE.
uint8 jjEventAtLastMaskedPixel read-only JJ2+
The event of the tile where a mask function last found a solid pixel
Updated whenever jjMaskedPixel(), jjMaskedHLine(), jjMaskedVLine() or jjMaskedTopVLine() find a solid pixel. Useful to let something pass through tiles with certain events, such as one-way platforms, hooks or vines.
const GAME::Connection jjGameConnection JJ2+
Whether players from other computers can join, and over which network
const GAME::Mode jjGameMode JJ2+
Base mode of the current game
Doesn't reflect a custom mode, see jjGameCustom for that. Team modes are built on GAME::CTF.
GAME::State jjGameState read-only JJ2+
The state of the multiplayer game
const int jjGameTicks JJ2+
Number of game ticks elapsed in the level
The game runs at 70 ticks per second. The counter never goes back, not even when a player dies and the level returns to a checkpoint.
string jjHelpStrings[uint] JJ2+
Text strings of the level, indexed from 0
Used by Text events and by bosses that display a message. Scripts may replace them; a new string is shown with the same formatting as the texts stored in the level.
const bool jjIsServer JJ2+
Whether this instance of the game hosts a multiplayer server
bool jjIsSnowing JJ2+
Whether a weather effect is active
Reflects the weather of the level, including changes made by weather events. Assigning it turns the effect on or off once the current script callback returns; jjSnowingType selects the kind of weather.
bool jjKey[uint8] read-only JJ2+
Whether a key or a mouse button is currently held down
Indexed by Windows virtual-key codes, e.g. 0x41 for A or 0x20 for Space. Codes 1, 2, 4, 5 and 6 are the left, right, middle and the two extra mouse buttons. Codes 0x10, 0x11 and 0x12 match Shift, Ctrl and Alt on either side. Keys without a counterpart are never reported as held.
bool jjLayerHasTiles[uint8] JJ2+
Whether the original layers are drawn, indexed by layer number from 1 to 8
A shortcut for jjLAYER::hasTiles of jjLayers[layer].
int jjLayerHeight[uint8] read-only JJ2+
The height of the original layers in tiles, indexed by layer number from 1 to 8
A shortcut for jjLAYER::height of jjLayers[layer].
bool jjLayerLimitVisibleRegion[uint8] JJ2+
Whether the original layers are shifted down depending on the resolution, indexed by layer number from 1 to 8
A shortcut for jjLAYER::limitVisibleRegion of jjLayers[layer].
jjLAYER@ jjLayers[int] read-only JJ2+
The layers of the level by their original number, from 1 to 8
jjLayers[4] is the sprite layer and jjLayers[8] the farthest background layer. The numbers always refer to the layers the level was made with, regardless of jjLayerOrderSet(). An index out of range gives an empty layer that isn't part of the level.
bool jjLayerTileHeight[uint8] JJ2+
Whether the original layers repeat vertically, indexed by layer number from 1 to 8
A shortcut for jjLAYER::tileHeight of jjLayers[layer].
bool jjLayerTileWidth[uint8] JJ2+
Whether the original layers repeat horizontally, indexed by layer number from 1 to 8
A shortcut for jjLAYER::tileWidth of jjLayers[layer].
int jjLayerWidth[uint8] read-only JJ2+
The width of the original layers in tiles, indexed by layer number from 1 to 8
A shortcut for jjLAYER::width of jjLayers[layer].
int jjLayerWidthReal[uint8] read-only JJ2+
The width of the original layers in tiles including widening for tiling, indexed by layer number from 1 to 8
A shortcut for jjLAYER::widthReal of jjLayers[layer], always equal to jjLayerWidth.
int jjLayerWidthRounded[uint8] read-only JJ2+
The width of the original layers in groups of four tiles, indexed by layer number from 1 to 8
A shortcut for jjLAYER::widthRounded of jjLayers[layer].
float jjLayerXAutoSpeed[uint8] JJ2+
The horizontal automatic scrolling speed of the original layers, indexed by layer number from 1 to 8
A shortcut for jjLAYER::xAutoSpeed of jjLayers[layer].
float jjLayerXOffset[uint8] JJ2+
The horizontal offset of the original layers in pixels, indexed by layer number from 1 to 8
A shortcut for jjLAYER::xOffset of jjLayers[layer].
float jjLayerXSpeed[uint8] JJ2+
The horizontal parallax speed of the original layers, indexed by layer number from 1 to 8
A shortcut for jjLAYER::xSpeed of jjLayers[layer].
float jjLayerYAutoSpeed[uint8] JJ2+
The vertical automatic scrolling speed of the original layers, indexed by layer number from 1 to 8
A shortcut for jjLAYER::yAutoSpeed of jjLayers[layer].
float jjLayerYOffset[uint8] JJ2+
The vertical offset of the original layers in pixels, indexed by layer number from 1 to 8
A shortcut for jjLAYER::yOffset of jjLayers[layer].
float jjLayerYSpeed[uint8] JJ2+
The vertical parallax speed of the original layers, indexed by layer number from 1 to 8
A shortcut for jjLAYER::ySpeed of jjLayers[layer].
string jjLevelFileName read-only JJ2+
The file name of the current level
Only the name with the .j2l extension appended, e.g. castle1.j2l, without any directories. This is the name the original file had, not the episode path the game uses internally.
string jjLevelName JJ2+
The title of the current level
The name shown to players, e.g. on the loading screen. Scripts may assign a new title.
const int jjLocalPlayerCount JJ2+
The number of local players
Currently the same as jjPlayerCount, every player in the level is local.
jjPLAYER@ jjLocalPlayers[uint8] read-only JJ2+
The local player with the given index
Currently the same as jjPlayers, every player in the level is local.
int jjMaxHealth read-only JJ2+
The highest health a player can have
Taken from the first player, 5 if there is no player yet.
int jjMouseX read-only JJ2+
The horizontal position of the mouse cursor
In pixels of the game view, measured from its left edge, so it stays consistent with drawing even when the window is scaled. Add jjPLAYER::cameraX to get a position in the level.
int jjMouseY read-only JJ2+
The vertical position of the mouse cursor
In pixels of the game view, measured from its top edge. Add jjPLAYER::cameraY to get a position in the level.
bool jjMusicActive read-only JJ2+
Whether music is enabled in the settings
false when its volume is set to 0.
string jjMusicFileName read-only JJ2+
File name of the music currently playing
To play a different track, use jjMusicLoad().
int jjMusicVolume read-only JJ2+
Volume of music set in the settings
From 0 to 100, including the master volume.
const int jjObjectCount JJ2+
One past the highest object ID in use
The end point for loops over jjObjects. Not the number of existing objects, since slots below it can be free.
jjOBJ@ jjObjectPresets[uint8] read-only JJ2+
The templates of new objects, indexed by event ID
Every object created from an event starts as a copy of its template, so changing a template (best done in onLevelLoad()) changes all objects of that event created afterward, including their jjOBJ::behavior.
jjOBJ@ jjObjects[int] read-only JJ2+
All objects of the level, indexed by object ID
Slots up to jjObjectCount may hold objects, check jjOBJ::isActive to skip the free ones.
jjPLAYER@ jjP read-only JJ2+
The current player
Always the first player. Prefer jjLocalPlayers or jjPlayers, which work with more than one player.
jjPAL jjPalette JJ2+
Palette the game currently draws with
jjPAL::apply() on any palette copies its colors here. Changes made to it directly also need apply() to take effect.
jjPLAYER@ jjPlayers[uint8] read-only JJ2+
The player with the given index
Never null, an index without a player returns a handle with jjPLAYER::isActive set to false.
const int jjRenderFrame JJ2+
Frame counter used to time drawing and automatic layer movement
Follows the same 70-per-second clock as jjGameTicks.
const int jjResolutionHeight JJ2+
Height of the game view in pixels
The size the game renders at, which may differ from the size of the window.
const int jjResolutionMaxHeight JJ2+
Largest height a subscreen may have in the current level
What a script set by the /maxresolution command of jjChat(), otherwise the same as jjSubscreenHeight. The view of the game doesn't change by it.
const int jjResolutionMaxWidth JJ2+
Largest width a subscreen may have in the current level
What a script set by the /maxresolution command of jjChat(), otherwise the same as jjSubscreenWidth. The view of the game doesn't change by it.
const int jjResolutionWidth JJ2+
Width of the game view in pixels
The size the game renders at, which may differ from the size of the window.
const int jjScriptModuleID JJ2+
Identifier of the script module that reads it
Meant to be passed to jjSendPacket() and jjPLAYER::hasPrivilege(). Always 0, there is only the level script.
const bool jjShowMaxHealth JJ2+
Whether missing health is shown as empty hearts in the HUD
Always false.
uint8 jjSnowingIntensity JJ2+
Intensity of the weather effect
Only matters while jjIsSnowing is true.
bool jjSoundEnabled read-only JJ2+
Whether the game produces any audio
false in a build without audio or when no audio is output (a dedicated server).
bool jjSoundFXActive read-only JJ2+
Whether sound effects are enabled in the settings
false when their volume is set to 0.
int jjSoundFXVolume read-only JJ2+
Volume of sound effects set in the settings
From 0 to 100, including the master volume.
int jjStartHealth read-only JJ2+
The health a player starts with
Players always start at full health, so this is the same value as jjMaxHealth.
const bool jjStrongPowerups JJ2+
Whether the server enabled stronger powered-up weapons
Always false.
const int jjSubscreenHeight JJ2+
Height of a player's subscreen in pixels
Equal to jjResolutionHeight with a single local player, smaller when the screen is split.
const int jjSubscreenWidth JJ2+
Width of a player's subscreen in pixels
Equal to jjResolutionWidth with a single local player, smaller when the screen is split.
bool jjSugarRushAllowed JJ2+
Whether players may get a sugar rush in this level
Used by multiplayer servers to detect cheating.
int jjTeamScore[TEAM::Color] read-only JJ2+
The current score of a team in team-based game modes
Indexed by TEAM::Color.
float jjTexturedBGFadePositionX JJ2+
The horizontal fade position of the textured background
A fraction of the view, 0.5 being the middle. A shortcut for the fade position of the textured background layer, see jjSetFadeColors() for which layer that is.
float jjTexturedBGFadePositionY JJ2+
The vertical fade position of the textured background
bool jjTexturedBGStars JJ2+
Whether the textured background shows stars
A shortcut for warpHorizon.stars of the textured background layer, see jjSetFadeColors() for which layer that is. The other styles use this value as their own parameter, see jjLAYER::warpHorizon.
TEXTURE::Style jjTexturedBGStyle JJ2+
The effect the textured background is drawn with
A shortcut for jjLAYER::textureStyle of the textured background layer, see jjSetFadeColors() for which layer that is.
TEXTURE::Texture jjTexturedBGTexture JJ2+
The texture of the textured background
A shortcut for jjLAYER::texture of the textured background layer, see jjSetFadeColors() for which layer that is.
bool jjTexturedBGUsed JJ2+
Whether jjLayers[8] is drawn textured
true if its jjLAYER::textureSurface is anything but SURFACE::UNTEXTURED. Setting true on an untextured layer changes it to SURFACE::LEGACY, setting false to SURFACE::UNTEXTURED.
const uint jjTileCount JJ2+
Number of static tiles currently available in the level
Doesn't count animated or flipped tiles. Grows when jjTilesFromTileset() adds tiles.
bool jjTileIs32Bit[uint16] read-only JJ2+
Whether a tile uses 32-bit colors, indexed by tile ID
false for tiles that use palette colors and for empty or undefined tiles.
const jjTILE@ jjTiles[uint16] read-only JJ2+
The tiles of the level by tile ID, read-only
Covers static tiles as well as animated ones, which are indexed with TILE::ANIMATED set. Flip bits of the ID are ignored. Returns null if the level has no such tile. To change an animated tile, use jjAnimatedTiles.
string jjTilesetFileName read-only JJ2+
The file name of the tile set used by the current level
If the level combines several tile sets, the first one is returned. Empty if the level has no tile map.
uint8 jjTileType[uint16] JJ2+
The type of a tile, indexed by tile ID
0 is an ordinary tile, 1 translucent, 3 invisible and 5 heat-distorted.
bool jjTriggers[uint8] JJ2+
State of the level triggers, indexed by trigger ID
The same triggers that Trigger Zone and Trigger Crate events turn on and off, so tiles tied to a trigger react to assignments too.
bool jjUseLayer8Speeds JJ2+
Whether the background layer moves by its own speeds
A shortcut for the speed models of jjLayers[8]: false keeps the layer fixed in the original way of layer 8, true makes it scroll by its own speeds like any other layer. Only a background layer that the level itself left fixed is affected.
bool jjVerticalSplitscreen JJ2+
Whether the screen is split vertically when there are exactly two local players
bool jjWarpsTransmuteCoins JJ2+
Whether a coin warp in single player turns the remaining coins into gems
true by default. Each coin gives a red gem and 100 points.
float jjWaterChangeSpeed JJ2+
Speed of the water surface after a non-instant jjSetWaterLevel()
In pixels per tick, 1 by default.
WATERINTERACTION::WaterInteraction jjWaterInteraction JJ2+
How local players move underwater
With WATERINTERACTION::LOWGRAVITY players don't swim, they walk and jump as on land and fall with the gravity of the water. The level starts with what its MLLE settings say.
int jjWaterLayer JJ2+
Layer the water is drawn in front of
1 by default. Any value outside 1 to 8 hides the water. This only affects drawing, players still swim in hidden water.
float jjWaterLevel read-only JJ2+
Current height of the water surface in pixels
Measured from the top of the level. Read-only, use jjSetWaterLevel() to change it.
WATERLIGHT::wl jjWaterLighting JJ2+
How ambient lighting behaves when the level has water
The level starts with what its MLLE settings say.
float jjWaterTarget read-only JJ2+
Height in pixels the water surface is moving towards
Differs from jjWaterLevel only while the water is still moving after a non-instant jjSetWaterLevel().
jjWEAPON@ jjWeapons[int] read-only JJ2+
The options of the given weapon
Indexed by a 1-based WEAPON::Weapon number. Other indices return a scratch object whose changes have no effect.
jjPLAYER@ p read-only JJ2+
Alias of jjP, the only global without the jj prefix
Always the first player. Prefer jjLocalPlayers or jjPlayers, which work with more than one player.
Hook documentation
bool onCheat(string&in cheat) JJ2+
Called when a player enters a cheat code in the console
| Parameters | |
|---|---|
| cheat | The code as it was entered, such as jjnxt |
| Returns | true if the script handled the code and the game shouldn't apply it, false to let the game apply it |
Called for every code starting with jj, also for codes the game doesn't know, so a script can add its own. Not called while cheats aren't allowed.
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Called when the HUD draws the weapon and ammo of a player
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas covering the view of the player |
| Returns | true if the script drew its own version and the game should skip the default one, false to draw the default one too |
Called every frame for the view of each player.
bool onDrawGameModeHUD(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Called when the HUD draws the information of the game mode of a multiplayer game
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas covering the view of the player |
| Returns | true if the script drew its own version and the game should skip the default one |
bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Called when the HUD draws the health of a player
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas covering the view of the player |
| Returns | true if the script drew its own version and the game should skip the default one, false to draw the default one too |
Called every frame for the view of each player, while the game would show the health.
void onDrawLayer1(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 1
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
There are eight of these hooks, onDrawLayer1() to onDrawLayer8(), one for each layer of the level. They're called every frame for the view of each player, from layer 8 at the back to layer 1 at the front. What a hook draws scrolls with its layer and appears in front of the tiles of the layer. At layer 4, the sprite layer, it stays behind the objects. The canvas only draws, nothing drawn becomes a part of the level.
void onDrawLayer2(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 2
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
See onDrawLayer1() for details.
void onDrawLayer3(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 3
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
See onDrawLayer1() for details.
void onDrawLayer4(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 4, the sprite layer
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
What's drawn here stays behind the objects of the level. See onDrawLayer1() for details.
void onDrawLayer5(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 5
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
See onDrawLayer1() for details.
void onDrawLayer6(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 6
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
See onDrawLayer1() for details.
void onDrawLayer7(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 7
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
See onDrawLayer1() for details.
void onDrawLayer8(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Draws into the level at layer 8, the background
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas placed at the layer for the view of the player |
See onDrawLayer1() for details.
bool onDrawLives(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Called when the HUD draws the lives of a player
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas covering the view of the player |
| Returns | true if the script drew its own version and the game should skip the default one, false to draw the default one too |
Called every frame for the view of each player.
bool onDrawPlayerTimer(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Called when the HUD draws the timer of a player
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas covering the view of the player |
| Returns | true if the script drew its own version and the game should skip the default one |
Called every frame for the view of each player while the timer started by jjPLAYER::timerStart() runs or is paused.
bool onDrawScore(jjPLAYER@ player, jjCANVAS@ canvas) JJ2+
Called when the HUD draws the score of a player
| Parameters | |
|---|---|
| player | The player whose view is drawn |
| canvas | Canvas covering the view of the player |
| Returns | true if the script drew its own version and the game should skip the default one, false to draw the default one too |
Called every frame for the view of each player.
void onFunction0(jjPLAYER@ player, uint8 param) JJ2+
Called by a Script Callback event of the level, numbered from 0 to 255
| Parameters | |
|---|---|
| player | The player who triggered the event |
| param | The Param value of the event |
The number in the name stands for the Function parameter of the event, so an event with number 7 calls onFunction7(). Text events of original levels with the AngelScript option enabled are converted to this event, their text number becomes the function number. Define only one function for each number.
Each parameter is optional, the following forms are accepted:
void onFunction7()void onFunction7(jjPLAYER@ player)void onFunction7(jjPLAYER@ player, bool param),uint8orint8in place ofboolvoid onFunction7(bool param),uint8orint8in place ofbool
A function that takes a player is called only when a player triggers the event. If the event has Vanish set, the function is disabled after its first call until it's enabled again by jjEnabledASFunctions or jjEnableEachASFunction(). It can still be called directly from the script.
void onLevelBegin() JJ2+
Called once when the level begins
Runs a little later than onLevelLoad(), once the game has created the objects around the starting positions of the players, so the script can change those objects too.
void onLevelLoad() JJ2+
Called once when the level is loaded
Runs after the global variables of the script are initialized, before the level starts and before the objects of the level are created. The place to set up the palette, layers, water or anything else the level should start with.
void onLevelReload() JJ2+
Called after the level returns to the last checkpoint
When a player dies and the level is rolled back to the last checkpoint, the objects created by scripts are removed and this hook is called afterwards. Use it to bring back anything of the script that should survive the death of the player.
void onMain() JJ2+
Called once in every game tick
The main update of a script, 70 times per second regardless of the frame rate of the game. Within a tick it runs after onPlayerInput() and before onPlayer().
void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) JJ2+
Called when an object with scripted collisions is hit
| Parameters | |
|---|---|
| obj | The object that was hit |
| bullet | The bullet that hit the object, null for a touch of a player |
| player | The player who touched the object or fired the bullet, may be null for a bullet |
| force | For a touch, 1 while the player attacks (a sugar rush or a special move) and 0 otherwise. For a bullet, the damage it deals. |
Only objects with jjOBJ::scriptedCollisions enabled are affected. If the class of the behavior of the object implements its own onObjectHit() method, that one decides first, and this global hook is called only if the object has no such method or the method returned false.
An object with HANDLING::PICKUP gets the call when a player touches it, the game never collects it on its own. An object with HANDLING::SPECIAL gets the call when a player touches it (at most once per tick) or a bullet hits it.
void onPlayer(jjPLAYER@ player) JJ2+
Called in every game tick for each player, after onMain()
| Parameters | |
|---|---|
| player | The player being updated |
The usual place for anything that concerns a single player, since the player is given directly and there's no need to go through jjLocalPlayers.
void onPlayerDraw(jjPLAYERDRAW& draw) JJ2+
Called in every game tick for each player to adjust how it is drawn
| Parameters | |
|---|---|
| draw | How the player is going to be drawn |
The jjPLAYERDRAW structure comes filled with how the game would draw the player. If the script changes the frame, offsets, scale, angle or sprite mode, the game draws that sprite in place of the player until the next tick. Turning off its sprite hides the player entirely. Runs after onPlayer().
void onPlayerInput(jjPLAYER@ player) JJ2+
Called in every game tick for each player, before onMain()
| Parameters | |
|---|---|
| player | The player being updated |
Meant for scripts that change what the player believes its controls are doing, such as swapping two keys. The key properties of jjPLAYER can be read and overwritten here before the tick uses them.
void onPlayerTimerEnd(jjPLAYER@ player) JJ2+
Called when the timer of a player runs out
| Parameters | |
|---|---|
| player | The player whose timer ran out |
This is the default function for a timer started by jjPLAYER::timerStart(). Another function can be chosen with jjPLAYER::timerFunction(). The parameter may be left out.