10. Error messages
Description
During the execution of a DestinyScript the can occur errors on different places. A list of all errors (and their meanings) is listed here.
List of errors
Description
This error may never occur. It is only here to cover the impossible case.
Description
This error occurs if an invalid char has been used in DestinyScript. This could happen whether there are too much parameters declared (in that case the interpreter want's a closing parenthesis and not a comma).
Example of the error
Description
This error occurs if a value is required but no one is specified. This could be an empty pair of parantheses in a formula or simply a missing term.
Example of the error
Description
This error occurs if a name (this means name of an object, method, property, constant or scope) has been denoted that doesn't exist.
Example of the error
1
2
$
v[1] = Picture[1].Toast
The Picture object has no property with the name "Toast".
Description
This error may never occur. It whould only occur if the interpreter tries to convert a not specified value.
Description
This error occurs if it is tried to write a read-only (this means write-protected) value. Wheter a value is read-only or not is written in its definition.
Example of the error
1
2
$
Destiny.DllVersionMajor = 100
The property "DllVersionMajor" of the Destiny object is declared as read-only.
Description
This error occurs if an invalid index is used. For example if the range is defined as 1 to 100 then all indices less than 1 or bigger than 100 are invalid.
Example of the error
1
2
$
Picture[-1].UseMaskColor = False
The index of the Picture object start with 1. Hence each negative index is invalid.
Description
A data type with a huge value was tried to be converted into a data type with a small range. For example the data type byte allows only values in the range from 0 to 255. So it is not possible to convert a value smaller than 0 or bigger than 255 into a byte.
Example of the error
1
2
3
$
f[1] = Math.Exp(11);
v[1] = f[1]
The error occurs in line 3. f[1] is 100,000,000,000 but the maximum value of dword is 2,147,483,647. Hence it is not possible to store the huge value into the small data type.
Description
There is not enough memory available to execute a command. For example this could happen if it is tried to allocate a string which is some giga bytes long. This error can depend on the used target computer system where the game is running. In this case a reboot of the computer could help.
Example of the error
1
2
3
$
a[1] += a[1] + String.Fill("This is just" +
" a long example string", 1000)
If this DestinyScript is executed in a (endless) loop then a[1] will grow and grow and grow... In theory this could raise the error if there is insufficient memory.
Description
An invalid value has been specified for a parameter. Which values are valid for a parameter is written in the definition of its method. For the most parameters, where ranges are definied, you can use constants.
Example of the error
1
2
$
Server.Listen(1000000, SOCK_DESTINY)
The first parameter of the listen methods specifies the port where the socket will listen on. The range of this port specified as 1 to 65535. The value 1000000 exceeds this range.
Description
This error occurs when it is tried to apply a binary operation (AND, OR, NOT and XOR) with a floating point number. Binary operations are only allowed for integer data types (byte, word and dword).
Example of the error
The used operator is an AND operator and not valid for an operation with the floating point number f[1].
Description
This error occurs if it is tried to calculate with switches. This includes arithmetical and binary operations.
Example of the error
The used operator is an addition operator. Because s[1] is a switch this is invalid.
InformationTo apply logical operations with switches you can use the
Logic object.
Description
This error occurs if it is tried to calculate with strings. This includes arithmetical and binary operations. The only operator, which may be used with strings (additionally to the set operator), is the addition operator which is used to concatenate strings.
Example of the error
1
2
$
a[1] = "Hello Nr. " + 5
Numbers and strings are used in the same calculation. So the addition operator is interpreted as addition and not as concatenation.
InformationTo avoid this error you can convert strings into numbers first (or vice versa). You can use the
Convert object for this.
Description
This error occurs if a floating point operation was invalid. This could happen with (invalid) floating point numbers which are read from a file.
Description
This error occurs if a number (in text form), which is longer than 13 chars, is being converted into a floating point number.
Example of the error
1
2
$
f[1] = 1234567890.1234567890
The number has 10 integer places and 10 decimal places. In sum this are 20 places. This are more than the maximum allowed 13 places.
Description
This error occurs if it is tried to divide trough zero. This is (depending on the laws of mathematics) not possible. In theory it is possible to subtract zero infinite times from any number.
Example of the error
Description
This error occurs if it is tried to convert a string into a number which has an invalid format (this means it doesn't contain (only) a number).
Example of the error
1
2
$
v[1] = "Number: 12345"
The string "Number: 12345" is not a number. Instead "12345" whould be valid.
Description
This error occurs if it is tried to access a position which exceeds the length of a string.
Example of the error
1
2
$
v[1] = String.Ord("Hello", 5)
The string "Hello" has a length of 5 chars. It is tried to access the sixth char (= position 5) with the Ord method.
Description
This error occurs if it is tried to access a picture property, which is only available if the picture has been loaded (e. g. the pixels of a picture).
Example of the error
1
2
$
v[1] = Picture[1].Pixel[0, 0]
If there is no picture loaded as id 1 this will raise an error.
Description
This error occurs if it is tried to access some pixel which exceed the picture's boundaries.
Example of the error
1
2
$
v[1] = Picture[1].FillRect(0, 0, 100, 100)
The error whould occur if the Picture no. 1 whould be smaller than 100 x 100 pixels (e. g. if the picture has a size of 20 x 20 pixels).
Description
This error occurs if it is tried to copy an area from one picture to the same picture.
Example of the error
1
2
$
Picture[1].CopyRect(0, 0, 1, 0, 0, 100, 100)
The error whould occur because the source picture (= 1) is the same as the destination picture (= 1).
Information
To avoid this problem you could load the same picture two times. Then you could copy the area from one picture to the other and then erase the copy.
Description
This error occurs if it is tried to access a palette entry outside the range of 0 to 255.
Example of the error
1
2
$
Picture[1].Palette[256] = 0xFF
The palette entry with the index 256 doesn't exist.
Description
This error whould occur if it is not possible to initialize the socket system. This is an error of the target system, where the game is running. The reason for this error could be a wrong winsock version or an invalid network driver.
Description
This error occurs if there is no more free socket to accept an incoming connection.
Description
This error occurs if it is not possible to create a socket. This is an error of the target system, where the game is running. The reason for this error could be insufficient resources.
Description
This error occurs if it is tried to connect an already connected socket.
Example of the error
1
2
3
$
Client[0].Connect("127.0.0.1", SOCK_DESTINY);
Client[0].Connect("127.0.0.1", SOCK_DESTINY)
If we assume that the first connection whould be established then the second try to establish a connection whould raise this error. To avoid this error it is satisfactory to close the socket with the
Close method before the connection is being established.
Description
This error occurs if it is tried to do an operation which requires a connected socket.
Example of the error
1
2
3
$
Client[0].Close();
Client[0].SendVariable(1, 1)
The error whould occur in line 3, because the socket is closed (line 2). Hence it is not possible to send dara.
Description
This error occurs if it was not possible to establish a connection.
Example of the error
1
2
$
Client[0].Connect("255.255.255.255", SOCK_DESTINY)
It is not possible to connect to the specified address (in this case it is an invalid address).
Description
This error occurs if it is tried to use RAW methods on a DestinySocket or DestinySocket methods on a RAW socket.
Example of the error
1
2
3
$
Client[0].Connect("127.0.0.1", SOCK_DESTINY);
Client[0].SendRawData("Hello", 5)
The error whould occur in line 3 because the socket type is DestinySocket and the SendRawData method is only for RAW sockets.
Description
This error occurs if the socket system reports an error. This is a problem of the target system, where the game is running. The reason could be insufficient resources.
Description
This error occurs if a DestinySocket receives invalid data (out of band). This could occur if a DestinySocket connects to a RAW socket (or vice versa).
Information
The DestinyProtocol has no error handling. Hence a connection must be closed an re-established if such an error occurs. Usually the used TCP/IP protocol avoids the arrival of invalid data packages (because the TCP/IP protocol has its own error handling).
Description
This error occurs if a string with a length greater than 255 bytes shall be sent over a DestinySocket.
Example of the error
1
2
$
Client[0].SendString(1, String.Fill("Bla", 500))
The error whould occur because the string, which shall be sent, is greater than 255 bytes (the length is 1500 bytes total).
InformationTo avoid this error you could split the string into 255 char pieces (e. g. with the
SubStr method). Next you send the first piece with the string id. Finally you send the other pieces with id 0. The receiving socket could append all received strings with id 0 to the last string id that was received.
Description
This error occurs if it is tried to open a file although the used file handle is already open.
Example of the error
1
2
3
$
File[0].Open("Test.txt", FILE_WRITE);
File[0].Open("Test2.txt", FILE_WRITE)
The error whould occur in line 3, because the used file handle (= 0) is already open (line 2).
Description
This error occurs if it was not possible to resolve the path. This is an error of the target system, but could occur in theory with invalid paths.
Description
This error occurs if it was tried to access a file or folder, which is outside of the game directory.
Example of the error
1
2
$
Directory.DeleteFile("C:\NTLDR")
Unless the game is running in C:\ (and this whould be stupid) this whould raise an error. Otherwise (if this whould be possible) an execution of this command could waste the computer system after a reboot. This is the reason why file/directory access is only allowed inside of the game directory.
Description
This error occurs if an file couldn't be opened. The reason could be that the file is already opened by an other program, because an not existing file is being opened only with read access, because the file name includes invalid chars, ...
Example of the error
1
2
3
$
File[0].Open(
"Filenames may not contain ?.txt", FILE_READ)
The error occurs because filenames may not contain question marks.
Description
This error occurs if a method is called which requires an open file handle, but the used file handle is not open.
Example of the error
1
2
3
$
File[0].Close();
File[0].WriteRawData(12345, TYPE_DWORD)
The error whould occur in line 3, because the file handle is closed (line 2).
Description
This error occurs if a read/write command on a file handle fails. This depends on the target system, where the game is running. The reason could be insufficient free disk space.
Description
This error occurs if it was not possible to create a directory. This depends on the target system, where the game is running. The reason could be insufficient free disk space or an other file/directory with the same name already exists.
Description
This error occurs if it was not possible to remove a directory. Additionally to reasons of
ERROR_CANTCREATEDIR the reason could be that the directory, which shall be removed, isn't empty (so it contains files/directories).
Description
This error occurs if it was not possible to rename/move a file/directory. This depends on the target system, where the game is running. The reason could be insufficient free disk space or that already a file/directory exists with the target name.
Description
This error occurs if it was not possible to copy a file. This depends on the target system, where the game is running. The reason could be insufficient free disk space or that already a file/directory exists with the target name.
Description
This error occurs if it was not possible to delete a file. This depends on the target system, where the game is running. The reason could be that the file is marked as read-only or that already a file/directory exists with the target name.
Description
This error occurs if it was not possible to retrieve the attributes of a file/directory. This depends on the target system, where the game is running. The reason could be that the user has not the required rights to access the file/directory.
Description
This error occurs if it was not possible to set the attributes of a file/directory. This depends on the target system, where the game is running. The reason could be that the user has not the required rights to access the file/directory.
Description
This error occurs if it is tried to open a new directory browsing while an other is still open.
Example of the error
1
2
3
$
Directory.FindFirst("*.*");
Directory.FindFirst("*.*")
The error whould occur in line 3, because the browsing is still open (since line 2).
Description
This error occurs if it was not possible to open a directory browsing. The reason could be an invalid search pattern or an invalid path.
Example of the error
1
2
$
Directory.FindFirst("|\*.*")
The error occurs because there is no directory with the name | (in fact this is not possible, because a file/directory may not contain | in its name).
Description
This error occurs if it is tried do retrieve the next browse result, but no directory browsing was started.
Example of the error
1
2
3
$
Directory.FindClose();
a[1] = Directory.FindNext()
The error whould occur in line 3, because the directory browsing is closed (line 2).