TEMPORARY DOCUMENTATION

keyword:
keywords are words reserved by the engine so they cannot be used as function or variable names; keywords appear in bold in the IDE
function keywords:
desc: function keywords are variables that every function has which you can access for specific information or to tell the function to do a certain thing
arguments
desc: an object containing all the arguments passed into the function
override
desc: put at the top of an object function to make this function override all parent functions for the object
retVal
desc: a variable containing the information returned by the parent function call
operations:
spawn(milliseconds)
desc: all code indented under spawn is executed after specified amount of milliseconds
thread(milliseconds)
desc: all code indented under thread is executed in repetition for every milliseconds specified
objects:
desc: almost everything is an object; diobs (display objects) are special objects that have a location on the screen or map and a visual representation, with functions and variables to be used to manipulate those things and other data; basic objects are the most basic form and they are defined by using braces ( {} ), the structure of a basic object is the variable name, a colon, and then the variable value, and each variable is separated by a comma, for example {'var1': 1, 'var2': 2} would create an object with two variables called 'var1' and 'var2' with the values 1 and 2 respectively; all object variables can be accessed by either ( variable.value ) or ( variable['value'] )
functions:
desc: functions contain blocks of code which do various things when called; they can be called by using the name of the function followed by parentheses, for example someFunc() would call the function called someFunc; in order to call an object's function, the variable referencing the object would be put before the function, for example object.someFunc() would call the function someFunc belonging to the object in a variable called object; when calling an object's function, you can reference that object using the 'this' keyword inside the function; you can get an array containing the arguments of the function using the 'arguments' keyword; you can use 'call' and 'apply' to call any function with a different 'this' set, for example object.someFunc.call(otherObj, arg1, arg2) would call object.someFunc but the 'this' of the function would be 'otherObj' instead of 'object' and the arguments of the function would be arg1 and arg2; apply works the same way except the arguments are an array, for example object.someFunc.apply(otherObj, [arg1, arg2])
static objects:
desc: static objects are objects where only one of them exists and it always exists, you can use them to call functions to manipulate things as needed; current static objects (Math, Date, Icon, World, Util, Map, Event, Macro, Resource, Type)
global functions:
delDiob(pDiob)
pDiob: diob to delete
called: deletes the specified diob; the diob will become a blank object and no longer be used by the engine but any references to the object in the code will still exist; be sure to properly remove the diob from arrays or stop threads associated with them before deleting
newDiob(pType, pArg1, pArg2, ..., pArgn)
pType: string containing the type path for the object to be created
pArgn: parameters to pass as arguments to the diob's onNew event function
called: returns a new object of the type pType
World
variables:
gameWidth: width in pixels of the game screen
gameHeight: height in pixels of the game screen
tileSize: an object containing width and height of tiles on the map {'width': 32, 'height': 32}; acts as the default size of diobs
gameVersion: version of the game
mainMacro: string containing the name of the default macro atlas
mainMap: map to be loaded when the game starts
mainMob: string containing the path of the mob for the player to control
mainServer: a string containing the address of the server to automatically connect players to; example '127.0.0.1:1234'
playerMode: a number; 1 for single player game, 2 for multi-player game, 3 for single and multi-player
webAccessCode: alphanumeric string between 1 and 48 characters needed to list a server and use the api for the game
preloadResources: array of files to preload when the game starts up or '*' to load all resources; if no name is provided, all resources of that type will be preloaded; for example [{'type': 'icon', 'name': 'icon1'}, {'type': 'sound'}] to load an icon named icon1 and all sound resources; all interface files and macro files are automatically preloaded
event functions:
onNew()
called: when the engine has fully intialized the game
onMessage(pMes, pFrom)
pMes: string containing the message received
pFrom: address of the sender
called: called when another game server or client sends a message to the server; server-only
static functions:
getGameSize()
called: returns an object {'width': world.gameWidth, 'height': world.gameHeight} containing the width and height of the game
getGameVersion()
called: returns a string containing the game version
getPlayerMode()
called: returns a number containing the game's player mode
getHostAddress()
called: returns a string containing the address of the server or client; for example '1.2.3.4:1234' for server and 'localhost' always for client
getCodeType()
called: returns a string containing information about what the code type is; code ran in solo will return 'local'; code ran in multi-player client will return 'client'; code ran on the server will return 'server'
getClients()
called: returns an array of all connected clients
getServers(pFunc)
pFunc: function to call after the servers have been retrieved
called: passes an array of objects containing information about the game servers currently online; example {'name': 'Server 1', 'address': '127.0.0.1:1234', 'players': 12, 'guests': 2} would be the data for a server named Server 1 with 12 players and 2 guests on it at 127.0.0.1:1234 address to pFunc
getWebContent(pLink, pFunc)
pLink: string containing the link to read; for example 'http://vylocity.com/'
pFunc: function to call after the content has been retrieved
called: goes to pLink and passes the content of the page to pFunc once it is finished
sendMessage(pAddress, pMes)
pAddress: address of the server to send a message to
pMes: string contining the message to send
called: sends a string message pMes to another server located at pAddress
sendNotification(pName, pMessage, pFunc)
pName: name of the Vyocity account to send notification to
pMessage: message to send; 256 characters max
pFunc: function to call after the notification has been sent or attempted; function is called with up to two parameters where the first is true or false depending on the success of the send and the second is a string containing an error message if there was one
called: sends a notification with the message pMessage to the Vylocity account pName and then calls pFunc; server-side only
getTileSize()
called: returns an object {'width': world.tileWidth, 'height': world.tileHeight} containing the width and height of the game tiles
kickClient(pClient, pReason)
pClient: client to kick pReason: optional; message to display to the client being kicked
called: kicks the client pClient and displays the pReason message to them if there is one
outputText(pText, pDisplay)
pText: text to be displayed
pDisplay: interface element to output text to
called: outputs text to an interface element for all clients; if pDisplay is not set or is invalid, text goes to client.mainOutput
playSound(pSound, pArr)
pSound: either a string with the name of a sound file, or a string containing the path of a Sound object, or an actual Sound object, or a basic object with the proper information; ex ( {'soundName': 'name', 'volume': 50} )
pArr: optional list of objects to play sound to
called: plays a sound to all objects in pArr
log(pMes)
pMes: message to display
called: displays pMes to the console
getDiobs(pType, pChild)
pType: optional; string containing type path to return
pChild: optional; boolean that determines if child types are included
called: returns an array of diobs in the world depending on the provided arguments; if pType is not set, all diobs in the game will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
getDiobByID(pID)
pID: id of the diob to get
called: returns the diob with the specified ID
getDiobsFromArray(pArr, pType, pChild)
pArr: array to check for diobs in
pType: optional; string containing type path to return
pChild: optional; boolean that determines if child types are included
called: returns an array of diobs that are in pArr depending on the provided arguments; if pType is not set, all diobs in the game will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
openWebSocket(pAddress, pFunc, pSettings)
pAddress: address of server to open a socket to; example '127.0.0.1:1234'
pFunc: function to call once the socket has been opened; an object holding the socket information is passed into pFunc
pSettings: object containing settings values; example: {'secure': true}
{
secure: set to true to use https
}
called: opens a socket to a server which can then be communicated with; the socket object that is created can be used to send and read socket events
socket events:
addEvent(pName, pFunc)
pName: name of the event to add
pFunc: function to call when this event is ran
called: adds a new event to this socket object which is called when the server sends an event named pName
onConnect()
called: when the socket has connected to the server, set to a function manually
onDisconnect()
called: when the socket has disconnected from the server; set to a function manually
onError(pErr)
pErr: error information
called: when the socket has failed to connect, set to a function manually
send(pName, pData)
pName: name of the event to send
pData: object containing the data to send; exmaple {'test': 'val', 'test2': 1}
called: sends the socket event named pName with the data pData to the server
close()
called: closes the socket connection
hostWebSocket(pPort, pFunc)
pPort: the port to listen for sockets on
pFunc: the function to call once the host socket has started
called: open the port pPort and listen for socket events; the host socket object that is created can be used to send and read socket event
socket events:
addEvent(pName, pFunc)
pName: name of the event to add
pFunc: function to call when this event is ran
called: adds a new event to this host socket object which is called when a client sends an event named pName to the server
onConnect()
called: when the host socket has started listening for connections; set to a function manually
onDisconnect()
called: when the host socket is no longer listening for connections; set to a function manually
onConnection(pClient)
pClient: the socket client object connected to the host socket
called: when a client connects to the host socket
onDisconnection(pClient)
pClient: the socket client object disconnected from the host socket
called: when a client disconnects from the host socket
send(pName, pData)
pName: name of the event to send
pData: object containing the data to send; exmaple {'test': 'val', 'test2': 1}
called: sends the socket event named pName with the data pData to all socket clients connected to this host socket
clientSend(pClient, pName, pData)
pClient: socket client object to send socket event to
pName: name of the event to send
pData: object containing the data to send; exmaple {'test': 'val', 'test2': 1}
called: sends the socket event named pName with the data pData to the socket client pClient
clientClose(pClient)
pClient: socket client object to close
called: closes the socket client pClient's connection
getClients()
called: returns an array of all the socket client objects
close()
called: closes the host socket
Diob
variables:
name: name of object
type: name of the type of the object
baseType: name of the lowest level parent type
width: width of the collision box of the object
height: height of the collision box of the object
layer: order of display of the diob; higher layer objects appear above lower layer objects
plane: order of display of the diob; diobs with the same plane appear together with layers determining the order; a diob with a plane of 1 and layer 1000 will appear below a diob with plane 2
density: determines if the object is dense or not
loc: the tile that the diob is on
xCoord: position of object on the grid x-axis
yCoord: position of object on the grid y-axis
xCoordOffset: how many pixels object is offset on the grid x-axis from the xCoord
yCoordOffset: how many pixels object is offset on the grid y-axis from its yCoord
xPos: position on the x-axis from left to right of the map
yPos: position on the y-axis from top to bottom of the map
mapName: name of the map
atlasName: name of atlas the object's icon is in
iconName: name of icon inside object's icon atlas
xIconOffset: x-axis offset of the icon
yIconOffset: y-axis offset of the icon
iconState: state of the icon
angle: angle of the diob (0 to 2PI)
preventClientUpdates: server-only; if set, the server will not update clients when changes are made
scale: 0 for no scale or an object {'width': 2, 'height': 2, 'type': 'normal'} containing the information for the scale
transform: the diob's transformation matrix or transformation object; example [scaleX, skewY, 0, skewX, scaleY, 0, moveX, moveY, 1] where scaleX scales the diob's appearance on the x-axis, skewY skews on the y-axis, moveX moves on the x-axis, skewX skews on the x-axis, scaleY scales on the y-axis, moveY moves on the y-axis, and the last three are static for matrix; example {'scaleX': 2, 'skewY': 0.1} would scale by 2 on the x-axis and skew by 0.1 on the y-axis for object
alpha: how visible the diob appears; (0 to 1); 0 completely invisible, 1 completely visible, between partially visible, higher the number the more visible
animator: an object {'speed': 2, 'reverse': true} containing information about how this diob's icon is animated
color: hex, rgb, rgba, or color matrix value; applies color filter to diob; ex ( '#000' ); ex ( 'rgb(10, 20, 30)' )
ex (
[-1, 0, 0, 0, 1,
0, -1, 0, 0, 1,
0, 0, -1, 0, 1,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
]
)
composite: string containing composite value that determines how this diob is drawn with other diobs on the same plane; possible values: source-over, source-atop, source-in, source-out, destination-over, destination-atop, destination-in, destination-out, lighter, copy, xor, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity
invisibility: if set, diob will be invisible to all other diobs with visibility less than this value
visibility: all invisible diobs with invisibility levels equal to or less than this will be visible to this diob
mouseOpacity: determines if the cursor executes mouse events on this object or not
text: a string to be displayed as text above the diob
textStyle: a JSON object containing styles for the text (ex: {"padding": 0, "color": "#000", "lineSpace": 0} )
{
font: default font to be used for text displays
fontSize: default size of font in pixels
baseline: where vertically to start drawing the characters on the line; top/alphabetic/hanging/middle/ideographic/bottom
color: default color of text for this element
padding: padding between the edge of the element and the text
hPadding: padding on left and right sides; overrides padding
vPadding: padding on top and bottom; overrides padding
lineSpace: default spacing between each line of text
bitmap: name of the icon atlas to use as a bitmap font
bitMask: true to turn bitmap text into appearMask icons, the text will apply its parent's appearance properties
charSpace: default spacing between each character; bitmaps only
}
event functions:
onBumped(pMovable)
pMovable: movable that did the bumping
called: when a movable bumps into this diob
onEntered(pDiob)
pDiob: object that entered
called: when an object enters the contents of another object
onExited(pDiob)
pDiob: object that exited
called: when an object exits the contents of another object
onMouseClick(pClient, pX, pY, pButton)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when the mouse clicks this object
onMouseDblClick(pClient, pX, pY, pButton)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
pButton: the button used; 1 for left, 2 for middle
called: called when the mouse double clicks this object
onMouseEnter(pClient, pX, pY)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
called: called when the mouse enters this object
onMouseExit(pClient, pX, pY)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
called: called when the mouse exits this object
onMouseMove(pClient, pX, pY)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
called: called when the mouse moves after entering this object
onMouseDown(pClient, pX, pY, pButton)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when a mouse button has been pressed while over this object
onMouseUp(pClient, pX, pY, pButton)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when a mouse button is released while over this object
onMouseWheelScrollUp(pClient, pX, pY)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
called: called when a mouse wheel button is scrolled upward while over this object
onMouseWheelScrollDown(pClient, pX, pY)
pClient: client of the mouse
pX: the x position of the mouse over the diob
pY: the y position of the mouse over the diob
called: called when a mouse wheel button is scrolled downward while over this object
onNew(pArg1, pArg2, ..., pArgn)
pArgn: arguments passed into the function
called: called after this object has been created
onDel(pArg1, pArg2, ..., pArgn)
pArgn: arguments passed into the function
called: called before this object has been deleted
onScreenShow()
CLIENT ONLY
called: when this diob enters the client's screen view
onScreenHide()
CLIENT ONLY
called: when this diob leaves the client's screen view
onScreenRelocated(pClient)
CLIENT ONLY
pClient: a reference to the client
called: when this diob changes position while in client's screen view
functions:
getID()
called: returns the value of the unique ID given to the diob when it was created
getType()
called: returns the type of the object
getBaseType()
called: returns the base type of the object, for example an object with the type 'Mob/Player' will return 'Mob'
setName(pName)
pName: new name to give the diob
called: sets the name of the diob to pName
getName()
called: returns the name of this diob
getLayer()
called: returns the layer of this diob
setLayer(pLayer)
pLayer: value to set this diob's layer to
called: sets this diob's layer to pLayer
getPlane()
called: returns the plane of this diob
setPlane(pPlane)
pLayer: value to set this diob's plane to
called: sets this diob's plane to pPlane
getAngle()
called: returns the angle of this diob
setAngle(pAngle)
pAngle: number between 0 and 2PI radians
called: sets this diob's angle to pAngle
getAlpha()
called: returns the alpha value of this diob
setAlpha(pAlpha)
pAngle: number between 0 and 1
called: sets this diob's alpha to pAlpha; alpha of 0 makes the diob completely invisible, 1 makes it completely visible, anything between makes it partially visible, the higher the number the more visible the appearance of the diob is
getScale()
called: returns 0 for no scale or an object {'width': width, 'height': height, 'type': type} containing the information on the scale
setScale(pWidth, pHeight, pType)
pWidth: number to scale the width of the diob by; for example 2 would be a 200% scale
pHeight: optional; number to scale the height of the diob by; for example 2 would be a 200% scale; pWidth used if null
pType: optional; default 'smooth'; type to use; 'normal' or null for normal and 'smooth' for smooth, which blends pixels together as needed
called: sets the scale of the diob
getTransform(pAsObj)
pAsObj: optional; if set, the diob's transformation matrix will be returned as an object, for example {'scaleX': scaleX, 'skewY': skewY}
called: returns the transformation matrix of this diob
setTransform(pTransform)
pMatrix: an affine transformation matrix or object containing the details of the transform to perform
called: sets this diob's transformation matrix to pMatrix; example [scaleX, skewY, 0, skewX, scaleY, 0, moveX, moveY, 1] where scaleX scales the diob's appearance on the x-axis, skewY skews on the y-axis, moveX moves on the x-axis, skewX skews on the x-axis, scaleY scales on the y-axis, moveY moves on the y-axis, and the last three are static; if you do not know affine transformation maxtrices, you can also pass an object in with proper values to use, for example {'scaleX': 2, 'skewY': 0.1} would scale by 2 on the x-axis and skew by 0.1 on the y-axis
getAnimator()
called: returns the animator value of this diob
setAnimator(pAnimator)
pAnimator: object containing the animator settings; ex {'speed': 2, 'reverse': true}
called: sets this diob's animator object to pAnimator; speed above 1 will reduce the delay of the frames this diob uses for its icon and a speed below 0 will increase the delay
setColor(pColor)
pColor: hex, rgb, rgba, or color matrix value; applies color filter to the diob; ex ( '#000' ); ex ( 'rgb(10, 20, 30)' )
ex (
[-1, 0, 0, 0, 1,
0, -1, 0, 0, 1,
0, 0, -1, 0, 1,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
]
)
called: sets this diob's color to pColor
setAppearance(pDiob)
pDiob: object containing the appearance information or a diob itself; values used: atlasName, iconName, iconState, width, height, layer, scale, color, alpha, transform, angle, composite, plane, text, textStyle, animator, overlays, overScreen
called: changes the appearance of the diob based on the values provided by pDiob
getComposite()
called: returns the composite value of this diob
setComposite(pComposite)
pComposite: string containing type of composite; possible values: source-over, source-atop, source-in, source-out, destination-over, destination-atop, destination-in, destination-out, lighter, copy, xor, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity
called: sets this diob's composite value which determines how the diob is drawn along with other diobs on the same plane
setSize(pWidth, pHeight)
pWidth: value to set the diob's width to
pHeight: value to set the diob's height to
called: sets the width and height of the diob
getSize()
called: returns an object {'width': width, 'height': height} containing the diob's width and height
getPos()
called: returns an object {'x': x, 'y': y} containing the x and y positions of the diob on the map
getLoc()
called: returns the location of the object; if object is a tile, it returns itself
getMapName()
called: returns the name of the map the diob is on
getCoords()
called: returns the coords of the diob with an object {'x': x, 'y': y}
addOverlay(pOver, pAppearance)
pOver: string of the type of object or overlay to add an overlay of or actual diob to get type from
pAppearance: optional; if true, this overlay will be be treated as if it is part of the the parent's actual appearance - appearance settings such as angle and alpha of the parent will be used for this overlay and the overlay will be drawn directly on top of the parent so no other diobs that are not an overlay of the parent can appear between it and the parent (it will basically be an extension of the parent's icon); if this is false, the overlay will be treated as an independent diob that just follows the parent around
called: adds an overlay to the object which is a visual icon that always follows the object; returns the new overlay
removeOverlay(pOver)
pOver: string of the type of object or overlay to remove or actual overlay to remove
called: removes all overlays with the pOver type or the exact overlay matching pOver
getOverlays()
called: returns an array of the diob's overlays
setOverlays(pOver)
pOver: array of overlays to set this diob's overlays to
called: sets the diob's overlays to the array pOver
getContents(pType, pChild)
pType: optional; string containing type path to return
pChild: optional; boolean that determines if child types are included
called: returns an array of diobs in the diob's contents using the provided arguments; if pType is not set, all diobs in the diob's contents will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
getCrossed(pType, pChild)
pType: optional; string containing type path to return
pChild: optional; boolean that determines if child types are included
called: returns an array of diobs that are crossing this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
setIconOffsets(pX, pY)
pX: the x offset of the icon of this object
pY: the y offset of the icon of this object
called: sets the x and y icon offsets
getIconOffsets()
called: returns an object {'x': x,'y': y} containing the x and y icon offsets
setIcon(pAtlas, pIcon)
pAtlas: name of atlas icon is in
pIcon: name of icon in pAtlas
called: changes display icon of object
getIcon()
called: returns an object {'atlas': atlasName, 'icon': iconName} containing the diob's icon atlas and icon names
setIconState(pState, pFrame)
pState: state of the icon to set
pFrame: optional; if true, animation will start from the frame the last iconState left off on
called: sets the icon state of the diob's icon
getIconState()
called: returns the icon state of the diob's icon as a string
playAnimation(pAtlas, pIcon, pState, pFrame)
pAtlas: atlas of the icon for the animation
pIcon: optional; icon name of the icon for the animation
pState: optional; state of the icon for the animation
pFrame: optional; frame number to start the animation at; default 1
called: sets the diob's icon and then plays the animation for that icon, returning to the old icon when the animation has ended; setting the diob's icon manually will cancel this
getAnimation()
CLIENT ONLY
called: returns an object containing the information for the diob's current animation; current variables, onFrame for the current frame the animation is on, frameCount for total number of frames in the animation; example {'onFrame': 1, 'frameCount' 20}
setText(pText)
pText: string containing text to use
called: displays pText over the diob, overriding the current text
getText()
called: returns the current text of the diob
setTextStyle(pStyle)
pStyle: style object; ex: {"padding": 0, "color": "#000", "lineSpace": 0}
called: sets text style of diob's text to pStyle
getTextStyle()
called: returns the current text style of the diob
setInvisibility(pLevel)
pLevel: the level of invisibility to give the diob
called: sets the diob's invisibility level, making it invisible to any diobs with a lower 'visibility' level; 0 or null to make fully visible again
getInvisibility()
called: returns the diob's invisibility level
setVisibility(pLevel)
pLevel: the level of visibility to give the diob
called: sets the diob's visibility level, making it able to see diobs with equal or lower 'invisibility' levels
getVisibility()
called: returns the diob's visibility level
addInvisibilityViewer(pDiob)
pDiob: the diob to add
called: adds pDiob to this diob's viewer array, allowing pDiob to always see this diob
removeInvisibilityViewer(pDiob)
pDiob: the diob to remove
called: removed pDiob from this diob's viewer array
getInvisibilityViewers()
called: returns an array of diobs currently in this diob's viewer array
setOverScreen(pX, pY, pWidth, pHeight, pData, pSet)
CLIENT ONLY
pX: x offset of display
pY: y offset of display
pWidth: width of display
pHeight: height of display
pData: optional; data to add to the screen
pSet: optional; settings object; ex ( {'scaleNearest': true} );
{
'scaleNearest': true to prevent pixels from being blended together, false to smooth pixels
}
called: changes the over screen information; adding data optional
getOverScreen(pType)
CLIENT ONLY
pType: type of data to get; 'url' or 'pixels'
called: grabs an object with the screen x offset, y offset, width, height, settings, and either an array of pixel data or a data url depending on pType. The data can then be changed and used elsewhere or drawn onto another screen. To read the width and height you could use object.width and object.height, where object is the object returned by the function. The object data array is as follows: object.data[0] is the red value (0-255) of the pixel at 0,0, object.data[1] is the green value (0-255) of the pixel at 0,0, object.data[2] is the blue value (0-255) of the pixel at 0,0, and object.data[3] is the alpha value (0-255) of the pixel at 0,0. Then object.data[4], object.data[5], object.data[6], and object.data[7] are the respective values for the pixel at 1,0. This trend continues through the whole array for every pixel. object ex: {'x': 0, 'y': 0, 'width': 100, 'height': 100, 'data': ''}
overScreenDraw(pArgs)
CLIENT ONLY
pArgs: an object or array of objects which determines the settings of the draw
{
'type': type of draw
{
'image': draw an image
'image': either a path to an image or a diob, in which case the diob's icon will be used
'x': x position to draw the image
'y': y position to draw the image
'width': width of the image when drawn
'height': height of the image when drawn
'clipX': optional; x value inside of the image to start clipping
'clipY': optional; y value inside of the image to start clipping
'clipW': optional; width of the area to clip
'clipH': optional; height of the area to clip
'text': draw text
'text': text to draw
'color': color of the text; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'x': x position to draw the text
'y': y position to draw the text
'font': font size and type to use; ex ( '12px monospace' )
'maxWidth': max width to draw the text (shrink the text if it wont fit)
'fillRect': draw a filled in rectangle
'color': color of the rect; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'x': x position to start the rect
'y': y position to start the rect
'width': width of the rect
'height': height of the rect
'strokeRect': draw an unfilled rectangle
'color': color of the rect; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'x': x position to start the rect
'y': y position to start the rect
'width': width of the rect
'height': height of the rect
'clearRect': clear a rectangular area on the screen
'x': x position to start the area to clear
'y': y position to start the area to clear
'width': width of the area to clear
'height': height of the area to clear
'fillPath': create a path and fill it in (shapes)
'color': color to fill; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'path': array of path objects
{
'type': type of path object
'move': move path cursor
'line': draw path line from current cursor to new position
'x': x position
'y': y position
}
'strokePath': create a path of lines
'color': color to stroke; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'path': array of path objects
{
'type': type of path object
'move': move path cursor
'line': draw path line from current cursor to new position
'x': x position
'y': y position
}
}
'angle': angle of the draw; 0 to 2PI (radians)
'composite': how the draw will happen; possible values: source-over, source-atop, source-in, source-out, destination-over, destination-atop, destination-in, destination-out, lighter, copy, xor, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity
'alpha': how visible the draw is; 0 to 1 (decimal)
}
called: performs the specified draw function using the specified pArgs object; ex ( {'type': 'image', 'image': this, 'x': 1, 'y': 1} )
Movable [Mob, Obj]
desc: inherits from Diob
variables:
moveSettings: object containing settings for moving
{
'moveSpeed': number of milliseconds to wait until next step (default of 10)
'stepSize': amount of pixels moved with each step (default of 1)
'stepGlide': determines if the movable glides around edges of solid objects (default true for mobs, false for objects)
'stepSlide': determines if the movable changes direction when moving or keeps the direction manually set (default false)
}
event functions:
onBump(pDiob)
pDiob: diob that was bumped into
called: when this diob bumps into another diob
onMove(pX, pY, pDir)
pX: amount of x pixels attempting to move
pY: amount of y pixels attempting to move
pDir: direction the movable is moving
called: called before default movement is done; if this is defined, return true to continue movement otherwise movement will stop
onMoved(pX, pY, pDir)
pX: number of pixels on the x-axis that the movable was moved
pY: number of pixels on the y-axis that the movable was moved
pDir: direction the movable was moved
called: when this movable moves
onRelocated(pX, pY, pMap, pMove)
pX: old x position
pY: old y position
pMap: old map name
pMove: true if position changed from movement, false if set directly
called: when this movable changes x or y position or maps
onCrossed(pMovable)
pMovable: movable that crossed with this movable
called: when this movable and pMovable have overlapping size boxes
onUncrossed(pMovable)
pMovable: movable that uncrossed with this movable
called: when this movable and pMovable no longer have overlapping size boxes
onScreenMoved(pClient)
CLIENT ONLY
pClient: a reference to the client
called: when this diob changes position while in client's screen view
functions:
getDir()
called: returns the direction of this object
setDir(pDir)
pDir: a string containing the direction to set (north, south, east, west, northeast, northwest, southeast, southwest)
called: sets the direction of this object
setCoordOffsets(pX, pY)
pX: the x offset from the xCoord
pY: the y offset from the yCoord
called: sets the coord offset of the object
getCoordOffsets()
called: returns an object {'x': x, 'y': y} containing the x and y coord offsets of the object
setPos(pX, pY, pMap)
pX: value to set the movable's x position on the map to
pY: value to set the movable's y position on the map to
pMap: optional; string containing name of map to set position on
called: sets the movable's map position to pX, pY
setLoc(pVal1, pVal2, pVal3)
pVal1: first value of function
pVal2: second value of function
pVal3: optional; string containing the name of a map to move the object to
called: moves this to specified location; if pVal1 and pVal2 are numbers, this is moved to the coordinate pVal1, pVal2; if pVal1 is an object but not a tile, this is moved to the location of object; if pVal1 is a tile, this is moved to that tile
step(pArg1, pArg2, pArg3)
pArg1: either a direction or a number
pArg2: second argument
pArg3: third argument
called: calls either movable.stepPos or movable.stepDir depending on the specified arguments; if pArg1 is a number, movable.stepPos will be called, otherwise movable.stepDir will be called; returns true or false depending on if the step was successful
stepPos(pX, pY, pGlide)
pX: x value to step by
pY: y value to step by
pGlide: if set, movement will not stop unless move directions are blocked
called: steps the movable by pX x pixels and pY y pixels; takes obstacles into consideration; returns true or false depending on if the step was successful
stepDir(pDir, pSize, pSlide)
pDir: direction to move movable in
pSize: size of step to take
pSlide: if set, the step will occur without changing the movable's direction
called: moves movable pSize pixels in the direction of pDir; if pSize is not set, the size is the movable's stepSize; takes obstacles into consideration; returns true or false depending on if the step was successful
move(pArg1, pArg2)
pArg1: either a direction or a number
pArg2: either y position to move or null
called: calls either movable.movePos or movable.moveDir depending on the specified arguments; if pArg1 is a number, movable.movePos will be called, otherwise movable.moveDir will be called; this moves the movable until told to stop; you can stop movement by calling a different movement function or calling this function with no or null arguments
movePos(pX, pY)
pX: x value to step by
pY: y value to step by
called: moves the movable by pX x pixels and pY y pixels until told to stop; takes obstacles into consideration; you can stop movement by calling a different movement function or calling this function with no or null arguments
moveDir(pDir)
pDir: direction to move movable in
called: moves movable in the direction of pDir using movable's stepSize until told to stop; takes obstacles into consideration; you can stop movement by calling a different movement function or calling this function with no or null arguments
Tile
desc: inherits from Diob
event functions:
onEnter(pDiob, pDir)
pDiob: diob trying to enter this tile
pDir: direction of movement diob is attempting to make to enter the tile
called: called before the diob enters the tile; returning false will prevent the diob from entering
onExit(pDiob, pDir)
pDiob: diob trying to exit this tile
pDir: direction of movement diob is attempting to make to exit the tile
called: called before the diob exits the tile; returning false will prevent the diob from exiting
Mob
desc: inherits from Movable which inherits from Diob
variables:
client: a reference to the client of this mob
event functions:
onLogin()
called: when a client has taken control of the mob
onLogout()
called: when a client no longer has control of a mob
functions:
getClient()
called: returns the client controlling this mob, if there is one
Overlay
desc: inherits from Diob
variables:
appearMask: if true, this overlay will appear directly above the parent and use the same appearance properties as the parent, such as angle and alpha; the overlay will basically be an extension of the parent's icon
functions:
Sound
variables:
soundName: name of the sound file associated with this sound object
volume: volume of this sound object
loop: if true sound loops; if false sound plays once
Interface
desc: inherits from Diob
variables:
xPos: position on the x-axis from left to right of the interface element on the screen
yPos: position on the y-axis from top to bottom of the interface element on the screen
width: width of the collision box of the object
height: height of the collision box of the object
interfaceType: type of interface; TextBox/CommandInput/TextInput/PassInput/WebBox/Default
isHidden: true if the interface is hidden; false otherwise
event functions:
onFocus(pClient)
pClient: client focusing on this interface object
called: called when a client gains focus on this object
onUnfocus(pClient)
pClient: client losing focus on this interface object
called: called when a client loses focus of this object
onShow(pClient)
pClient: client being shown the interface object
called: called after a client has loaded the interface object onto the screen
onHide(pClient)
pClient: client the interface object is being hidden from
called: called after this interface object has been hidden from view
onExecute(pClient)
pClient: client executing the interface
called: called when the general purpose of an interface object is executed; TextInputs are executed when enter is pressed while it is focused; any interface object can be executed via object.execute()
functions:
getClient()
called: returns the client this interface element belongs to, if there is one
hide()
called: hides the interface element
show()
called: shows the interface element
execute(pClient)
pClient: client to execute with
called: executes any default commands or custom executed event of object
setPos(pX, pY)
pX: position on the x-axis of the screen; from left to right
pY: position on the y-axis of the screen; from top to bottom
called: moves the interface element to the specified screen location
getPos()
called: returns an object {'x': x,'y': y} containing the x and y positions of the interface element on the screen
getInterfaceName()
called: returns the name of the interface the interface object is part of
Client
variables:
mob: a reference to the player mob of this client
mainOutput: name of the interface element to send default messages to (ex: 'interface1.output1' )
mainWebStyle: string containing CSS to be used as a web style (ex '.test{font-weight: bold;}.test2{color: #000;}' ); style can be referenced by the name 'default'
xEdgeLimit: amount of black tiles that can be seen on the left and right of the view
yEdgeLimit: amount of black tiles that can be seen on the top and bottom of the view
xViewEyeOffset: amount of pixels the client's view is offset by from the view eye on the x-axis
yViewEyeOffset: amount of pixels the client's view is offset by from the view eye on the y-axis
screenBackground: string containing a color (null for transparent) to set the client's screen background to, for example '#000' for black; default is '#000'
webBackground: a string containing the HTML to display behind the game screen; #web_background to set the style of the entire background
color: hex, rgb, rgba, or color matrix value; applies color filter to entire map; ex ( '#000' ); ex ( 'rgb(10, 20, 30)' )
ex (
[-1, 0, 0, 0, 1,
0, -1, 0, 0, 1,
0, 0, -1, 0, 1,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
]
)
mapView: an object containing variables for the mapView (ex: {'width': 640,'height':640} )
{
height: height in pixels of the map view on the game screen
width: width in pixels of the map view on the game screen
xPos: amount of pixels from the left for the map view to be drawn on the game screen
yPos: amount of pixels from the top for the map view to be drawn on the game screen
scale: an object {'width': 2, 'height': 2} containing width and height scaling information
angle: number between 0 and 2PI radians to set the mapView's angle to
xTiles: optional; only set if you want to change; number of tiles shown on the x-axis
yTiles: optional; only set if you want to change; number of tiles shown on the y-axis
}
screenView: an object containing variables for the screenView (ex: {'scaleTo': 'ratio', 'scaleNearest': true})
{
scaleNearest: true or false; default false; if true pixels will base themselves off nearest neighbor when scaled; if false pixels will be smoothed out to blend with other pixels when scaled
scaleTo: default 'normal'; how to handle scaling of the screen; possible values:
'normal': normal scaling
'ratio': keep aspect ratio
'multiple': scale to only multiples of two
'none': no scaling
}
event functions:
onNew(pPar)
pPar: URL parameters sent when the client connected; loading a game URL such as "http://127.0.0.1:1234/?test" would send "test" into onNew as pPar on both the server and client-side
called: when a client object has been created
onDel()
called: when a client object has been deleted
onWindowResize()
CLIENT ONLY
called: when the client window is resized
onWindowFocus()
CLIENT ONLY
called: when the client window is focused
onWindowBlur()
CLIENT ONLY
called: when the client window loses focus
onScreenMove(pX, pY, pOldX, pOldY)
CLIENT ONLY
pX: the screen's new x position
pY: the screen's new y position
pOldX: the screen's old x position
pOldY: the screen's old y position
called: when the client screen moves
onScreenRender()
CLIENT ONLY
called: when the client screen is rendered
onConnect()
called: when a client has successfully connected to the world; if solo world, called when the main user loads
onDisconnect()
called: when a client has disconnected from the world; if solo world, called just before the world closes
onCommand(pCommand, pData)
pCommand: name of command
pData: object containing information for command
called: when a client or server sends a command using client.sendCommand
onMouseClick(pDiob, pX, pY, pButton)
pDiob: object mouse clicked
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when the mouse clicks an object
onMouseDblClick(pDiob, pX, pY, pButton)
pDiob: object mouse double clicked
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when the mouse double clicks an object
onMouseEnter(pDiob, pX, pY)
pDiob: object moused on to
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
called: called when the mouse moves onto an object
onMouseExit(pDiob, pX, pY)
pDiob: object moused off of
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
called: called when the mouse moves off of an object
onMouseMove(pDiob, pX, pY)
pDiob: object moused over
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
called: called when the mouse moves over an object
onMouseDown(pDiob, pX, pY, pButton)
pDiob: object moused down on
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when a mouse button has been pressed while over an object
onMouseUp(pDiob, pX, pY, pButton)
pDiob: object moused up on
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
pButton: the button used; 1 for left, 2 for middle, 3 for right
called: called when a mouse button is released while over an object
onMouseWheelScrollUp(pDiob, pX, pY)
pDiob: object under the mouse; if any
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
called: called when the mouse wheel scroll is scrolled upward
onMouseWheelScrollDown(pDiob, pX, pY)
pDiob: object under the mouse; if any
pX: the x position on the screen of the mouse
pY: the y position on the screen of the mouse
called: called when the mouse wheel scroll is scrolled downward
onKeyDown(pKey)
pKey: code for the pressed key
called: called when a key is pressed down
onKeyUp(pKey)
pKey: code for the released key
called: called when a key is released
commands:
startMove(pDir)
pDir: name of direction to move client.playerMob
called: moves the client.playerMob in the direction pDir until told to stop via endMove(pDir)
endMove(pDir)
pDir: name of direction to stop moving the client's playerMob in; pDir being undefined ends all movement
called: ends movement of client.playerMob in the direction of pDir
functions:
setMouseCursor(pCursor, pX, pY)
pCursor: a string containing the name of the cursor for built-in cursors, a URL path to an image, or a diob; built-in (auto, all-scroll, crosshair, default, help, inherit, move, pointer, progress, text, vertical-text, wait, no-drop, not-allowed, e-resize, n-resize, s-resize, w-resize, col-resize, row-resize, ne-resize, nw-resize, se-resize, sw-resize); passing a diob will use the diob's icon; blank for default
pX: optional; offsets the icon left or right by pX pixels
pY: optional; offsets the icon up or down by pY pixels
called: sets the cursor of the client
getPlayerMob()
called: returns the mob that the client is controlling
setPlayerMob(pMob)
called: sets the client's playerMob to pMob
getAccountName()
called: returns the name of the account the client is logged in with
setMacroAtlas(pMacro)
pMacro: name of macro file to set client macros to
called: changes the macro file the client uses
addCustomMacro(pName, pKey, pDown, pUp)
pName: name of the custom macro
pKey: key code that will execute the macro
pDown: optional; string containing the command to be executed when the key is pushed down; example 'test(1)' would execute the 'test' client command with one parameter equal to '1'
pUp: optional; string containing the command to be executed when the key is let go of; example 'test(1)' would execute the 'test' client command with one parameter equal to '1'
called: creates a new custom macro named pName with the keyDown command of pDown and the keyUp command of pUp; custom macros override macro atlas macros
removeCustomMacro(pName)
pName: name of the custom macro
called: removes the custom macro pName from the client's custom macros
getCustomMacroNames()
called: returns an array of custom macro names
setFocus(pVal1, pVal2)
pVal1: if an interface element, this element is focused; if a string, then used as interface file name
pVal2: if set and is string and pVal1 is string, then used as name of interface element in interface file with name pVal1
called: focuses on the interface element object
getFocus()
called: returns object currently being focused by this client
setEdgeLimit(pX, pY)
pX: number of black tiles visible on the left and right edges of the map; -1 for default
pY: number of black tiles visible on the top and bottom edges of the map; -1 for default
called: sets the edge limit of the map for the client
addInterfaceElement(pType, pInterface, pName, pX, pY, pArgs)
pType: type of interface object to add
pInterface: name of the interface to add the interface element to
pName: optional; name to give the element being added
pX: optional; x position to give the element
pY: optional; y position to the give the element
pArgs: optional; array of arguments to pass to the onNew event of the interface element being created
called: adds an interface element to the interface and returns it
removeInterfaceElement(pInterface, pName)
pInterface: name of the interface to remove an interface element from
pName: name of the interface element to remove
called: removes an interface element from the interface
getInterfaceElement(pInterface, pElement)
pInterface: name of the interface to get element from
pElement: name of the element to get
called: returns the interface element object of the specified interface
getInterfaceElements(pInterface, pType, pChild)
pInterface: name of the interface to get element from
pType: optional; string containing type path to return
pChild: optional; boolean that determines if child types are included
called: returns an array of interface elements on the interface pInterface depending on the provided arguments; if pType is not set, all elements on the interface will be returned; if pType is set but pChild is not, elements on the interface with the exact type of pType will be returned; if pType is set and pChild is set, all elements with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Interface/A' with pChild undefined, all elements with the exact type of 'Interface/A' will be returned, but if pChild is set, then all types starting with 'Interface/A' on the interface will be returned
showInterface(pInterface, pElement, pForce)
pInterface: name of interface to show
pElement: optional; name of interface element in pInterface to show
pForce: optional; if set, all hidden elements will be forced to be shown
called: displays the interface of pInterface, if not already displayed, along with all elements of the interface with that are not hidden by default; if pElement is specified, it makes that element no longer hidden
hideInterface(pInterface, pElement)
pInterface: name of the interface to hide or the interface containing pElement
pElement: optional; name of interface lement in pInterface to hide
called: hides the interface of pInterface if pElement is not specified, otherwise it only hides pElement
playSound(pSound)
pSound: either a string with the name of a sound file, or a string containing the path of a Sound object, or an actual Sound object, or a basic object with the proper information; ex ( {'soundName': 'name', 'volume': 50} )
called: plays a sound to this client
outputText(pText, pDisplay)
pText: text to be displayed
pDisplay: interface element to output text to
called: outputs text to an interface element; if pDisplay is not set or is invalid, text goes to client.mainOutput
setLocalStorage(pKey, pData)
pKey: key used to reference the stored data
pData: data as a string to store locally for the client
called: stores pData as a string locally on the client's computer and can be referenced using pKey; leaving pKey and pData blank will clear all local storage; 3000 characters are allowed to be saved per game (keys and values combined)
getLocalStorage(pKey)
pKey: key used to get data stored locally on the client's computer
called: gets the data as a string that is stored with the key pKey on the client's computer
setViewEye(pDiob)
pDiob: diob to have the client's screen view centered on
called: sets the view eye of the client to be centered on pDiob; the default is the player mob
getViewEye()
called: returns the diob the client's screen eye is currently set to
setViewEyeOffsets(pX, pY)
pX: amount of pixels for the screen to be offset from the client's view eye on the x-axis
pY: amount of pixels for the screen to be offset from the client's view eye on the y-axis
called: sets the client's view eye offsets
getViewEyeOffsets()
called: returns an object {'x': x, 'y': y} containing the x and y offsets of client's view eye
getScreenPos()
called: returns an object {'x': x, 'y': y} containing the x and y position of the client's screen on the map
changeServer(pAddress)
pAddres: address for the server to move the client to; example '127.0.0.1:1234'
called: moves the client to a new server located at the address pAddress
getAddress()
called: returns address of the client, 'localhost' for local or 'ip:port' if connected to a server
getMapView()
called: returns a mapView object containing the information of the client's mapView; for example {'width': 640, 'height': 640} would mean the client's mapView is 640 by 640 pixels in size
setMapView(pView)
pView: an object containing new information for the client's mapView; for example {'width': 640, 'height': 640} would set the client's mapView to 640 by 640 pixels
called: sets the client's mapView to pView or default if pView is null
getScreenView()
called: returns a screenView object containing the information of the client's screenView; for example {'scaleTo': 'ratio', 'scaleNearest': true} would mean the client's screenView keeps its ratio and scales pixels to their nearest neighbor
setScreenView(pView)
pView: an object containing new information for the client's screenView; for example {'scaleTo': 'ratio', 'scaleNearest': true} would mean the client's screenView keeps its ratio and scales pixels to their nearest neighbor; 'scaleNearest' means pixels will stay pixelated and will not try to blend with other pixels, 'scaleTo': 'normal' means normal scaling, 'scaleTo': 'ratio' means the width and height of the window keep their aspect ratio when scaled, 'scaleTo': 'multiple' means the game will only show in scales that are multiples of two when scaled, 'scaleTo': 'none' prevents all scaling
called: sets the client's screenView to pView or default if pView is null
getWindowSize()
CLIENT ONLY
called: returns an object containing the width and height of the game window; ex: {'width': 100, 'height': 100}
setScreenSize(pWidth, pHeight)
CLIENT ONLY
pWidth: width as a number
pHeight: height as a number
called: sets the client's game screen size to pWidth width and pHeight height
getScreenSize()
CLIENT ONLY
called: returns an object containing the width and height of the game screen; ex: {'width': 100, 'height': 100}
addWebStyle(pName, pStyle)
pName: unique name of style
pStyle: text as CSS to add to the client
called: adds CSS style
removeWebStyle(pName)
pName: unique name of style
called: removes a CSS style with the name pName
getWebTag(pID)
CLIENT ONLY
pID: id of the web tag
called: returns a reference to the web tag with the id pID
setWebTagStyle(pID, pStyle, pValue)
pID: id of the web tag to set the style of
pStyle: type of style to set
pValue: value as a string to set the style to
called: sets the style of pStyle to the value of pValue of the web tag with the id pID
setWebTagContent(pID, pContent)
pID: id of the web tag to set the content of
pContent: string containing the content to change the web tag's content to
called: sets the content of the web tag with the id pID to the value of pContent
getWebTagContent(pID, pContent)
CLIENT ONLY
pID: id of the web tag to get the content of
called: returns the content of the web tag with the id of pID
setWebTagFocus(pID)
pID: id of the web tag to set focus to
called: sets the focus on the web tag with the id pID
callWebTagEvent(pID, pEvent)
pID: id of the web tag to call the event of
pEvent: name of the event to call; onMouseDown, onMouseUp, onMouseClick, onMouseDblClick, onMouseMove
called: executes the event pEvent of the web tag with the id pID
removeWebTag(pID)
pID: id of the web tag to remove from the client's screen
called: removes a web tag with the id of pID from the client's screen
addWebScript(pName, pLink, pFunc)
CLIENT ONLY
pName: name to give the script
pLink: link to the JavaScript file to load
pFunc: function to call after the JavaScript file has loaded
called: loads a JavaScript file into the project
removeWebScript(pName)
CLIENT ONLY
pName: name of script to remove
called: removes the script with the pName name from the game
evalWebScript(pScript)
pScript: a string containing the JavaScript code to evaluate
called: evaluates the JavaScript code in the pScript string
callCommand(pCommand, pArgs)
pCommand: name of the client command to call
pArgs: array of arguments to pass to the command
called: calls the client command of pCommand with the arguments of pArgs
addCommand(pCommand, pFunc)
pCommand: name of the client command to be added
pFunc: function to be called when the command is executed
called: adds a new command to the client's commands; if pFunc is null and pCommand is the name of an pre-defined command, that command will be added
removeCommand(pCommand)
pCommand: name of the client command to remove
called: removes the client command from the client's commands
sendCommand(pCommand, pData)
pCommand: name of command to send
pData: an object containing data to be sent
called: sends a command to a client or server, depending on where the code is executed; client code executing this will send the command to the server; server code executing this will send the command to the client
getNavigator()
called: returns an object containing information about the client's browser and operating system; example {'platform': 'Netscape', 'version': 'Chrome/38.0.2125.104', 'vendor': 'Google', 'language': 'en-US', 'system': 'Windows 95'}
setScreenBackground(pBack)
pBack: string containing a color, for example '#000' for black
called: sets the background of the client's screen background
setWebBackground(pBack)
pBack: string containing HTML to set use in the web box behind the game screen
called: sets the HTML of the web box behind the game screen
createTopScreen(pName, pLayer, pSet)
pName: name of the top screen to create
pLayer: optional; layer to give the screen
pSet: optional; settings object; ex ( {'scaleNearest': true} );
{
'scaleNearest': true to prevent pixels from being blended together, false to smooth pixels
}
called: creates a new top screen named pName with the layer pLayer
setTopScreen(pName, pNewName, pNewLayer, pNewData, pNewSet)
pName: name of the top screen to set
pNewName: new name of the top screen
pNewLayer: new layer of the top screen
pNewData: optional; data to add to the screen
pNewSet: optional; new settings object
called: changes the name and layer of the top screen with the name pName; adding data optional
getTopScreen(pName, pType)
pName: optional; name of the top screen to get the data of
pType: type of data to get; 'url' or 'pixels'
called: grabs an object with the screen name, layer, settings, and either an array of pixel data or a data url depending on pType for the entire screen named pName or the default top screen if no name is given. The array of pixel data can then be changed and used elsewhere or drawn onto another screen. To read the width and height you could use object.width and object.height, where object is the object returned by the function. The object data array is as follows: object.data[0] is the red value (0-255) of the pixel at 0,0, object.data[1] is the green value (0-255) of the pixel at 0,0, object.data[2] is the blue value (0-255) of the pixel at 0,0, and object.data[3] is the alpha value (0-255) of the pixel at 0,0. Then object.data[4], object.data[5], object.data[6], and object.data[7] are the respective values for the pixel at 1,0. This trend continues through the whole array for every pixel. object ex: {'name': '', 'layer': 1, 'data': ''}
topScreenDraw(pArgs, pName)
pArgs: an object or array of objects which determines the settings of the draw
{
'type': type of draw
{
'image': draw an image
'image': either a path to an image or a diob, in which case the diob's icon will be used
'x': x position to draw the image
'y': y position to draw the image
'width': width of the image when drawn
'height': height of the image when drawn
'clipX': optional; x value inside of the image to start clipping
'clipY': optional; y value inside of the image to start clipping
'clipW': optional; width of the area to clip
'clipH': optional; height of the area to clip
'text': draw text
'text': text to draw
'color': color of the text; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'x': x position to draw the text
'y': y position to draw the text
'font': font size and type to use; ex ( '12px monospace' )
'maxWidth': max width to draw the text (shrink the text if it wont fit)
'fillRect': draw a filled in rectangle
'color': color of the rect; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'x': x position to start the rect
'y': y position to start the rect
'width': width of the rect
'height': height of the rect
'strokeRect': draw an unfilled rectangle
'color': color of the rect; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'x': x position to start the rect
'y': y position to start the rect
'width': width of the rect
'height': height of the rect
'clearRect': clear a rectangular area on the screen
'x': x position to start the area to clear
'y': y position to start the area to clear
'width': width of the area to clear
'height': height of the area to clear
'fillPath': create a path and fill it in (shapes)
'color': color to fill; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'path': array of path objects
{
'type': type of path object
'move': move path cursor
'line': draw path line from current cursor to new position
'x': x position
'y': y position
}
'strokePath': create a path of lines
'color': color to stroke; rgb value or hex; ex ( 'rgb(10, 10, 10)' ); ex ( '#000' )
'path': array of path objects
{
'type': type of path object
'move': move path cursor
'line': draw path line from current cursor to new position
'x': x position
'y': y position
}
}
'angle': angle of the draw; 0 to 2PI (radians)
'composite': how the draw will happen; possible values: source-over, source-atop, source-in, source-out, destination-over, destination-atop, destination-in, destination-out, lighter, copy, xor
'alpha': how visible the draw is; 0 to 1 (decimal)
}
pName: optional; name of the screen to draw on to
called: performs the specified draw function using the specified pArgs object; ex ( {'type': 'image', 'image': this, 'x': 1, 'y': 1} )
toggleScreenDrawing(pVal)
pVal: optional; true to resume screen drawing, false to pause all screen drawing, 'map' to pause only the map drawing
called: toggles screen drawing on and off
setColor(pColor)
pColor: hex, rgb, rgba, or color matrix value; applies color filter to entire map; ex ( '#000' ); ex ( 'rgb(10, 20, 30)' )
ex (
[-1, 0, 0, 0, 1,
0, -1, 0, 0, 1,
0, 0, -1, 0, 1,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
]
)
called: sets this client's color to pColor
addOverlay(pOver, pAppearance)
pOver: string of the type of object or overlay to add an overlay of or actual diob to get type from
pAppearance: optional; if true, this overlay will be be treated as if it is part of the the parent's actual appearance - appearance settings such as angle and alpha of the parent will be used for this overlay and the overlay will be drawn directly on top of the parent so no other diobs that are not an overlay of the parent can appear between it and the parent (it will basically be an extension of the parent's icon); if this is false, the overlay will be treated as an independent diob that just follows the parent around
called: adds an overlay to the client which is a visual icon that always follows the screen; returns the new overlay
removeOverlay(pOver)
pOver: string of the type of object or overlay to remove or actual overlay to remove
called: removes all overlays with the pOver type or the exact overlay matching pOver
getOverlays()
called: returns an array of the client's overlays
setOverlays(pOver)
pOver: array of overlays to set this client's overlays to
called: sets the client's overlays to the array pOver
getPlane(pPlane)
CLIENT ONLY
pPlane: value of plane to get
called: returns the diob plane pPlane; you can then alter is like any other diob and all visual changes will be applied to all diobs on this plane
setPlane(pPlane, pVar, pVal)
pPlane: value of plane to set
pVar: string containing name of variable to set
pVal: value to give this plane's pVar variable
called: sets the variable pVar to pVal for the plane pPlane
Math
desc: static object used to perform mathematical operations
static variables:
E
PI
SQRT2
SQRT1_2
LN2
LN10
LOG2E
LOG10E
static functions:
abs(pNum)
pNum: number to get absolute value from
called: returns the absolute value of a number
acos(pNum)
pNum: number to get arccosine value from
called: returns the arccosine of pNum
asin(pNum)
pNum: number to get arcsine value from
called: returns the arcsine of pNum
atan(pNum)
pNum: number to get arctangent value from
called: returns the arctangent of pNum
atan2(pX, pY)
pX: x value
pY: y value
called: returns the arctangent as a numeric value between PI and -PI radians representing the counterclockwise angle in radians between the x axis and the point (pX, pY)
ceil(pNum)
pNum: number to get ceil value from
called: returns nearest integer greater than or equal to pNum
cos(pNum)
pNum: number to get cosine value from
called: returns the cosine of pNum
exp(pNum)
pNum: number passed to E
called: returns E^pNum where E is Euler's number
floor(pNum)
pNum: number to get floor value from
called: returns nearest integer less than or equal to pNum
log(pNum)
pNum: number to get natural logarithm of
called: returns the natural logarithm of pNum
max(pN1, pN2, ... , pNn)
pNn: numbers to check max of
called: returns the highest number from the numbers provided
min(pN1, pN2, ... , pNn)
pNn: numbers to check min of
called: returns the lowest number from the numbers provided
pow(pBase, pExp)
pBase: number of the base
pExp: number to raise the base to
called: returns the value of pBase raised to the power of pExp
rand(pNum1, pNum2)
pNum1: if pNum2 is not defined then pNum1 is the max value and the min value is 0 otherwise pNum1 is min value
pNum2: max value to find random number from
called: if pNum1 and pNum2 are not defined return a random number between 0 and 1; if pNum1 is defined by not pNum2 return a random number between 0 and pNum1; if both pNum1 and pNum2 are defined return a random number between pNum1 and pNum2
random()
called: returns a random decimal value between 0 and 1
round(pNum)
pNum: number to get round value from
called: returns the nearest whole number to pNum
sin(pNum)
pNum: number to get sine value from
called: returns the sine of pNum
sqrt(pNum)
pNum: number to get square root of
called: returns the square root value of pNum
tan(pNum)
pNum: number to get tangent value from
called: returns the tangent of pNum
getMatrix(pRows, pColumns, pNum1, pNum2, ..., pNumn)
pRows: number of rows the matrix will have
pColumns: number of columns the matrix will have
pNumn: numbers to add to the matrix starting at [0][0]
called: returns a matrix with the pRows rows, pColumns columns, and the numbers provided
Date
desc: static object used to perform date/time operations
static functions:
newDate(pDate)
pDate: optional; default is the current date and time; can be number of milliseconds since 01/01/1970; can be a date string; can be multiple variables, each one treated as the following (year, month, day, hours, minutes, seconds, milliseconds)
called: sets the Date static object to the specified pDate for the next date operation
getDate()
called: returns the day of the month (from 1 to 31) according to local time
getDay()
called: returns the day of the week (0 to 6) Sunday is 0, Monday is 1, etc, according to local time
getFullYear()
called: returns the year (four digits) according to local time
getHours()
called: returns the hour (from 0-23) according to local time
getMilliseconds()
called: returns the milliseconds (from 0-999) according to local time
getMinutes()
called: returns the minutes (from 0-59) according to local time
getMonth()
called: returns the month (from 0-11) according to local time
getSeconds()
called: returns the seconds (from 0-59) according to local time
getTime()
called: returns number of milliseconds since midnight Jan 1, 1970
getTimezoneOffset()
called: returns the time difference between UTC time and local time, in minutes
getUTCDate()
called: returns the day of the month (from 1 to 31) according to universal time
getUTCDay()
called: returns the day of the week (0 to 6) Sunday is 0, Monday is 1, etc, according to universal time
getUTCFullYear()
called: returns the year (four digits) according to universal time
getUTCHours()
called: returns the hour (from 0-23) according to universal time
getUTCMilliseconds()
called: returns the milliseconds (from 0-999) according to universal time
getUTCMinutes()
called: returns the minutes (from 0-59) according to universal time
getUTCMonth()
called: returns the month (from 0-11) according to universal time
getUTCSeconds()
called: returns the seconds (from 0-59) according to universal time
parse()
called: parses a date string and returns the number of milliseconds since midnight of Jan 1, 1970
setDate(pDay)
pDay: day to set the date to; 1-31; 0 for last day of previous month; -1 for day before last day of previous month; values more than number of days in the current month result in days of the next month
called: sets the day of the dat and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to local time
setFullYear(pYear, pMonth, pDay)
pYear: four-digit value for the year to set
pMonth: optional; month to set; 0-11; negative values to go to previous year; values over 11 to go to next year
pDay: optional; day to set; 1-31; 0 or negative values for previous month; values over 31 for next month
called: sets year and (optional) month and day and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to local time
setHours(pHour, pMin, pSec, pMillisec)
pHour: day to set; 0-23; negative values for previous day; values of 23 for next day
pMin: optional; minutes to set; 0-59; negative for previous hour; over 59 for next hour
pSec: optional; seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets hour and (optional) minutes, seconds, and milliseconds and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to local time
setMilliseconds(pMillisec)
pMillisec: milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets milliseconds and returns milliseconds since midnight of Jan 1, 1970 from new date according to local time
setMinutes(pMin, pSec, pMillisec)
pMin: minutes to set; 0-59; negative for previous hour; over 59 for next hour
pSec: optional; seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets minutes and (optional) seconds and milliseconds and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to local time
setMonth(pMonth, pDay)
pMonth: sets month; 0-11; negative for last year; over 11 for next year
pDay: optional; sets day; 1-31; 0 or negative for last month; over days of month for next month
called: sets month and (optional) day and returns milliseconds since midnight Jan 1, 1970 from new day according to local time
setSeconds(pSec, pMillisec)
pSec: seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets seconds and (optional) milliseconds and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to local time
setTime(pMillisec)
pMillisec: number of milliseconds to add to or subtract from midnight of Jan 1, 1970; negative to subtract
called: returns milliseconds since midnight of Jan 1, 1970 from the new date according to local time
setUTCDate(pDay)
pDay: day to set the date to; 1-31; 0 for last day of previous month; -1 for day before last day of previous month; values more than number of days in the current month result in days of the next month
called: sets the day of the dat and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to universal time
setUTCFullYear(pYear, pMonth, pDay)
pYear: four-digit value for the year to set pMonth: optional; month to set; 0-11; negative values to go to previous year; values over 11 to go to next year
pDay: optional; day to set; 1-31; 0 or negative values for previous month; values over 31 for next month
called: sets year and (optional) month and day and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to universal time
setUTCHours(pHour, pMin, pSec, pMillisec)
pHour: day to set; 0-23; negative values for previous day; values of 23 for next day
pMin: optional; minutes to set; 0-59; negative for previous hour; over 59 for next hour
pSec: optional; seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets hour and (optional) minutes, seconds, and milliseconds and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to universal time
setUTCMilliseconds(pMillisec)
pMillisec: milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets milliseconds and returns milliseconds since midnight of Jan 1, 1970 from new date according to universal time
setUTCMinutes(pMin, pSec, pMillisec)
pMin: minutes to set; 0-59; negative for previous hour; over 59 for next hour
pSec: optional; seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets minutes and (optional) seconds and milliseconds and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to univeral time
setUTCMonth(pMonth, pDay)
pMonth: sets month; 0-11; negative for last year; over 11 for next year
pDay: optional; sets day; 1-31; 0 or negative for last month; over days of month for next month
called: sets month and (optional) day and returns milliseconds since midnight Jan 1, 1970 from new day according to universal time
setUTCSeconds(pSec, pMillisec)
pSec: seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets seconds and (optional) milliseconds and returns the milliseconds since midnight of Jan 1, 1970 from the new date according to universal time
toDateString()
called: converts the date into a readable string and returns it
toISOString()
called: converts the date into an ISO standard string (YYYY-MM-DDTHH:mm:ss.sssZ) and returns it
toJSON()
called: converts the date into a JSON date (YYYY-MM-DDTHH:mm:ss.sssZ) and returns it
toLocaleDateString()
called: converts the date into a local date string (MM/DD/YYY or DD/MM/YYYY) and returns it
toLocaleTimeString()
called: converts the date into a local time string (HH:mm:ss AM|PM) and returns it
toLocaleString()
called: converts the date into a local date/time string (MM/DD/YYY | DD/MM/YYYY HH:mm:ss AM|PM) and returns it
toString()
called: returns the date as a string
toTimeString()
called: returns the date as a time string
toUTCString()
called: returns the date as universal date/time string
UTC(pYear, pMonth, pDay, pHour, pMin, pSec, pMillisec)
pYear: four-digit value for the year to set
pMonth: sets month; 0-11; negative for last year; over 11 for next year
pDay: sets day; 1-31; 0 or negative for last month; over days of month for next month
pHour: optional; day to set; 0-23; negative values for previous day; values of 23 for next day
pMin: optional; minutes to set; 0-59; negative for previous hour; over 59 for next hour
pSec: optional; seconds to set; 0-59; negative for previous minute; over 59 for next minute
pMillisec: optional; milliseconds to set; 0-999; negative for previous second; over 999 for next second
called: sets year, month, day, and (optional) hour, min, sec, milliseconds based on universal time and returns milliseconds since midnight Jan 1, 1970 from the new date according to universal time
Resource
desc: static object with various resource operations
static functions:
loadResource(pType, pName, pFunc)
pType: type of file to load
pName: name of file to load
pFunc: function to call after the resource has finished loading or failed to load
called: loads the resource of type pType with the name pName and then calls the function pFunc
getFileText(pName)
pName: name of loaded file to get text of
called: returns a string containing the text inside of a loaded non-VS text file; the file must already be loaded to get the text
Util
desc: static object with various utility operations
static functions:
isNumber(pVal)
pVal: value to check for number
called: returns true if value is a number; returns false if value is not a number
isString(pVal)
pVal: value to check for string
called: returns true if value is a string; returns false if value is not a string
isArray(pVal)
pVal: value to check for array
called: returns true if value is an array; returns false if value is not an array
toNumber(pVal)
pVal: value to get number from
called: returns pVal converted to a number value
toString(pVal)
pVal value to get string from
called: returns pVal converted to a string value
regExp(pPattern, pFlags)
pPattern: regular expression (regex) pattern string
pFlags: optional; 'g' = global match; 'i' = ignore case; 'm' = multiline, treat start and end characters (^ and $) as working over multiple lines;
called: returns a regular expression pattern from the pPattern string using the pFlags flag
pick(pArray)
pArray: array of items to pick from
called: returns a randomly picked item from pArray
stringToObject(pString)
pString: string to create an object from; ex ( "{'name': 'test', 'value1': 1}" )
called: creates an object from pString and returns it if the string is a valid object format
encodeWebTags(pText)
pText: text to encode HTML tags of
called: returns a new text with HTML tags encoded; '<' becomes '&lt;', '>' becomes '&gt;', '/' becomes '&#47;'
encodeURI(pText)
pText: text to encode
called: returns new text that has been encoded to make it a valid URI
decodeURI(pText)
pText: text to decode
called: returns new text that has been decoded
encodeURIComponent(pText)
pText: text to encode
called: returns new text that has been encoded to make it a valid URI component
decodeURIComponent(pText)
pText: text to decode
called: returns new text that has been decoded
Event
desc: static object with various event operations
static functions:
interruptSpawn(pVal)
pVal: variable linking to the spawn to be interrupted
called: prevents a specific spawn from occuring
interruptThread(pVal)
pVal: variable linking to the thread to be interrupted
called: forces a thread to stop doing its executions
File
desc: static object with various file operations
static functions:
writeText(pFile, pData, pFunc)
pFile: path to the file
pData: text to put into the file
pFunc: function to call after writing is complete; first argument pErr is set if an error occurs
called: creates pFile if needed and then writes pData to the file; overwrites existing data
readText(pFile, pFunc)
pFile: path to the file
pFunc: function to call after reading is complete; first argument pData is set to the data read; second arg pErr is set if an error has occured
called: reads the data and returns the data in pFunc
appendText(pFile, pData, pFunc)
pFile: path to the file
pData: text to add to the end of pFile
pFunc: function to call after appending is complete; first argument pErr is set if an error has occured
called: creates pFile if needed and then add pData to the end of the file
makeDir(pPath, pFunc)
pPath: path to create the new directory
pFunc: function to call after the directory has been made
called: creates a new directory at the location of pPath
remove(pPath, pFunc)
pPath: path to the file or directory to delete
pFunc: function to call after pPath has been removed
called: deletes the file or directory at pPath; all child files are also deleted
writeSave(pFile, pSave, pFunc)
pFile: path to the file
pSave: object to save to the file for example ( {'value1': 1, 'value2': 2} )
pFunc: function to call after writing is complete; first argument pErr is set if an error has occured
called: creates pFile if it does not exist and then saves the pSave object to the file; overwrites existing data
readSave(pFile, pFunc)
pFile: path to the file
pFunc: function to call after reading is complete; first argument pData is set to the data read; second arg pErr is set if an error has occured
called: reads pFile and returns an object from the data in pFunc
exists(pPath, pFunc)
pFile: path to the file or directory to check
pFunc: function to call after pPath has been checked; first argument pExists determines if pPath exists or not
called: checks if pFile exists
Icon
CLIENT ONLY
desc: static object with various icon operations
static functions:
newAtlas(pAtlas)
called: create a new icon atlas with the name pAtlas
newIcon(pAtlas, pIcon, pWidth, pHeight)
pAtlas: name of the icon atlas to add the icon to
pIcon: name of the new icon
pWidth: optional; width of the new icon; uses tileWidth if not defined
pHeight: optional; height of the new icon; uses tileHeight if not defined
called: creates a new blank icon named pIcon inside of the atlas pAtlas
newIconState(pAtlas, pIcon, pState)
pAtlas: name of the icon atlas to add the icon state to
pIcon: name of the icon to add the icon state to
pState: name of the new icon state
called: creates a new blank icon state named pState for pIcon in the atlas pAtlas
newFrame(pAtlas, pIcon, pState)
pAtlas: name of the icon atlas to add the frame to
pIcon: name of the icon involved
pState: optional; name of the icon state involved
called: creates a new blank frame; if pState is defined the frame is added to the state, otherwise it is added to pIcon
setFrameDelay(pAtlas, pIcon, pState, pFrame, pDelay)
pAtlas: name of the icon atlas to add the frame to
pIcon: name of the icon involved
pState: name of the icon state involved
pFrame: frame number
pDelay: delay number
called: change frame pFrame delay to pDelay
getFrameDelay(pAtlas, pIcon, pState, pFrame)
pAtlas: name of the icon atlas to add the frame to
pIcon: name of the icon involved
pState: name of the icon state involved
pFrame: frame number
called: get delay of pFrame
getFrameCount(pAtlas, pIcon, pState)
pAtlas: name of the icon atlas to add the frame to
pIcon: name of the icon involved
pState: name of the icon state involved
called: returns number of frames the icon has
clone(pArgs)
pArgs: an object containing the information for the clone; useable varables: 'atlas', 'newAtlas', 'icon', 'newIcon', 'state', 'newState', and 'frame'
called: creates a clone of an atlas, icon, icon state, or frame
alterColor(pInfo, pAtlas, pIcon, pState, pFrame)
pInfo: an object containing information to be used for the color alteration
pAtlas: name of the icon atlas involved
pIcon: name of the icon involved
pState: optional; name of the icon state involved
pFrame: optional; number of the frame involved
called: alters color of the specified icon(s) based on the specified info; For example {'type': 'normal', 'red': 100} or just {'red': 100} would add 100 red to all pixels; {'red': -100} would reduce 100 red from all pixels; {'type': 'swap', 'red': 100, 'blue': 100, 'green': 100, 'newRed': 200} would find all pixels with the color rgb(100, 100, 100) and replace it with rgb(200, 100, 100); If any of the colors are not included, such as 'alpha', it will ignore that color, otherwise if it is set, it will take that color into account; {'type': 'multiply', 'hex': '#FFF'} would multiply blend white onto the icon, you can use 'hex' or the red, green, and blue values
applyFilter(pFilter, pAtlas, pIcon, pState, pFrame)
pFilter: an object containing needed information for filter; {'type': 'darken', 'value': 10} would darken the image by 10;
pAtlas: name of the icon atlas involved
pIcon: name of the icon involved
pState: optional; name of the icon state involved
pFrame: optional; number of the frame involved
called: applies a filter to the icon(s) involved; possible filter types: 'grayscale', 'invert', 'darken', 'lighten'
getRawData(pAtlas, pIcon, pState, pFrame)
pAtlas: name of the icon atlas involved
pIcon: name of the icon involved
pState: optional; name of the icon state involved
pFrame: optional; number of the frame involved
called: grabs an object with the width and height of the icon and an array of pixel data for the entire icon. The array of pixel data can then be changed and used elsewhere or drawn onto another icon. To read the width and height you could use object.width and object.height, where object is the object returned by the function. The object data array is as follows: object.data[0] is the red value (0-255) of the pixel at 0,0, object.data[1] is the green value (0-255) of the pixel at 0,0, object.data[2] is the blue value (0-255) of the pixel at 0,0, and object.data[3] is the alpha value (0-255) of the pixel at 0,0. Then object.data[4], object.data[5], object.data[6], and object.data[7] are the respective values for the pixel at 1,0. This trend continues through the whole array for every pixel.
setRawData(pData, pAtlas, pIcon, pState, pFrame)
pData: pixel data object to use
pAtlas: name of the icon atlas involved
pIcon: name of the icon involved
pState: optional; name of the icon state involved
pFrame: optional; number of the frame involved
called: changes the icon to match the pixel data given with pData
getDataURL(pAtlas, pIcon, pState, pFrame)
pAtlas: name of the icon atlas
pIcon: name of the icon
pState: optional; name of the state
pFrame: optional; number of the frame
called: returns a string containing the base64 data url for the icon which can then be used to display the icon as an image in HTML
getIconSize(pAtlas, pIcon, pState, pFrame)
pAtlas: name of the icon atlas
pIcon: name of the icon
pState: optional; name of the state
pFrame: optional; number of the frame
called: returns object containing the width and height of the icon; ex {'width': 100, 'height': 100}
Map
desc: static object with various map operations
static variables:
void: reference to a tile that exists in the void, this tile is used if a movable interacts with the edge of the map
static functions:
pixelRange(pO, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y pixels around the specified diob
pixelRangeByType(pO, pType, pChild, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pType: type or parent type of diobs to get
pChild: true to include all child diobs; false to include only diobs with the exact type of pType
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y pixels around the specified diob that have the same type as pType or a parent type of pType if pChild is enabled
pixelRangeView(pO, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y pixels around the specified diob that are visible to the diob
pixelRangeViewByType(pO, pType, pChild, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pType: type or parent type of diobs to get
pChild: true to include all child diobs; false to include only diobs with the exact type of pType
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y pixels around the specified diob that are visible to the diob and that have the same type as pType or a parent type of pType if pChild is enabled
pixelRangeViewers(pO, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y pixels around the specified diob that are able to see the diob
pixelRangeViewersByType(pO, pType, pChild, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pType: type or parent type of diobs to get
pChild: true to include all child diobs; false to include only diobs with the exact type of pType
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y pixels around the specified diob that are able to see the diob and that have the same type as pType or a parent type of pType if pChild is enabled
tileRange(pO, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y tiles around the specified diob
tileRangeByType(pO, pType, pChild, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pType: type or parent type of diobs to get
pChild: true to include all child diobs; false to include only diobs with the exact type of pType
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y tiles around the specified diob that have the same type as pType or a parent type of pType if pChild is enabled
tileRangeView(pO, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y tiles around the specified diob that are visible to the diob
tileRangeViewByType(pO, pType, pChild, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pType: type or parent type of diobs to get
pChild: true to include all child diobs; false to include only diobs with the exact type of pType
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y tiles around the specified diob that are visible by the diob and that have the same type as pType or a parent type of pType if pChild is enabled
tileRangeViewers(pO, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y tiles around the specified diob that are able to see the diob
tileRangeViewersByType(pO, pType, pChild, pVal1, pVal2)
pO: diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
pType: type or parent type of diobs to get
pChild: true to include all child diobs; false to include only diobs with the exact type of pType
pVal1: either x distance or x and y distance
pVal2: if set, y distance
called: returns an array containing all the diobs on the map within x and y tiles around the specified diob that are able to see the diob and that have the same type as pType or a parent type of pType if pChild is enabled
getLoc(pVal1, pVal2, pVal3)
pVal1: first value of function
pVal2: second value of function
pVal3: third value of function
called: returns a tile of a given location; if pVal1 and pVal2 are numbers and pVal3 is a string, it returns the tile at the coordinates pVal1, pVal2 on the map pVal3; if pVal1 is an object and not a tile, it returns the object's location; if pVal1 is a tile, it returns the tile back
createMap(pName, pX, pY)
pName: unique name of the map
pX: amount of tiles on the x-axis
pY: amount of tiles on the y-axis
called: creates a new map with the name pName and a size of pX, pY
cloneMap(pMap, pName, pFunc)
pMap: name of the map file to clone
pName: name to give the new cloned map
pFunc: optional; function to call once the clone is finished
called: creates a new map which is a clone of a map file
getDiobs(pMap, pType, pChild)
pMap: name of the map to get diobs from
pType: optional; string containing type path to return
pChild: optional; boolean that determines if child types are included
called: returns an array of diobs on the map pMap depending on the provided arguments; if pType is not set, all diobs on the map will be returned; if pType is set but pChild is not, diobs on the map with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs on the map will be returned
getTiles(pMap, pX, pY, pW, pH)
pMap: name of the map to get tiles from
pX: starting x coordinate
pY: starting y coordinate
pW: optional; number of tiles to get from the right of pX; negative numbers to get tiles from the left
pH: optional; number of tiles to get from above pY; negative numbers to get tiles from above
called: returns the tiles on pMap within the specified area
getMapSize(pMap)
pMap: name of the map to get the size of
called: returns an object {'x': x, 'y': y} containing the number of x and y tiles on the map
Macro
desc: static object with various macro operations
static functions:
newMacroAtlas(pName)
pName: name of the new macro atlas
called: creates a new blank macro atlas named pName
newMacro(pName, pAtlas, pKey, pDown, pUp)
pName: name of the macro to create
pAtlas: name of the macro atlas to add the new macro to
pKey: key code that will execute this macro
pDown: optional; string containing the command to execute when the key is pushed down; example 'test(1)' would execute the client command 'test' with one parameter that is equal to '1'
pUp: optional; string containing the command to execute when the key is let go of; example 'test(1)' would execute the client command 'test' with one parameter that is equal to '1'
called: creates a new macro with the keyUp command pUp, and keyDown command pDown, and the name pName and adds it to the macro atlas pAtlas
removeMacro(pName, pAtlas)
pName: name of the macro to remove
pAtlas: name of the macro atlas to remove the macro from
called: removes the macro pName from the macro atlas pAtlas
getMacroAtlasNames()
called: returns an array containing the names of all the currently loaded macro atlases
getMacroNames(pAtlas)
pAtlas: name of the macro atlas
called: returns an array containing the names of all the macros in the macro atlas pAtlas
Type
desc: static object with various type operations
static functions:
addInheritance(pType, pInherit)
pType: type to add inheritance to
pInherit: type to inherit from
called: makes the type pType inherit from the type pInherit; this change only works for newly created objects, objects already in existence will not change
removeInheritance(pType, pInherit)
pType: type to remove inheritance from
pInherit: type of inheritance
called: removes the inheritance pInherit from the type pType; this change only works for newly created objects, objects already in existence will not change
getInheritances(pType)
pType: type to get inheritances of
called: returns an array of the type pType custom inheritances
getTypes(pParent)
pParent: optional; parent type to start with
called: returns an array of all diob types in the game; if pParent is set, only child types of pParent are returned
isType(pType, pType2)
pType: type to check
pType2: optional; type to check against called: checks to see if pType is a valid type that exists in the game; if pType2 is defined, checks if pType is pType2 or a child of pType2
setFunction(pType, pName, pFunc)
pType: type to set function for
pName: string containing the name of the function
pFunc: function
called: sets the type pType's pName function to pFunc; this change only works for newly created objects, objects already in existence will not change
setVariables(pType, pVars)
pType: type to set variables for
pVars: object containing new variables and their values
called: sets the type pType's default variables specified within the pVars object; example {'a': 1, 'b': 2} would set this type's 'a' and 'b' variables respectively
getVariable(pType, pVar)
pType: type to get variable of
pVar: name of the variable to get
called: returns the default value of the pVar variable belonging to the type pType
newType(pType)
pType: type to create
called: creates a new type called pType
callFunction(pType, pFunc, pDiob, pArgs)
pType: type to call function of
pFunc: name of function to call
pDiob: object to call function with; the this in the function call will be htis object
pArgs: array of arguments to pass in
called: calls the function pFunc attached to the type pType as if the function belonged to the object pDiob using the arguments pArgs
arrays:
desc: arrays are declared with brackets, for example 'var a = [0, 1, 2, 'test']' creates an array called 'a' that contains three numbers and a string
variables:
length: holds the length of the array
functions:
indexOf(pValue, pStart)
pValue: array element to find the index of in the current array
pStart: optional; what index to start from
called: returns the index of the first occurence of pValue in the current array; returns -1 if not found
lastIndexOf(pValue, pStart)
pValue: array element to find the last index of in the current array
pStart: optional; what index to start from
called: returns the index of the last occurence of pValue in the current array; returns -1 if not found
sort()
called: sorts array
reverse()
called: reverses array
slice(pStart, pEnd)
pStart: the index to start the slice on; 0 for first index, negative numbers for number of indexes from the end of the array
pEnd: the index to end the slice on; negative numbers for number of indexes from the end of the array; blank for end of array
called: returns a new array containing the elements from pStart to pEnd
concat(pValues)
pValues: an element or list of elements to add to the new array; can be more than one variable
called: returns a new array containing the original array plus the new elements
join(pSeparator)
pSeparator: character or string to separate each array element by
called: returns a string containing all elements of an array separated by pSeparator
unshift(pValues)
pValues: an element or list of elements to add to the current array; can be more than one variable
called: adds pValues to the start of the array and returns the new array length
shift()
called: removes the first element of the array and returns the removed element
push(pValues)
pValues: an element or list of elements to add to the end of the current array; can be more than one variable
called: adds pValues to the end of the current array and returns the new array length
pop()
called: removes the last element of the current array and returns that element
splice(pIndex, pNum, pValues)
pIndex: the index to start the splice; 0 for first index, negative numbers for number of indexes from the end of the array
pNum: numbers of elements to remove starting at pIndex
pValues: optional; an element or list of elements to add to the current array at pIndex after removing; can be more than one variable
called: removes pNum amount of elements starting at pIndex then adds pValues at that location and finally returns an array of the removed elements
every(pFunc)
pFunc: function to call for every element in the array
called: calls the function pFunc for every element in the array and returns true if every function call returns true; the pFunc function is called with three parameters, the first is the element value being used, the second is the element index, the third is the entire array
some(pFunc)
pFunc: function to call for every element in the array
called: calls the function pFunc for every element in the array and returns true if at least one function call returns true; the pFunc function is called with three parameters, the first is the element value being used, the second is the element index, the third is the entire array
map(pFunc)
pFunc: function to call for every element in the array
called: calls the function pFunc for every element in the array and returns a new array containing only the new elements after being passed into pFunc; the pFunc function is called with three parameters, the first is the element value being used, the second is the element index, the third is the entire array
filter(pFunc)
pFunc: function to call for every element in the array
called: calls the function pFunc for every element in the array and returns a new array containing only the elements that returned true when passed into pFunc; the pFunc function is called with three parameters, the first is the element value being used, the second is the element index, the third is the entire array
strings:
desc: strings contain text and are surrounded by either quotation marks (') or double quotation marks (") there are no restrictions to what text can be inside of a string
variables:
length: holds the length of the string
functions:
charAt(pIndex)
pIndex: index of the string to get char of
called: returns the character at the index pIndex of the string
charCodeAt(pIndex)
pIndex: index of the string to get charCode of called: returns the character code of the character at the index pIndex of the string
concat(pValues)
pValues: a string or list of strings to add to the end of the new array; can be more than one variable
called: returns a new string containing the current string with the new string(s) of pValues on the end of it
indexOf(pValue, pStart)
pValue: string to find the index of in the current string
pStart: optional; what index to start from
called: returns the index of the first occurence of pValue in the current string; returns -1 if not found
lastIndexOf(pValue, pStart)
pValue: string to find the last index of in the current string
pStart: optional; what index to start from
called: returns the index of the last occurence of pValue in the current string; returns -1 if not found
match(pRegex)
pRegex: regex to use to find patterns with
called: checks the string for regex matches; returns an array of patterns found or null for not found
replace(pValue, pNew)
pValue: string or regex pattern to use to replace
pNew: string to replace each occurence of pValue with
called: returns a new string with the replaced strings
slice(pStart, pEnd)
pStart: the index to start the slice from; negative numbers for the number of indexes from the end of the string
pEnd: optional; the index to end the slice; negative numbers for the number of indexes from the end of the string
called: returns a new string containing the sliced out string
split(pSeparator, pLimit)
pSeparator: the value to split the string by
pLimit: optional; the number of splits to perform before stopping; anything after will not be included in the new array
called: splits the current string at every occurence of pSeparator without doing so more than pLimit times and returns an array containing the split strings
substr(pStart, pLength)
pStart: index of where to start getting the substring from; negative numbers for the number of indexes from the end of the string
pLength: optional; how many characters to get; default is rest of the string
called: returns a substring of the current string containing the characters starting from the index pStart to the end of the string or up to pLength characters
toLowerCase()
called: returns a new string containing the current string with all characters lowercased
toUpperCase()
called: returns a new string containing the current string with all characters uppercased
trim()
called: returns a new string containing the current string with all whitespace removed from the start and end of the string
WebBox
desc: web boxes are a type of interface which interface objects can have which can contain certain HTML and some special VS web code; each web box is given a unique id that can be used to set the style of the entire box, #wb_interfacename_elementname where interfacename is the name of the interface and elementname is the name of the element with the web box; #ti_interfacename_elementname for text boxes
allowed tags: 'SPAN', 'IMG', 'A', 'DIV', 'BR', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'STRONG', 'EM', 'UL', 'OL', 'LI', 'B', 'U', 'I', 'P', 'SECTION', 'TIME', 'PRE', 'INPUT', 'TEXTAREA'
allowed attributes: 'style', 'id', 'href', 'src', 'class', 'datetime', 'contenteditable', 'value'
events: events may execute client commands; for example onMouseDown='command:test(1, 2)'; you can pass the event object by typing 'event' as a parameter, for example onKeyDown='command:test(1, event)' will pass an event object containing information about the mouse or key used
allowed events: 'onMouseDown', 'onMouseUp', 'onMouseMove', 'onMouseClick', 'onMouseDblClick', 'onMouseEnter', 'onMouseExit', 'onKeyDown', 'onKeyUp'
A href: href of an A tag may contain a client command which will be executed when the link is clicked; for example href='command:test(1, 2)' would execute the client command 'test' with the parameters 1 and 2 when the link is clicked
IMG src: src of an IMG tag may contain a diob ID which uses that diob's icon for the display; for example src='diob:id', where 'id' is the id of the diob to use, would use that diob's icon for the image
Custom fonts:
desc: you can add and use custom fonts with CSS; set the client's web style and add:
@font-face {
font-family: "fontName";
src: url("http://path.to/font");
}
and then use that 'fontName' either in your CSS or in your textStyle properties
Code tags:
desc: code tags are started with '#' and are used to tell the builder what to do
tags:
#BEGIN CLIENTCODE
desc: all the code under this tag will be put into the multi-player client source; includes all code until #END CLIENTCODE or the end of the file
#END CLIENTCODE
desc: ends the client code
#BEGIN SERVERCODE
desc: all the code under this tag will be put into the multi-player server source; includes all code until #END SERVERCODE or the end of the file
#END SERVERCODE
desc: ends the server-only code
#BEGIN JAVASCRIPT
desc: all the code under this tag will be put into JavaScript file on the client side; includes all code until #END JAVASCRIPT or the end of the file
#END JAVASCRIPT
desc: ends the JavaScript code
#BEGIN IGNORECODE
desc: all code under this tag will be ignored by the builder until either #END IGNORECODE or the end of the file
#END IGNORECODE
desc: ends the ignored code
#DISABLE DEBUG
desc: code will no longer be built with trys and catches to find bugs that would crash the execution and throw a descriptive error; disabling debug mode will reduce the size of the built project and increase the speed of code execution, but any glitches will crash the execution and not display any specific error messages; disabling this should only be used for fully polished projects that are ready to get as much as they can out of optimization and performance improvements
#ENABLE LOCALCLIENTCODE
desc: merges the local code with client code so that client code is ran when playing solo; the server will still not be given client code with this setting enabled
#ENABLE LOCALSOCKETS
desc: enable sockets when the game is running locally (in single player mode) so you can communicate directly with any server
#INCLUDE SCRIPT url
desc: allows you to include a remote JavaScript script into the project, replace 'url' with the path to the file
#INCLUDE STYLE url
desc: allows you to include a remote CSS file into the project, replace 'url' with the path to the file
#DEFINE name(params) value
desc: allows you to specify special code that is translated during build, 'name(params)' where (params) is optional is translated into 'value' where ever 'name(params)' is found in the code; ex: '#define MAX 5' would turn all instances of 'MAX' in the code into '5' during build
CLIENTCODE:
desc: client-side code is code executed on the client-side of a multi-player game; client-side code is specified using the code tag #BEGIN CLIENTCODE and the code can consist of what normal game code can, with the exception that you cannot declare or set World values and you cannot define new object types that do not exist in the normal code. Client code can communicate with the server code, and vice versa, by using the client.sendCommand function.
JavaScript:
desc: you may include any JS code in your project by wrapping the code in the #BEGIN JAVASCRIPT and #END JAVASCRIPT code tags. In the JS code itself, you can communicate with the VS engine using the static global object called VS; VS.global.funcName to access a VS global function, VS.global.varName to access a VS global var, VS.World to access the static object World (and so on for the other static objects), VS.newDiob to create new diobs, VS.delDiob to delete diobs, then if you create a reference to a diob/object in JS, you can run/access things the same way you would in VS