I know that the error occurs there on row 15, but im not sure if the error is in the saving process or the loading, i mean that maybe the map doesent contain 100y?
The problem is in the loading. Heres why: ReadShort (filehandle/stream)
Parameters
filehandle/stream = a valid variable set with the OpenFile, ReadFile command, or OpenTCPStream (v1.52+)
The value returned is an integer in the range 0-65535.
Description
Once you've opened a disk file (or stream) for reading, use this command to read a single short integer (16bit) value from the file. Note, each value written uses 2 bytes of disk space and is written least significant byte first. Reading beyond the end of file does not result in an error, but each value read will be zero.
Parameters
filehandle/stream = a valid variable set with the OpenFile, ReadFile command, or OpenTCPStream (v1.52+)
The value returned is an integer in the range 0-65535.
Description
Once you've opened a disk file (or stream) for reading, use this command to read a single short integer (16bit) value from the file. Note, each value written uses 2 bytes of disk space and is written least significant byte first. Reading beyond the end of file does not result in an error, but each value read will be zero.
Note again the last sentence. ReadShort() WILL NOT FAIL even if your saving code is incorrect, so that is not the problem. The problem is how the map() array is defined.
There must be something you are not showing us. Or something...