tk3 (home, dev, source, bugs, help)

RPGCodeLanguage Features — Reserved Variables and Constants

Contents

Reserved variables Reserved constants

Reserved variables

There are a number of variables and constants that the RPGToolkit's engine automatically creates when you start your game which pertain to various things like players and boards. Each are accessible independently, though there are function alternatives to retrieving and setting some of them (the preferred way).

Players:

playerHandle[index] — returns the handles (names) of any player in your party. index is a value between 0 and 4 (0 is the first player, 1 is the second, et cetera).

playerX[index] — returns the x coordinate of any player in your party currently on the board. index is a value between 0 and 4. Alternatively, the playerLocation() function can be used to obtain this value and others.

playerY[index] — returns the y coordinate of any player in your party currently on the board. index is a value between 0 and 4. Alternatively, the playerLocation() function can be used to obtain this value and others.

playerLayer[index] — returns the layer of the board that the player is currently on. index is a value between 0 and 4. Alternatively, the playerLocation() function can be used to obtain this value and others.

Boards:

boardBackground — returns the fight background of the current board.

boardSkill — returns the fighting skill of the enemies on the current board.

boardTitle[index] — returns the titles assigned to the board layers. index is a value between 0 and the number of layers on the board.

constant[index] — returns the board constants. index is a value between 0 and the number of constants set for the board.

music — returns the filename of the music that is playing on the current board.

threads[index] — returns the handles of the threads on the board. index is a value between 0 and however many threads have been set.

Miscellaneous:

ambientRed, ambientGreen, ambientBlue — returns or sets the ambient RGB colors. The values can range from -255 to 255. Alternatively, the setAmbientLevel() function can be used to set these. If it is not used, you must call forceRedraw() before the ambient color changes take affect.

cnvRenderNow — returns the handle of a canvas which can be rendered on and off using the renderNow() function.

gameTime — returns the total game time in seconds.


Reserved constants

Flags:

tkDIR_N, tkDIR_S, tkDIR_E, tkDIR_W, tkDIR_NW, tkDIR_NE, tkDIR_SW, tkDIR_SE — Direction constants returned by the playerDirection() and itemDirection() functions.

tkMV_CLEAR_QUEUE — Used for clearing queued movements. See: playerStep(), itemStep(), push(), pushItem(), playerPath() or itemPath().

tkMV_PAUSE_THREAD — Used to pause thread execution until movement stops. See: playerStep(), itemStep(), push(), pushItem(), playerPath(), itemPath(), playerStance() or itemStance().

tkMV_PATHFIND — Used for pathfinding to a location. See: playerPath() or itemPath().

tkMV_WAYPOINT_PATH — Used to make a sprite walk along a waypoint path. See: playerPath() or itemPath().

tkMV_WAYPOINT_LINK — Used to link a sprite to a waypoint path. See: playerPath() or itemPath().

Target and source handles:

There are two special handles called "target" and "source", which refer to the currently selected player, item, or enemy. For example, in battle you may use the following code to show the HP of the target:

hp = getHp("target");
mwin(hp);
wait();
mwincls();

If this code was attached to a special move that the player used, "source" would refer to the player using it and "target" would refer to the enemy being hit by it. Many other functions accept "target" and "source" as the given handle.


previous, forward