12. Constants

Description

At different places in DestinyScript specific numbers are required. But some values are hard to memorize. Hence you should use constants (these are names which represent the specified numbers). If you write the name of the constant instead of the number it represents then the result will be the same.

List of constant groups

Because the most constants belong together they are grouped here.
ObjectsGroup nameShort description
LogicSwitch valuesThe values 0 and 1
Math/ConvertAngle formatsAngle formats for angle methods
StringSpecial charsSpecial chars that you can't write in DestinyScript
ErrorErrorsThe error constants
KeyboardVirtual keycodesThe keys of the keyboard (and the buttons of the mouse)
KeyboardKey stateThe possible key states
Map-/EventSpecial events"Special" events (hero, boat, ...)
Map-/EventDirectionsUp, down, left and right
PictureActionsActions of the pictures
Client/ServerSocket stateThe possible states of a socket
Client/ServerSocket typeThe possible types of a socket
Client/FileData typesThe data types of the Destiny.dll
ServerSocket choiceThe next free socket
FileFile modeModes for opening files
DirectoryFile attributesAttributes of files and directories

Switch values

Description

This constants are very important, because they represent the boolean values.

Constants

ConstantValueDescription
False0Switch state: OFF
True1Switch state: ON

Angle formats

Description

This constants define the angle formats. A more specific description can be found at the Sin method of the Math object.

Constants

ConstantValueDescription
DEG1For angles with 360 units in a full circle (= degree)
RAD2For angles with π units in a full circla (= radiant)
GRAD3For angles with π units in a full circle (= grad)
RPG4For angles with 256 units in a full circle (= RPG-Maker specific)

Special chars

Description

This constants define string values, which could not be written in DestinyScript.

Constants

ConstantValueDescription
CRASCII char no. 13CarriageReturn
LFASCII char no. 10LineFeed
CRLFASCII char 13 and 10A line break under windows
QUOTE"Double quotes

Errors

Description

This constants define the error numbers.

Constants

ConstantValueDescription
ERROR_UNKNOWN0See description of the error
ERROR_SYNTAX1See description of the error
ERROR_NOVALUE2See description of the error
ERROR_UNKNOWNNAME3See description of the error
ERROR_CONVERT4See description of the error
ERROR_READONLY5See description of the error
ERROR_ARRAYBOUND6See description of the error
ERROR_RANGE7See description of the error
ERROR_MEMORY8See description of the error
ERROR_VALUE9See description of the error
ERROR_BINARYFLOAT10See description of the error
ERROR_CALCSWITCH11See description of the error
ERROR_CALCSTRING12See description of the error
ERROR_FLOATERROR13See description of the error
ERROR_FLOATLENGTH14See description of the error
ERROR_DIVISIONBYZERO15See description of the error
ERROR_STRINGFORMAT16See description of the error
ERROR_STRINGRANGE17See description of the error
ERROR_PICTURE18See description of the error
ERROR_PIXELRANGE19See description of the error
ERROR_SAMEPICTURE20See description of the error
ERROR_PALETTERANGE21See description of the error
ERROR_SOCKETSTARTUP22See description of the error
ERROR_NOFREESOCKET23See description of the error
ERROR_CANTCREATESOCKET24See description of the error
ERROR_SOCKETSTILLOPEN25See description of the error
ERROR_SOCKETNOTOPEN26See description of the error
ERROR_CANTCONNECT27See description of the error
ERROR_SOCKETTYPE28See description of the error
ERROR_SOCKETERROR29See description of the error
ERROR_OOB30See description of the error
ERROR_STRINGTOOLONG31See description of the error
ERROR_NOFREEFILEHANDLE32See description of the error
ERROR_CANTRESOLVEPATH33See description of the error
ERROR_NOPERMISSION34See description of the error
ERROR_CANTOPENFILE35See description of the error
ERROR_FILENOTOPEN36See description of the error
ERROR_CANTACCESSFILE37See description of the error
ERROR_CANTCREATEDIR38See description of the error
ERROR_CANTREMOVEDIR39See description of the error
ERROR_CANTRENAMEFILE40See description of the error
ERROR_CANTCOPYFILE41See description of the error
ERROR_CANTDELETEFILE42See description of the error
ERROR_CANTREADATTRIBUTES43See description of the error
ERROR_CANTWRITEATTRIBUTES44See description of the error
ERROR_SEARCHSTILLOPEN45See description of the error
ERROR_CANTSTARTSEARCH46See description of the error
ERROR_NOSEARCHSTARTED47See description of the error

Virtual keycodes

Description

This constants define the values for keys. (Usually this whould be much more constants, but they are removed because this constants are for very special keyboard layouts)

Constants

