RPGCode Function Reference
[ Collapse All | Expand All ]
- a [ + ]
- b [ + ]
- c [ + ]
- d [ + ]
- e [ + ]
- f [ + ]
- g [ + ]
- h [ + ]
- i [ + ]
- k [ + ]
- l [ + ]
- m [ + ]
- n [ + ]
- o [ + ]
- p [ + ]
- r [ + ]
- s [ + ]
- save
- savescreen
- scan
- send
- setAmbientLevel
- setbutton
- setconstants
- setErrorHandler
- setImage
- setImageAdditive
- setImageTranslucent
- setImageTransparent
- setMwinTranslucency
- setPixel
- setResumeNextHandler
- setvolume
- shopcolors
- sin
- smartStep
- smp
- sound
- sourcehandle
- sourcelocation
- spliceVariables
- split
- spriteTranslucency
- sqrt
- stance
- start
- staticText
- t [ + ]
- u [ + ]
- v [ + ]
- w [ + ]
- z [ + ]
Variable types
- array — Array: a collection of variables using the same identifer [link]
array[0] = "first entry"; array[1] = "second entry"; split("split,by,commas",",",array); show(array[0]); // Shows "split"
- bool — Boolean: true or false
bVar = true; // Note: no quotes
- canvas — Canvas: the handle (pointer) to an off-screen bitmap. Must be generated with createCanvas() and freed using killCanvas()
cnv = createCanvas(640, 480); bitmap("image.jpg", cnv); drawCanvas(cnv, 0, 0); killCanvas(cnv);
- cursor_map — Cursor map: handle (pointer) to a cursor map object as created by createCursorMap() and destroyed using killCursorMap(). A cursor map consists of points on the screen at between which the cursor can be moved using the arrow keys
cmap = createCursorMap(); cursorMapAdd(320, 240, cmap); res = cursorMapRun(cmap); killCursorMap(cmap);
- double — Double: alias of int (floating point)
- handle — Handle: sprite or object handle (identifier). Possible values vary depending on context
// Item handles may be numerical (their index in the board item array) or, *in their multitasking program*, "source" or "target". itemDirection(3, tkDIR_W); itemPath("source", 0, 123, 456); // Player handles may be literal or numerical or "source" or "target" (in multitasking program). playerStance("bob", "attack");
- int — Numerical: integer or floatin point [link]
iVar = 12; iVar = 3.14;
- label — Label: a program line identifier. Used in conjunction with branch() to cause program execution to jump unconditionally to the point indicated by the label. Used in error handling in conjunction with setErrorHandler to execute code when an error occurs [link]
mwin("Line one"); branch(":skip"); mwin("Line two"); :skip mwin("Line three"); // Prints: // Line one // Line three
- string — Literal: any character (must be quoted) [link]
sVar = "RpgTK3.1.0";
- thread — Thread: a handle (pointer) to a thread, created with thread() and destroyed with killThread()
tid = thread("thread.prg", 0); killThread(tid);
- variant — Variant: may be numerical or literal (see handle)
- void — Void: the function does not return a value [link]
activePlayer
void activePlayer(variant handle)
handle activePlayer(void)
Set or get the active player, by handle.
[ top ]
addPlayer
void addPlayer(string file)
Add a player to the party.
[ top ]
ai
void ai(int level)
Have the source enemy use the internal AI.
[ top ]
animatedTiles
void animatedTiles()
Toggle animated tiles.
[ top ]
applyStatus
void applyStatus(string target, string file)
Apply a status effect to a fighter.
[ top ]
appPath
string appPath([string &dest])
Retrieve the path of trans3.exe, without the final backslash.
[ top ]
asc
int asc(string chr[, int &ret])
Get the ASCII value of a character.
[ top ]
attackAll
void attackAll(int fp)
Deal the specified amount in HP to all the members of the target's party.
[ top ]
autoCommand
void autoCommand()
Obsolete.
[ top ]
autoLocal
void autoLocal(bool bEnabled)
Set the default scope for variable resolution. When autolocal() is not enabled, variables are assumed to be global unless a local variable has been defined. When autolocal() is enabled, variabes are assumed to be local unless a global variable has been defined.
Note that if autolocal() is enabled and variables that are not global are referenced outside of any function, these variables are local to the program. When the program ends, they will be deleted.
[ top ]
battleSpeed
void battleSpeed(int speed)
Obsolete.
[ top ]
bitmap
void bitmap(string file, [canvas cnv])
Fill a surface with an image.
[ top ]
boardGetProgram
void boardGetProgram(int programIndex, string &program, int &pointCount, int &layer, bool &isClosed, int &attributes, int &distanceRepeat)
int boardGetProgram()
- Returns the properties of a given program.
- Returns the number of programs on the board.
[ top ]
boardGetProgramPoint
void boardGetProgramPoint(int programIndex, int pointIndex, int &x, int &y)
Get a single point on a board program. x, y are always pixel values.
[ top ]
boardGetVector
int boardGetVector()
void boardGetVector(variant vector, int &type, int &pointCount, int &layer, bool &isClosed, int &attributes)
- Returns the number of vectors on the board.
- Returns the properties of a given vector.
[ top ]
boardGetVectorPoint
void boardGetVectorPoint(variant vector, int pointIndex, int &x, int &y)
Get a single point on a board vector. x, y are always pixel values.
[ top ]
boardSetProgram
void boardSetProgram(int programIndex, string program, int pointCount, int layer, bool isClosed, int attributes, int distanceRepeat)
Sets the properties of a given program; creates a new program if one-past-the-end index is given. Use val = boardGetProgram() to get the next index. distanceRepeat in pixels always.
Possible flags: tkPRG_STEP, tkPRG_KEYPRESS, tkPRG_REPEAT, tkPRG_STOPS_MOVEMENT.
[ top ]
boardSetProgramPoint
void boardSetProgramPoint(int programIndex, int pointIndex, int x, int y)
Set/move a single point on a board program. x, y are always pixel values.
[ top ]
boardSetVector
void boardSetVector(variant vector, int type, int pointCount, int layer, bool isClosed, int attributes)
Sets the properties of a given vector. Creates a new vector if an existing one is not found - if a numeric variable is supplied, it will be set to the new index (one-past-end).
- Possible types are: tkVT_SOLID, tkVT_UNDER, tkVT_STAIRS, tkVT_WAYPOINT.
- Possible attributes: tkVT_BKGIMAGE, tkVT_ALL_LAYERS_BELOW, tkVT_FRAME_INTERSECT.
[ top ]
boardSetVectorPoint
void boardSetVectorPoint(variant vector, int pointIndex, int x, int y, bool apply)
Set/move a single point on a board vector. x, y are always pixel values. Set apply = true for last change, to improve speed.
[ top ]
bold
void bold(bool enable)
Toggle emboldening of text.
[ top ]
borderColor
void borderColor(int r, int g, int b)
Obsolete.
[ top ]
branch
void branch(label lbl)
Jump to a label.
[ top ]
callplayerswap
void callplayerswap(...)
Unimplemented in 3.1.0.
[ top ]
callshop
void callshop(string item1, string item2, string item3, ...)
Displays a basic shop interface that allows the buying of the items given as parameters and the selling of items in the player's inventory.
[ top ]
canvasDrawPart
void canvasDrawPart(int cnv, int x, int y, int xSrc, int ySrc, int width, int height[, canvas cnvDest])
Draw part of a canvas.
[ top ]
canvasGetScreen
void canvasGetScreen(canvas cnvDest)
Copy the screen onto a canvas.
[ top ]
castInt
int castInt(variant x, [int &ret])
Cast the specified value to an integer (i.e., a number in the sequence ...-2, -1, 0, 1, 2...). This is useful for removing fractional parts of numbers. Note that this function does not round.
[ top ]
castLit
string castLit(variant x, [string &ret])
Cast the specified value to a string. There is really no need to do this ever. RPGCode by itself will cast values passed to functions to the correct types as required.
[ top ]
castNum
double castNum(variant x, [double &ret])
Cast the specified value to a number (double). There is really no need to do this ever. RPGCode by itself will cast values passed to functions to the correct types as required.
[ top ]
change
void change(string program)
Change this program so that next time it is triggered, a different program runs instead. Change() is active only while the player remains on the board (i.e., leaving the board causes programs to return to normal).
[ top ]
characterSpeed
void characterSpeed()
Obsolete.
[ top ]
charAt
string charAt(string str, int pos, [string &ret])
Get a character from a string. The first character is one. The value of the pos parameter must be in the closed interval [1, length].
[ top ]
chr
string chr(int asc, [string &ret])
Get the character represented by the ASCII code passed in.
[ top ]
clear
void clear([canvas cnv])
Clear a surface. clear() blanks the screen. clear(cnv) blanks the canvas whose handle is 'cnv'.
[ top ]
clearBuffer
void clearBuffer()
Clear the keyboard buffer.
[ top ]
clearbuttons
void clearbuttons([int slot1, int slot2...])
Clear buttons set by SetButton(). Clear specific slot(s) if supplied, else clear all slots.
[ top ]
closeFile
void closeFile(string file)
Close a file.
[ top ]
color
void color(int dos)
Change to a DOS colour.
[ top ]
colorRgb
void colorRgb(int r, int g, int b)
Change the active colour to an RGB value.
[ top ]
cos
double cos(double x, [double &ret])
Calculate cosine x.
[ top ]
createCanvas
canvas createCanvas(int width, int height, [canvas &cnv])
Create a canvas.
[ top ]
createCursorMap
cursor_map createCursorMap([cursor_map &ret])
Create a cursor map.
[ top ]
createItem
int createItem(string filename[, int &pos])
Load an item and return the slot into which it was loaded.
[ top ]
cursorMapAdd
void cursorMapAdd(int x, int y, cursor_map map)
Add a point to a cursor map.
[ top ]
cursorMapHand
void cursorMapHand(string cursor[, bool stretch = true])
Change the cursor used everywhere cursors are used (e.g. cursor maps, the menu, the battle system), optionally not stretching it to 32 by 32 pixels.
The string "default" restores the default image.
[ top ]
cursorMapRun
int cursorMapRun(cursor_map map, [int &ret])
Run a cursor map.
[ top ]
debug
void debug(bool enable)
Toggle whether to show debug messages.
[ top ]
debugger
void debugger(string message)
Show a debug message.
[ top ]
delay
void delay(double time)
Delay for a certain number of seconds.
[ top ]
destroyitem
void destroyitem(variant handle)
Remove an item from memory. Warning: do not destroy an item through it's own multitasking thread.
[ top ]
destroyPlayer
void destroyPlayer(string handle)
Permanently remove a player from the party.
[ top ]
dirSav
string dirSav(string title, bool allowNewFile, int textColor, int backColor, string image)
Allow the user to choose a *.sav file from the "Saved" directory. For historical reasons, returns "CANCEL" if no file is chosen, not "".
[ top ]
done
void done()
End the program.
[ top ]
drainAll
void drainAll(int fp)
Deal the specified amount in SMP to all the members of the target's party.
[ top ]
drawCanvas
void drawCanvas(canvas cnv, int x, int y, [int width, int height, [canvas dest]])
Blit a canvas forward.
[ top ]
drawCanvasTransparent
void drawCanvasTransparent(canvas cnv, int x, int y, int r, int g, int b[, int width, int height[, canvas dest]])
Blit a canvas forward, but don't blit one colour (the transparent colour).
[ top ]
drawCircle
void DrawCircle(int x, int y, int radius [, int canvas])
Draw a circle at x,y, optionally to a canvas. Previously an arc could be defined but this never worked, so the two parameters have been cut and the optional canvas is now the fourth parameter.
[ top ]
drawEnemy
void drawEnemy(string file, int x, int y, [canvas cnv])
Draw an enemy.
[ top ]
drawLine
void drawLine(int x1, int y1, int x2, int y2, [canvas cnv])
Draw a line.
[ top ]
drawRect
void drawRect(int x1, int y1, int x2, int y2, [canvas cnv])
Draw a rectangle.
[ top ]
earthquake
void earthquake(int intensity)
Shake the screen.
[ top ]
empty
void empty()
Clear all globals.
[ top ]
end
void end()
End the program.
[ top ]
endAnimation
void endAnimation(int animationID)
End a multitasking animation.
[ top ]
equip
void equip(variant handle, int location, string item)
Equip an item from the inventory (by handle or filename) to a location on the player's body.
- 1 - Head
- 2 - Neck accessory
- 3 - Right hand
- 4 - Left hand
- 5 - Body
- 6 - Legs
- 7+ - Custom accessories
[ top ]
eraseitem
void eraseitem(variant handle)
Erase an item from the screen, but keep it in memory. Warning: erasing an item in it's own multitasking thread will pause the thread.
[ top ]
eraseplayer
void eraseplayer(string handle)
Erase a party player from the screen.
[ top ]
fade
void fade(int type)
Perform a fade using the current colour. There are several different types of fades.
- 0 - the screen is blotted out by a growing and shrinking box
- 2 - fades from white to black
- 3 - line sweeps across the screen
- 4 - black circle swallows the player
- 5 - image fade to black
[ top ]
fight
void fight(int skill, string background)
Start a skill level fight.
[ top ]
fightEnemy
void fightEnemy(string enemy, string enemy, ... string background)
Start a fight.
[ top ]
fightMenuGraphic
void fightMenuGraphic(string image)
Choose an image for the fight menu graphic.
[ top ]
fightStyle
void fightStyle()
Obsolete.
[ top ]
fileEof
bool fileEof(string file, [bool &ret])
Check whether the end of a file has been reached.
[ top ]
fileGet
string fileGet(string file, [string &ret])
Get a byte from a file.
[ top ]
fileInput
string fileInput(string file, [string &ret])
Read a line from a line.
[ top ]
filePrint
void filePrint(string file, string line)
Write a line to a file.
[ top ]
filePut
void filePut(string file, string byte)
Write a byte to a file.
[ top ]
fillCircle
void FillCircle(int x, int y, int radius [, int canvas])
Draw a filled circle at x, y, to screen or canvas.
[ top ]
fillRect
void fillRect(int x1, int y1, int x2, int y2, [canvas cnv])
Draw a filled rectangle.
[ top ]
font
void font(string font)
Load a true type font. TK2 fonts are not supported.
[ top ]
fontSize
void fontSize(int size)
Set the font size.
[ top ]
forceRedraw
void forceRedraw()
Force a redrawing of the screen.
[ top ]
gamespeed
void gamespeed(int speed)
Set the overall walking speed. Changes the walking speed proportionally. +ve values increase speed, -ve decrease, by a factor of 10% per increment. Allowed values range from -MAX_GAMESPEED to +MAX_GAMESPEED.
[ top ]
get
string get([string &ret])
Get a key from the queue.
[ top ]
getBoardName
string GetBoardName([string ret])
Get the current board's file name.
[ top ]
getBoardTile
string getBoardTile(int x, int y, int z, [string &ret])
Get the file name of the tile at x, y, z.
[ top ]
getBoardTileType
string getBoardTileType(int x, int y, int z[, string &ret])
Get the type of a tile.
[ top ]
getColor
void getColor(int &r, int &g, int &b)
Get the current colour.
[ top ]
getCorner
void getCorner(int &topX, int &topY)
Get the corner of the currently shown portion of the board.
[ top ]
getDp
int getDp(string handle, [int &ret])
Get a fighter's dp.
[ top ]
getFontSize
int getFontSize([int &ret])
Get the current font size.
[ top ]
getFp
int getFp(string handle, [int &ret])
Get a fighter's fp.
[ top ]
getGp
int getGp([int &ret])
Return the amount of gold pieces held.
[ top ]
getHp
int getHp(string handle, [int &ret])
Get a fighter's hp.
[ top ]
getItemCost
int getItemCost(string fileName[, int &ret])
Get an item's cost.
[ top ]
getItemDesc
string getItemDesc(string fileName[, string &ret])
Get an item's description.
[ top ]
getItemName
string getItemName(string fileName[, string &ret])
Get an item's handle.
[ top ]
getItemSellPrice
int getItemSellPrice(string fileName[, int &ret])
Get the price for which an item sells.
[ top ]
getLevel
int getLevel(string handle[, int &ret])
Get the level of a player.
[ top ]
getMaxHp
int getMaxHp(string handle, [int &ret])
Get a fighter's max hp.
[ top ]
getMaxSmp
int getMaxSmp(string handle, [int &ret])
Get a fighter's max smp.
[ top ]
getPixel
void getPixel(int x, int y, int &r, int &g, int &b, [canvas cnv])
Get the colour of the pixel at (x, y).
[ top ]
getRes
void getRes(int &x, int &y)
Get the screen's resolution.
[ top ]
getSmp
int getSmp(string handle, [int &ret])
Get a fighter's smp.
[ top ]
gettextheight
int gettextheight(string text)
Get the height of a string of text in pixels, relative to the current font and size.
[ top ]
gettextwidth
int gettextwidth(string text)
Get the width of a string of text in pixels, relative to the current font and size.
[ top ]
getThreadId
thread getThreadId([thread &ret])
Get the ID of this thread.
[ top ]
getTickCount
int getTickCount()
Get the number of milliseconds since Windows started.
[ top ]
giveExp
void giveExp(string handle, int amount)
Give experience to a player.
[ top ]
giveGp
void giveGp(int gp)
Give gold pieces.
[ top ]
giveHp
void giveHp(string handle, int add)
Increase a fighter's current hp.
[ top ]
giveItem
void giveItem(string itm)
Add an item to the inventory.
[ top ]
giveSmp
void giveSmp(string handle, int value)
Increase a fighter's smp.
[ top ]
goDos
void goDos(string command)
Obsolete.
[ top ]
gone
void gone()
Remove the currently running program from the board until the board has been left.
[ top ]
hp
void hp(string handle, int value)
Set a fighter's hp.
[ top ]
iif
void iif(condition, true, false)
Obsolete. Use the tertiary operator result = (expression ? true part : false part)
[ top ]
inn
void inn()
Fully heal the player party.
[ top ]
inStr
int inStr(string haystack, string needle[, int offset])
Returns the first occurence of needle within haystack, optionally starting from an offset. Both the return value and the offset are one-based.
[ top ]
internalMenu
void internalMenu(int menu)
Show a menu using the menu plugin.
- 0 - main menu
- 1 - item menu
- 2 - equip menu
- 4 (sic) - abilities menu
[ top ]
italics
void italics(bool enable)
Toggle italicizing of text.
[ top ]
itemCount
int itemCount(string fileName[, int &ret])
Count the number of a certain item in the inventory.
[ top ]
itemDirection
int itemDirection(variant handle)
void itemDirection(variant handle, int dir)
- Returns the item direction.
- Sets the item direction.
See playerDirection() for direction indices.
[ top ]
itemGetPath
int itemGetPath(variant handle)
void itemGetPath(variant handle, int index, int &x, int &y)
- Get the number of points in the sprite's path.
- Get the coordinates of a point in the sprite's path.
[ top ]
itemlocation
void itemlocation(variant handle, int &x, int &y, int &layer)
Get the location of an item.
[ top ]
itemPath
void itemPath(variant handle, int flags, int x1, int y1, ... , int xn, int yn)
void itemPath(variant handle, int flags | tkMV_PATHFIND, int x1, int y1)
void itemPath(variant handle, int flags | tkMV_WAYPOINT_PATH, variant boardpath, int cycles)
void itemPath(variant handle, int flags | tkMV_WAYPOINT_LINK, variant boardpath, int cycles)
Causes the sprite to walk a path between a given set of co-ordinates, depending on the flags parameter. 'handle' must be a board index value or 'target' or 'source', not the item's internal handle.
- Sprite walks the explicit path given by x1, y1 to xn, yn.
Required flag: none. - Sprite walks to x1, y1 via the shortest route (by pathfinding).
Required flag: tkMV_PATHFIND. - Sprite walks a board-set waypoint vector.
Required flag: tkMV_WAYPOINT_PATH.
The points of the vector are added to the sprite's queue. - A link is made between sprite and waypoint vector.
Required flag: tkMV_WAYPOINT_LINK.
Set cycles = 0 to walk infinitely.
Set boardpath = -1 to clear link to waypoint vector before cycles expires.
The sprite will resume the the path if other movement commands are given to it, after completion.
Possible flags for all options:
- tkMV_PAUSE_THREAD: Hold thread execution until movement ends.
- tkMV_CLEAR_QUEUE: Clear any previously queued movements.
[ top ]
itemspeed
void itemspeed(variant handle, int speed)
Set the delay in seconds between an item's steps.
[ top ]
itemstance
void itemstance(handle item, string stance [, int flags])
Animate an item's custom stance.
Possible flags tkMV_PAUSE_THREAD: Hold thread execution until animation ends.
[ top ]
itemstep
void itemstep(variant handle, int x, int y [, int flags])
Causes the item to take one step in the direction of x, y following a route determined by pathFind.
Possible flags
- tkMV_PAUSE_THREAD: Hold thread execution until movement ends.
- tkMV_CLEAR_QUEUE: Clear any previously queued movements.
[ top ]
itemWalkSpeed
void itemWalkSpeed()
Obsolete.
[ top ]
kill
void kill(variant &var, ...)
Delete variables.
[ top ]
killCanvas
void killCanvas(canvas cnv)
Kill a canvas.
[ top ]
killCursorMap
void killCursorMap(cursor_map map)
Kill a cursor map.
[ top ]
killThread
void killThread(thread id)
Kill a thread.
[ top ]
layerput
void layerput(int x, int y, int layer, string tile)
Place a tile on the board for the duration the player is on the board.
[ top ]
lcase
string lcase(string str, [string &ret])
Convert a string to lowercase.
[ top ]
left
string left(string str, int amount[, string &ret])
Get characters from the left of a string.
[ top ]
len
int len(string str[, int &ret])
Get the length of a string.
[ top ]
load
void load(string file)
Load the game state from a file.
[ top ]
log
double log(double x, [double &ret])
Returns n such that en = x.
[ top ]
mainFile
void mainFile(string gam)
Load a new main file.
[ top ]
maxHp
void maxHp(string handle, int value)
Set a fighter's max hp.
[ top ]
maxSmp
void maxSmp(string handle, int value)
Set a fighter's max smp.
[ top ]
mediaPlay
void mediaPlay(string file)
Play the specified file as the background music.
[ top ]
mediaStop
void mediaStop()
Stop the background music.
[ top ]
mem
void mem(int x, int y, int pos)
Lay a scanned tile on the screen at the specified position. @deprecated
[ top ]
menuGraphic
void menuGraphic(string image)
Choose an image for the menu.
[ top ]
mid
string mid(string str, int start, int length[, string &dest])
Obtain a substring. The offset is one-based.
[ top ]
mouseclick
void mouseclick(int &x, int &y [, bool noWait])
Wait for a mouseclick or immediately retrieve the last and return the x, y location (pixel values relative to the window).
[ top ]
mouseCursor
void mouseCursor(string file, int x, int y, int red, int green. int blue)
Change the mouse cursor. "TK DEFAULT" or "" restores the default cursor.
[ top ]
mousemove
void mousemove(int &x, int &y)
Wait for the mouse to move and return the x,y location in pixels from the window corner.
[ top ]
move
void move(int x, int y, [int z = 1])
Move this board program to a new location on the board. The effect lasts until the board has been left.
[ top ]
mp3pause
void mp3pause()
Play a sound effect and pause the engine until it finishes.
[ top ]
msgBox
int msgBox(string text [,string title [, int style [, int textColor [, int backColor [, string bitmap]]]]])
Display a message box containing one or two buttons, handled using a cursor map (keyboard input only). The background is drawn translucently using the MWin() translucency value. Any background image supplied is stretched to the size of the box.
- style = 0: 'OK' button; function returns 1.
- style = 1: 'Yes' and 'No' buttons: 'Yes' returns 6 and 'No' returns 7.
[ top ]
multirun
void multirun()
Multirun()'s behaviour depends on the program's context. In a thread: No action.
In a program (non-thread): All sprite movements called are queued up and movement begins after the closing brace of the function, thereby allowing simultaneous movement. Previously occurring movements are cleared.
[ top ]
mwin
void mwin(string str)
Show the message window.
[ top ]
mwinCls
void mwinCls()
Clear and hide the message window.
[ top ]
mwinsize
void mwinsize(int percent)
Obsolete.
[ top ]
newPlayer
void newPlayer(string file)
Change the graphics of the main player to that of the file passed in. The file must be a character file (*.tem)
[ top ]
onBoard
int onBoard(variant handle)
Return whether a player is being shown on the board.
[ top ]
openFileAppend
void openFileAppend(string file, string folder)
Open a file for appending.
[ top ]
openFileBinary
void openFileBinary(string file, string folder)
Obsolete.
[ top ]
openFileInput
void openFileInput(string file, string folder)
Open a file in input mode.
[ top ]
openFileOutput
void openFileOutput(string file, string folder)
Open a file in output mode.
[ top ]
over
void over()
Displays a game over message and resets the game. Because you can (and should) set a game over program, this function is pointless.
[ top ]
parallax
void parallax(int setting)
obsolete.
[ top ]
pixelMovement
bool pixelMovement([bool pixelMovement [, bool pixelPush]])
Toggles pixel movement and push() et al. in pixels. Returns whether pixel movement is being used. pixelPush is ineffective for tile movement.
[ top ]
pixelText
void pixelText(int x, int y, string str, [canvas cnv])
Displays text on the screen using pixel coordinates.
[ top ]
playAvi
void playAvi(string movie)
Play a movie full screen.
Supported types are *.avi, *.mpg, and *.mov.
[ top ]
playAviSmall
void playAviSmall(string movie)
Play a movie at actual size, centred. Supported types are *.avi, *.mpg, and *.mov.
[ top ]
playerDirection
int playerDirection(variant handle)
void playerDirection(variant handle, int dir)
- Returns the player direction.
- Sets the player direction.
Directions are assigned the following constants:
- East: tkDIR_E
- Southeast: tkDIR_SE
- South: tkDIR_S
- Southwest: tkDIR_SW
- West: tkDIR_W
- Northwest: tkDIR_NW
- North: tkDIR_N
- Northeast: tkDIR_NE
[ top ]
playerGetPath
int playerGetPath(variant handle)
void playerGetPath(variant handle, int index, int &x, int &y)
- Get the number of points in the sprite's path.
- Get the coordinates of a point in the sprite's path.
[ top ]
playerlocation
void playerlocation(variant handle, int &x, int &y, int &layer)
Get the location of a player.
[ top ]
playerPath
void playerPath(variant handle, int flags, int x1, int y1, ... , int xn, int yn)
void playerPath(variant handle, int flags | tkMV_PATHFIND, int x1, int y1)
void playerPath(variant handle, int flags | tkMV_WAYPOINT_PATH, variant boardpath, int cycles)
void playerPath(variant handle, int flags | tkMV_WAYPOINT_LINK, variant boardpath, int cycles)
Causes the sprite to walk a path between a given set of co-ordinates, depending on the flags parameter.
- Sprite walks the explicit path given by x1, y1 to xn, yn.
Required flag: none. - Sprite walks to x1, y1 via the shortest route (by pathfinding).
Required flag: tkMV_PATHFIND. - Sprite walks a board-set waypoint vector.
Required flag: tkMV_WAYPOINT_PATH.
The points of the vector are added to the sprite's queue. - A link is made between sprite and waypoint vector.
Required flag: tkMV_WAYPOINT_LINK.
Set cycles = 0 to walk infinitely.
Set boardpath = -1 to clear link to waypoint vector before cycles expires.
The sprite will resume the the path if other movement commands are given to it, after completion.
Possible flags for all options:
- tkMV_PAUSE_THREAD: Hold thread execution until movement ends.
- tkMV_CLEAR_QUEUE: Clear any previously queued movements.
[ top ]
playerspeed
void playerspeed(string handle, int speed)
Set the delay in seconds between a player's steps.
[ top ]
playerstance
void playerstance(handle player, string stance [, int flags])
Animate a player's custom stance.
Possible flags tkMV_PAUSE_THREAD: Hold thread execution until animation ends.
[ top ]
playerstep
void playerstep(variant handle, int x, int y [, int flags])
Causes the player to take one step in the direction of x, y following a route determined by pathFind.
Possible flags
- tkMV_PAUSE_THREAD: Hold thread execution until movement ends.
- tkMV_CLEAR_QUEUE: Clear any previously queued movements.
[ top ]
posture
void posture(int id [, handle player])
Show a custom player animation named "Custom" + str(id) (e.g. "Custom1") This command is obsolete - use playerStance() instead.
[ top ]
prg
void prg(string program. int x, int y, [int z = 1])
Move a program on the current board to a new location. This stays in effect until the board is left.
[ top ]
void print(string text)
Write the specified string one line down from the last call to text().
[ top ]
prompt
string prompt(string question, [string &ret])
Ask the player a question and return the result.
[ top ]
push
void push(string direction [, variant handle [, int flags]])
Push the player with the specified handle, or the default player if no handle is specified, along the given directions. The direction should be a comma delimited, but if it is not, it will be delimited for backward compatibility. These styles are accepted, and can be mixed even within the same directonal string:
- N, S, E, W, NE, NW, SE, SW
- NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST
- 1, 2, 3, 4, 5, 6, 7, 8
Possible flags
- tkMV_PAUSE_THREAD: Hold thread execution until movement ends.
- tkMV_CLEAR_QUEUE: Clear any previously queued movements.
[ top ]
pushItem
void pushItem(variant item, string direction [, int flags])
The first parameter accepts either a string that can be either "target" or "source" direction or the number of an item. The syntax of the directional string is the same as for [[push()]].
Possible flags
- tkMV_PAUSE_THREAD: Hold thread execution until movement ends.
- tkMV_CLEAR_QUEUE: Clear any previously queued movements.
[ top ]
put
void put(int x, int y, string tile)
Puts a tile at the specified location on the board. The tile persists only until the program ends. Use LayerPut() to place a tile for the duration the user is on the board. x and y are specified in tile coordinates.
[ top ]
putitem
void putitem(variant handle, int x, int y, int layer)
Place the item on the board at the given location.
[ top ]
putplayer
void putplayer(string handle, int x, int y, int layer)
Place the player on the board at the given location.
[ top ]
random
int random(int max, [int &ret])
Generate a random number from one to the supplied maximum, inclusive.
[ top ]
regExpReplace
string regExpReplace(string subject, string pattern, string replace)
Replace using a regular expression.
[ top ]
remove
void remove(variant handle, int location)
Remove an equipped item and return it to the inventory.
[ top ]
removePlayer
void removePlayer(string handle)
Remove a player from the party [to an old player list].
[ top ]
removeStatus
void removeStatus(string target, string file)
Remove a status effect from a fighter.
[ top ]
rendernow
void rendernow(bool draw)
Controls rendering of the cnvRenderNow reserved canvas. The canvas is drawn every frame above all board elements (e.g. tiles, sprites, animations). Access the canvas by passing 'cnvRenderNow' to the drawing functions. Do not call CreateCanvas() or KillCanvas() on cnvRenderNow.
[ top ]
replace
string replace(string str, string find, string replace[, string &dest])
Replace within a string.
[ top ]
reset
void reset()
Reset the game.
[ top ]
restorePlayer
void restorePlayer(string filename)
Restore a player who was previously on the team.
[ top ]
restorescreen
void restorescreen([int x1, int y1, int x2, int y2, int xdest, int ydest])
Draw a buffered screen capture to the screen. The canvas drawn is the first in the screen array. x1, x2 specify the bottom- right corner of the screen, so that width = x2 - x1, etc.
[ top ]
restorescreenarray
void restorescreenarray(int pos [,int x1, int y1, int x2, int y2, int xdest, int ydest])
Draw a buffered screen capture to the screen. x1, x2 specify the bottom-right corner of the screen, so that width = x2 - x1, etc.
[ top ]
resumeNext
void resumeNext()
Return to the statement after the statement where an error occurred.
[ top ]
right
string right(string str, int amount, [string &ret])
Get characters from the right of a string.
[ top ]
rpgCode
void rpgCode(string line)
Independently run a line of RPGCode.
[ top ]
run
void run(string program)
Transfer control to a different program.
[ top ]
save
void save(string file)
Save the current game state to a file.
[ top ]
savescreen
void savescreen([int position = 0])
Save the current screen onto a canvas that can be restored at a later time.
[ top ]
scan
void scan(int x, int y, int pos)
Save the tile specified to a buffer identified by pos. There is no particular number to pick for pos; any will do. @deprecated
[ top ]
send
void send(string file, int x, int y, [int z = 1])
Send the player to a new board.
[ top ]
setAmbientLevel
void setAmbientLevel(int red, int green, int blue)
Set the global ambient level. Valid values range from -255 to + 255.
[ top ]
setbutton
void setbutton(string file, int slot, int x, int y, int width, int height)
Create and draw a clickable button at screen pixel co-ords x, y that persists until clearButtons() is called.
[ top ]
setconstants
void setconstants(...)
Description.
[ top ]
setErrorHandler
void setErrorHandler(label lbl)
Set an error handler for the current function. This does not propagate up the call stack! Refer to the language features section of the manual for more information.
[ top ]
setImage
void setImage(string str, int x, int y, int width, int height, [canvas cnv])
Set an image.
[ top ]
setImageAdditive
void setImageAdditive(string file, int x, int y, int width, int height, double percent[, canvas cnv])
Set an image with a tint of the specified percent.
[ top ]
setImageTranslucent
void setImageTranslucent(string file, int x, int y, int width, int height, [canvas cnv])
Set an image translucently.
[ top ]
setImageTransparent
void setImageTransparent(string file, int x, int y, int width, int height, int r, int g, int b, [canvas cnv])
Set an image with a transparent colour.
[ top ]
setMwinTranslucency
void setMwinTranslucency(int percent)
Set the translucency of the message window.
0% is invisible; 100% is opaque.
[ top ]
setPixel
void setPixel(int x, int y, [canvas cnv])
Set a pixel in the current colour.
[ top ]
setResumeNextHandler
void setResumeNextHandler()
Cause errors in the current function to be silently ignored. This does not propagate up the call stack!
[ top ]
setvolume
void setvolume(int percent)
Set the volume of all music and sound using a value between 0 and 100.
[ top ]
shopcolors
void shopcolors(int index, int r, int g, int b)
Set the colors used in CallShop(). This function is obsolete from 3.1.0.
[ top ]
sin
double sin(double x, [double &ret])
Calculate sine x.
[ top ]
smartStep
void smartStep()
Toggle "smart" stepping.
[ top ]
smp
void smp(string handle, int value)
Set a fighter's smp.
[ top ]
sound
void sound()
Obsolete.
[ top ]
sourcehandle
string sourcehandle([string &ret])
Get the handle of the source object.
[ top ]
sourcelocation
void sourcelocation(int &x, int &y)
Get the location of the source object.
[ top ]
spliceVariables
string spliceVariables(string str)
Replaces substrings within angle brackets by the value of variables with respective names.
e.g. "<x>" would be replaced by the value of "x".
[ top ]
split
int split(string str, string delimiter, array arr)
Splits a string at a delimiter. Returns the number of upper bound of the array (i.e. the index of the last set element).
[ top ]
spriteTranslucency
void spriteTranslucency(int percent)
int spriteTranslucency(void)
Set the degree to which sprites drawn underneath other objects are visible. Specify a value between 0 (invisible) and 100 (opaque).
[ top ]
sqrt
double sqrt(double x, [double &ret])
Calculate the square root of x.
[ top ]
stance
void stance(int id [, handle player])
Show a player stance. This command is obsolete - use playerStance() instead.
[ top ]
start
void start(string file)
Open a file with the shell.
There is unfortunately no default directory for this function and assuming one will only break backward compatibility in some obscure manner.
Note also that previous incarnations prevented the launching of executables and shortcuts, but this is a nonsensical security measure when plugins no longer display a silly warning box, and this function can be trivially modified by someone who intends to be malicious.
[ top ]
staticText
void staticText()
obsolete.
[ top ]
takeGp
void takeGp(int gp)
Take gold pieces.
[ top ]
takeItem
void takeItem(string itm)
Remove an item from the inventory.
[ top ]
tan
double tan(double x, [double &ret])
Calculate tangent x.
[ top ]
targethandle
string targethandle([string &ret])
Get the handle of the target object.
[ top ]
targetlocation
void targetlocation(int &x, int &y)
Get the location of the target object.
[ top ]
tellThread
variant tellThread(thread id, string code)
Execute code in the context of a thread (e.g., to run a method located in another thread). TellThread() returns the value returned by the function called in the thread.
[ top ]
text
void text(double x, double y, string str, [canvas cnv])
Displays text on the screen.
[ top ]
textSpeed
void textSpeed(int speed)
Obsolete.
[ top ]
thread
thread thread(string file, bool persist, [thread &ret])
Start a thread.
[ top ]
threadSleep
void threadSleep(thread id, double seconds)
Put a thread to sleep.
[ top ]
threadSleepRemaining
double threadSleepRemaining(thread id, [double &ret])
Check how much sleep remains for a thread.
[ top ]
threadWake
void threadWake(thread id)
Wake up a thread.
[ top ]
tileType
void tileType(int x, int y, string type, [int z = 1])
Change a tile's type. Valid types for the string parameter are "NORMAL", "SOLID", "UNDER", "NS", "EW", "STAIRS#". Do not use when using vectors - use vector tools instead.
[ top ]
trim
string trim(string str, [string &ret])
Trim whitespace from a string.
[ top ]
ucase
string ucase(string str, [string &ret])
Convert a string to uppercase.
[ top ]
underArrow
void underArrow()
Toggle the under arrow.
[ top ]
underline
void underline(bool enable)
Toggle underlining of text.
[ top ]
viewbrd
void viewbrd(string filename [, int x, int y [, canvas cnv]])
Draw a board to the screen or to a canvas, starting at co-ordinates topX, topY.
[ top ]
wait
string wait([string &ret])
Wait for a key to be pressed, and return the key that was.
[ top ]
walkSpeed
void walkSpeed()
Obsolete.
[ top ]
wander
void wander(variant target, [int restrict = 0])
The first parameter accepts either a string that can be either "target" or "source" or the number of an item. The selected item will take a step in a random direction, or as restricted by the optional parameter. The allowed values for said parameter are:
- 0 - only north, south, east, and west on normal boards, only diagonals on isometric boards (default)
- 1 - only north, south, east, and west
- 2 - only diagonals
- 3 - all directions
[ top ]
wav
void wav(string file)
Play a wave file (e.g. a sound effect).
[ top ]
wavstop
void wavstop()
Stop the current sound effect.
[ top ]
win
void win()
Obsolete.
[ top ]
winColor
void winColor(int dos)
Set the message window's colour using a DOS code.
[ top ]
winColorRgb
void winColorRgb(int r, int g, int b)
Set the message window's colour.
[ top ]
windows
void windows()
Exit to windows.
[ top ]
winGraphic
void winGraphic(string file)
Set the message window background image.
[ top ]
wipe
void wipe(string file, int effect [, int speed])
Wipe' a graphic to the screen.
file: filename of the image to wipe to.
effect: numeric value between 1 and 12. The valid types are:
- 1 - Right
- 2 - Left
- 3 - Down
- 4 - Up
- 5 - NW to SE
- 6 - NE to SW
- 7 - SW to NE
- 8 - SE to NW
- 9 - Right 'zelda' style
- 10 - Left 'zelda' style
- 11 - Down 'zelda' style
- 12 - Up 'zelda' style
[ top ]
zoom
void zoom(int percent)
Zoom into the centre of the board by the specified percent.
[ top ]