Swords of Glass message format

From ModdingWiki
Jump to navigation Jump to search
Swords of Glass message format
Format typeText
Text purposeStory
Line endingsNone
Character setCode Page 437
Games

Throughout the Swords of Glass dungeon you will encounter various messages, the first most players see is, "Well, Toto, this doesn't look like Kansas anymore." These messages are stored in the Messages.dat file. Each message is three lines long even if they're not shown. In the data file, a line is 21 bytes long, even if not all of the bytes are used. The first byte of each line is the length of bytes to read from the line. The file is fixed-width and stores 35 three-lined messages.

Data type Description
UINT8 Message length The number of characters to read from the message line.
char[20] Name The message line.
3 lines per message.
35 messages in the file.

Source Code

Exporter

This FreeBASIC program will export each of the game's messages into a text file.

Dim As Integer MessageNo, LineNo
Dim As String Buffer = Space(20)
Dim As UByte Length

Open "Messages.dat" For Binary As #1
Open "Messages.txt" For Binary As #2

For MessageNo = 0 To 34
	Put #2, , "Message: " + Str(MessageNo) + Chr(13) + Chr(10)

	For LineNo = 0 To 2
		Get #1, , Length
		Get #1, , Buffer
		
		Put #2, , Left(Buffer, Length) + Chr(13) + Chr(10)
	Next LineNo
	
	Put #2, , Chr(13) + Chr(10)
Next MessageNo

Credits

This format was reverse engineered by TheAlmightyGuru. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)