ConstantValueDescription
VK_DOWN40Arrow down key
VK_LEFT37Arrow left key
VK_RIGHT39Arrow right key
VK_UP38Arrow up key
VK_CONTROL17Ctrl key
VK_MENU18Alt key
VK_RETURN13Enter key
VK_SHIFT16Shift key
VK_SPACE32Space
VK_LBUTTON1Left mouse button
VK_MBUTTON4Middle mouse button
VK_RBUTTON2Right mouse button
VK_NUMPAD096Numeric pad 0
VK_NUMPAD197Numeric pad 1
VK_NUMPAD298Numeric pad 2
VK_NUMPAD399Numeric pad 3
VK_NUMPAD4100Numeric pad 4
VK_NUMPAD5101Numeric pad 5
VK_NUMPAD6102Numeric pad 6
VK_NUMPAD7103Numeric pad 7
VK_NUMPAD8104Numeric pad 8
VK_NUMPAD9105Numeric pad 9
VK_MULTIPLY106Numeric pad multiply
VK_ADD107Numeric pad add
VK_SUBTRACT109Numeric pad subtract
VK_DECIMAL110Numeric pad decimal separator
VK_DIVIDE111Numeric pad divide
VK_0480 key
VK_1491 key
VK_2502 key
VK_3513 key
VK_4524 key
VK_5535 key
VK_6546 key
VK_7557 key
VK_8568 key
VK_9579 key
VK_A65A key
VK_B66B key
VK_C67C key
VK_D68D key
VK_E69E key
VK_F70F key
VK_G71G key
VK_H72H key
VK_I73I key
VK_J74J key
VK_K75K key
VK_L76L key
VK_M77M key
VK_N78N key
VK_O79O key
VK_P80P key
VK_Q81Q key
VK_R82R key
VK_S83S key
VK_T84T key
VK_U85U key
VK_V86V key
VK_W87W key
VK_X88X key
VK_Y89Y key
VK_Z90Z key
VK_BACK8Backspace key
VK_CAPITAL20Capslock key
VK_NUMLOCK144Numlock key
VK_SCROLL145Scroll lock key
VK_DELETE46Del key
VK_END35End key
VK_ESCAPE27Escape key
VK_HOME36Home key
VK_INSERT45Ins key
VK_PAUSE19Pause key
VK_PGDN34Page down key
VK_PGUP33Page up key
VK_PRINT44Print key
VK_TAB9Tab key
VK_F1112F1 key
VK_F2113F2 key
VK_F3114F3 key
VK_F4115F4 key
VK_F5116F5 key
VK_F6117F6 key
VK_F7118F7 key
VK_F8119F8 key
VK_F9120F9 key
VK_F10121F10 key
VK_F11122F11 key
VK_F12123F12 key

Key states

Description

This constants are used to specify a key state. This constants can't be used to query a key state!

Constants

ConstantValueDescription
KEYEVENTF_KEYDOWN0The key is pressed
KEYEVENTF_KEYUP2The key is released

Special events

Description

This constants are used to access special events (hero, boat, ship, airship or the current event) with the Event or Mapevent object.

Constants

ConstantValueDescription
THIS10005The current event
HERO10001The hero event
BOAT10002The boat event
SHIP10003The ship event
AIRSHIP10004The airship event

Directions

Description

This constants are used to identify the direction of an event.

Constants

ConstantValueDescription
DIR_UP0Direction: Up
DIR_RIGHT1Direction: Right
DIR_DOWN2Direction: Down
DIR_LEFT3Direction: Left

Actions

Description

This constants are used to identify the action of a picture.

Constants

ConstantValueDescription
ACTION_NONE0No action
ACTION_ROTATION1Rotation effect
ACTION_RIPPLE2Ripple effect

Socket states

Description

This constants are used to identify the state of a socket (client/server).

Constants

ConstantValueDescription
STATE_CLOSED0The socket is closed
STATE_CONNECTED1The (client) socket is connected
STATE_LISTENING2The (server) socket wait for incoming connections
STATE_ERROR-1The socket reports an error

Socket type

Description

This constants are used to identify the type of a socket (client/server).

Constants

ConstantValueDescription
SOCK_DESTINY0The socket is a DestinySocket (hence it uses the DestinyProtocol)
SOCK_RAW1The socket is a RAW socket (hence it uses not a specific protocol)

Data types

Description

This constants are used to specify the data types.

Constants

ConstantValueDescription
TYPE_VARIABLE1Data type: variable
TYPE_SWITCH2Data type: switch
TYPE_DWORD3Data type: dword
TYPE_DOUBLE4Data type: double
TYPE_STRING5Data type: string
TYPE_BYTE6Data type: byte
TYPE_WORD7Data type: word

Socket choice

Description

This constant is used to use the next free socket for incoming connections.

Constants

ConstantValueDescription
NEXT_FREE_SOCKET-1The next free socket will be used

File modes

Description

This constants are used to specify the mode for opening files. This constants can be combined using the binary OR operator.

Constants

ConstantValueDescription
FILE_READ1Data can be read
FILE_WRITE2Data can be written
FILE_APPEND6Data can be written and the file pointer starts at the end of the file

File attributes

Description

This constants are used to specify the attributes of a file/directory. This constants can be combined using the binary OR operator.

Constants

ConstantValueDescription
FILE_ATTRIBUTE_ARCHIVE32A file/directory has the archive flag
FILE_ATTRIBUTE_DIRECTORY16A "e;thing"e; is a directory and not a file
FILE_ATTRIBUTE_HIDDEN2A file/directory is hidden
FILE_ATTRIBUTE_NORMAL128A file/directory has no special attributes
FILE_ATTRIBUTE_READONLY1A file/directory can only be read
FILE_ATTRIBUTE_SYSTEM4A file/directory is a part of the operating system