14. Appendix

Description

Here shall some technical details about the Destiny.dll be descripted. Currently this is only the design of the DestinyProtocol.

DestinyProtocol

Description

The DestinyProtocol has been developed by Bananen-Joe for the RPG-Maker. It offers the basic functions for transmitting variables, switches, dwords, doubles, words, bytes and strings. These are all associated with an id.

Assembly of a DestinyProtocol command

XX IIIIIIII VV...
The assembly is simple. At first there will be 1 byte sent as command (red). This command decides the format and the length of the value. The first parameter of the command is a dword value (little endian), which contains the associated id (blue). The second parameter of the command contains the value of the data type (purple).

List of the DestinyProtocol commands

Command (byte)Size (of the value)Format (value)Description
V4Dword, little endian (= 4 bytes total)A variable is sent
S0none (= 0 bytes total)A switch is sent with value 1 (True)
s0none (= 0 bytes total)A switch is send with value 0 (False)
D4Dword, little endian (= 4 bytes total)A dword is sent
F8Double, little endian (= 8 bytes total)A double is sent
W2Word, little endian (= 2 bytes total)A word is sent
B1Byte (= 1 byte total)A byte is sent
A1 + n bytesSee string formatSee string format

String format

The string format doesn't contain numbers. Hence the first byte (after the index) specifies the length of the string. The following bytes are the string. Here you can see the weakness of the format: strings, that are longer than 255 bytes, can't be sent with this format. But this is intended, because the interal buffer of the Destiny.dll has a maximum size of 500 bytes. Otherwise, if the strings could be longer than 500 bytes, it whould not be possible to check if the entire string has been received. This was the simpliest solution to ensure that not too much memory is required.
Furthermore the developer of the code was lazy here. Smiley

Examples

SendVariable

1
2
$
Client[0].SendVariable(1, 2)
The SendVariable example whould create the following data package (Hex-Dump):
56 01 00 00 00 02 00 00 00

SendSwitch

1
2
3
$
Client[0].SendSwitch(100, True);
Client[0].SendSwitch(-200, False)
The SendSwitch example whould create the following data package (Hex-Dump):
53 64 00 00 00
73 38 FF FF FF

SendDword

1
2
$
Client[0].SendDword(10000, 0x12345678)
The SendDword example whould create the following data package (Hex-Dump):
44 10 27 00 00 78 56 34 12

SendDouble

1
2
$
Client[0].SendDouble(0xAABBCCDD, Math.Pi)
The SendDouble example whould create the following data package (Hex-Dump):
46 DD CC BB AA 18 2D 44 54 FB 21 09 40

SendWord

1
2
$
Client[0].SendWord(0x987654, 100)
The SendWord example whould create the following data package (Hex-Dump):
57 54 76 98 00 64 00

SendByte

1
2
$
Client[0].SendByte(0xD0C0B0A0, 3)
The SendByte example whould create the following data package (Hex-Dump):
42 A0 B0 C0 D0 03

SendString

1
2
$
Client[0].SendString(1111111, "Hello")
The SendString example whould create the following data package (Hex-Dump):
41 47 F4 10 00 05 48 65 6C 6C 6F