RPGCode — Language Features — Reserved Constants
Contents
Reserved VariablesReserved Variables
There are a number of variables that the Toolkit automatically creates when you play your game. They are as follows:
playerHandle[x!]! — the handles of the players on your team that you specified in the character editor. x! is a value between 0 and 4. 0 being the first character on your team, 1 being the second, etc..
playerX[x!]! — the x! coordinate of the players on your team. x! is a value between 0 and 4.
playerY[x!]! — the y! coordinate of the players on your team. y! is a value between 0 and 4.
playerLayer[x!]! — the layer that your players are currently on. x! is a value between 0 and 4.
boardTitle[x!]$ — the titles of the 8 layers of a board. x! is a value between 1 and 8.
constant[x!]! — the 11 board constants set in the board editor. x! is a value between 0 and 10.
boardBackground$ — the fighting background of the current board.
boardSkill! — the fighting skill of the enemies on the current board.
threads[pos!]! — stores the ID's of the threads used on a board.
cnvRenderNow! — this is the ID of a canvas that can be constantly rendered to the screen using the RenderNow() command.
ambientRed!, ambientGreen!, ambientBlue! — the ambient colors of the boards in your game. You can adjust their values. Accepted values are from -255 to 255.
music$ — the filename of the music that is playing on the current board.
gametime! — the total game time in seconds.
You can't edit any of these variables except the ambient variables. You can, however, access these variables just like any other global variable. To update the reserved variables in a program, use the SetConstants() command.
Target and Source Handles:
There are two special handles named "Target" and "Source". These refer to the currently selected player, item or enemy. For example, if a program was being run from the internal menu and the user clicked on a player, you could get that player's HP by using:
GetHP("target", hp!)
In this case, instead of using the player's actual handle, "Target" produced the correct result. This can also be used to push the target item around to create walking villagers, etc. All commands that can use "Target" as their handle are explained in the Command Reference section.
"Source" is used in fights. Source refers to the player or enemy who is currently performing a battle move. Target is the player or enemy targeted by the move. Source can be used wherever Target is used.