-
Introduction
-
This feature is primarily of interest to some 'power users' and even programmers
The usual way to create graphical or text-based TileSets in
TileSet Creator for TileTag
is to create and edit the TileSets within TileSet Creator.
From version 1.0, Build # 001-000-0093 on, TileSet Creator also
supports an extra method of creating TileSets. You can write an ASCII
text file that specifies a TileSet. TileSet Creator can import
this text file to create a TileSet based on the text file.
-
Text File Naming
-
Your text file should have the .txt file extension.
This helps TileSet Creator to recognize it as a text file.
-
Text File Format
-
Below is shown the contents of a file that defines a TileSet
in which 'uno' matches 'one', 'dos' matches 'two', and 'tres' matches 'three'.
# First character on first line is the comment-line marker character.
uno
one
dos
two
# Note to myself: should I have an accent over the 'e' in 'tres'?
tres
three |
It might be smart to put some kind of comment line between each pair,
to help you proofread more easily.
# This file defines a TileSet Creator TileSet for:
# Three Spanish-language numbers.
uno
one
#
dos
two
# Note: I do NOT need an accent over the 'e' in 'tres.'
tres
three
|
Special characters
The first line of the text file defines special characters.
- The first character on the first line becomes the comment character.
Any line beginning with the comment character is ignored by TileSet Creator
when building the TileSet.
- The second and third characters on the first line can define a 'newline' character.
This 'newline' definition only happens if neither of these characters is a space or a forward slash.
If the 'newline' character is defined, you can use it to split
a tile's text into multiple lines of text.
Here is an example of a simple TileSet in which some tiles have multiple lines of text.
#\\ So now \\ becomes a newline in the TileSet.
#
Hello I have one line of text.
1
Hello I have\\two lines.
#
2
I have\\three\\lines.
3
|
In the text file shown below, any line starting with *
becomes a comment line ignored by TileSet Creator.
The reason is that *
is the first character of the text file.
* This TileSet will teach people the difference between
* the American and British pound signs.
*
* I separate each matching pair with my comment character *
#
American pound sign
*********************************************
£
British pound sign
*********************************************
$
dollar sign
*********************************************
¥
yen sign
|
-
Converting a Text File to a TileSet
-
In TileSet Creator, use the File - Open dialog to open the text file.
To open a .txt file, you can
-
either:
-
type the file's entire filename or pathname
in the "File name" box, and press the ENTER key.
-
or:
-
in the Open dialog's "Files of type:" box you can select "All Files"
to make the dialog display .txt files.
Then you can click or double-click them in the dialog.
Once you have opened the text file in TileSet Creator, you can look at the TileSet and check that
it has been imported without errors. If you have made a formatting error in
your text file you will be able to detect it at this point by its effect on the
TileSet.
If the TileSet is satisfactory, save it from TileSet Creator
as a normal TileSet file so you can use it in TileTag.
-
Writing Programs that Automatically Generate a TileSet-Specifying Text File
-
If you are a skilled computer programmer, you may find it most convenient
to generate some kinds of TileSets by writing a computer
program to output the TileSet data into a text file.
Below is an example of a Perl script that generates a multiplication table.
#!/usr/local/bin/perl
#
# PERL SCRIPT TO GENERATE MULTIPLICATION TABLE FOR INTEGERS 2...9
#
# (This script can only be run by using a Perl interpreter.)
#
# This script prints out a comment line starting with #
# and follows it with a multiplication table,
# consisting of lines of the form: a x b
# each followed by a line having the product of a and b.
print "# Multiplication table for numbers 2 through 9.\n";
for ($i=2; $i<=9; ++$i) {
for ($j=2; $j<=9; ++$j) {
print $i, " x ", $j, "\n";
print $i*$j, "\n";
}
}
|
Below is an example of a BASIC program to generate a multiplication table.
It might need to be slightly modified to run on your particular system.
10 REM GENERATE MULTIPLICATION TABLE FOR INTEGERS 2...9
20 PRINT "# Products of numbers 2 through 9."
30 FOR I=2 TO 9
40 FOR J=2 TO 9
50 PRINT I;" x ";J
60 PRINT I * J
70 NEXT J
80 NEXT I
|