9. Objects

Description

Objects are that what represents the DestinyPatch. All functions and properties of the RPG-Maker 2000 game (and even those of the Destiny.dll) are bunched into objects. These functions (further called methods) and properties can be accessed via the relevant object. For example you can access the keyboard using the Keyboard object. So you can use the object to check the key states. As already said an object can contain two types of content: methods and properties. Those content types are formatted differently. Methods are always write-protected, properties only sometimes (see the definition of the relative property).

Syntax

The syntax to call an object is always the same:
1
2
3
4
5
$
v[1] = Objectname.Functionname(Parameter1, ...);
Objectname.Functionname(Parameter1, ...);
v[2] = Objectname.Propertyname;
v[3] = Objectname[Index].Propertyname
In this example you see several ways to access the content of an object. One thing is always the same: first you write down the object name, then a dot and at last the function or property name. Between this identifiers you may not use any spaces.
If you call a method (Line 2) you must add a pair of parentheses which must be written directly after the method name (this means without spaces). Inside of these parentheses you write the parameters (if there are some). To separate the parameters you use the comma. If you call a method you must always write down the parentheses even if the method has no parameters! The result of the method (= return value) can be used in a formula (e. g. the return value will be stored into variable no. 1 at line 2).
Sometimes a method has no return value (Line 3). In this case you can't access its return value in formulas.
If you access a property (Line 4) you do it like a method call (but without the parentheses and the parameters).
Some objects or properties have an index (Line 5). This index identifies which element of the object/property should be accessed. The index is written into a pair of brackets [ ]. Like the parentheses they are written directly after the object name/property name (this means without spaces). If an index has more than one dimension (e. g. a two dimensional array) then you separate the indices with a comma.
Information
If a data type in a parameter differs from the specified one (e. g. the data type string is required and the data type dword is used) then the used parameter is converted to the required data type automatically (e. g. dword is converted into string). You needn't to call an extra conversion method. (Example: v[1] = String.Length(d[1]); )

Examples

1
2
3
4
5
6
7
8
$
v[1] = Keyboard.GetKey();
Keyboard.SetKeyState(VK_RIGHT, KEYEVENTF_KEYDOWN);
v[2] = Time.Day;
v[3] = Picture[1].Width;
v[4] = Map.Lower[2, 3];
v[5] = 5 - Math.Abs(v[6]);
Mouse.X = 10
In line 2 is a habitually method call (without parameters). The return value (in this case it is the last pressed key) will be stored into the variable no. 1.
In line 3 is a method without return value (but with parameters) called (in this case the key state will be set).
In line 4 a property is requested. The property value (in this case the number of the current day of the month) will be stored into variable no. 2.
In line 5 a property of an object is requested which requires an index. The property value (in this case the width of picture no. 1) will be stored into variable no. 3.
In line 6 the value of a property (which has a two dimensional index) of an object is requested. The property value (in this case number of the chip at position 2, 3) will be stored into variable no. 4.
In line 7 a method is called (with parameters) inside of a formula. The return value of the method (in this case the absolute value of variable no. 6) will be subtracted from the number 5 and then stored into variable no. 5.
In line 8 the value 10 will be assigned to the property of an object (in this case the x coordinate of the mouse cursor).
Information
The upper/lower case of object/method/property names are irrelevant. OBJECTNAME.PROPERTY, objectname.property or even oBjEcTnAmE.PrOpErTy cause all the same.

Alphabetical list of objects

ObjectnameShort description
ActorList of heroes
ClientConnections via internet/network
Convertconverting of different data types
DestinyCurrent options of the Destiny.dll
DirectoryListing directories and abstract file system operations
ErrorHandling of single errors
ErrorsHandling of all errors
EventList of events (EventID)
FileReading/writing files
GameThe current game
KeyboardKey queries
LogicLogical operations and comparisons
MapCurrent map
MapEventList of events (serially numbered)
MathMiscellaneous mathematical functions
MouseCursor position
PictureList of pictures
ServerIncoming connections via internet/network
StringMiscellaneous string functions
TimeTime queries