Overview


AutoTroll offers some special syntax to its Script Language for creating web sites. You can create as many web templates as you wish. You simply save them in the web templates\ directory with a ".atf" file extension and AutoTroll will recognize them. Web templates are similar to e-mail templates, but whereas e-mail templates are sent via e-mail to the player in response to a message the player sends, web templates are created and sent to your website for anybody to view. By putting template variables in an HTML form, you can create a website with all the information about your games and players.

When web templates are executed
Web templates are executed or checked anytime AutoTroll's database changes. This means when a turn comes in, or a player changes their player settings or any other change, then the web templates directory is scanned for any file with a ".atf" file extension. Each template you have in the web templates\ directory is executed and re-created. The newly created HTML page is compared with the HTML page you already have uploaded ( or put another way, the previous version of the HTML page) and if the new one is different, the old file is deleted and the new one is put in the ftp\ directory tree where you installed AutoTroll.

After the web templates directory is checked, AutoTroll then does an FTP check by rescaning all files/directories under the ftp\ directory tree and if any new files are found, they are uploaded to your FTP site.

In this way, a player can send a turn in, and in one of you web templates if you have a variable that says what turns are in for a game, this page will be re-executed and be different (because now a turn exists for this player) and the page will be uploaded to your web server. This means your web site can always be up to date with the status of all your games and player's settings! In fact, because of mail server delays, sometimes the player can see the results of their submission on the website BEFORE they receive a reply from AutoTroll!

Specifying the name of the HTML file to create

The name of the web template in the web templates\ directory is insignificant. It only must have a file extension of ".atf" (for AutoTroll Template File). If the filename doesn't matter, you might ask how do you specify the name and location of this newly created web template? This is done with a fairly powerful [SaveAs ....] command.

The SaveAs command defines what filename AutoTroll should save the web template. The root directory for the SaveAs command is AutoTroll's FTP directory under where AutoTroll is installed. So [SaveAs \game\test.txt] would save the template as test.txt in the local ftp\game directory. Remember the ftp directory is mapped to the website root directory (e.g., www.sharenet.com/) that you specified in setup.

So consider the following:
<html><body>
[CycleEach Game SortBy GameNumber]
Game #[Game.Number] - [Game.Name] turns in : [Game.TurnsIn]<br>
[EndCycle]
</body></html>
<!--[SaveAs \games\gamereport.htm]-->

This would create a web page called "gamereport.html" and put it in your c:\autotroll\ftp\games\ directory. It would be upload to your website and (assuming defaults) would be viewable as http://www.sharenet.com/games/gamereport.html
<html><body>
#1 Game ExploreMap turns in : 1o34x_789A_
#2 Game Seek And Destroy turns in : 1o34x_789A_
#3 Game Hunt and Hang turns in : 1o34x_789A_
</body></html>


The above example puts the [SaveAs ..] command in an HTML comment <!-- .. -->. This is just so some HTML editors like FrontPage don't move the [SaveAs ..] command to before the </body></html> statements.

Extending the SaveAs Command

At the point when the [SaveAs ..] command is reached in your template, AutoTroll saves the current template. So, to have SaveAs at the beginning of a web template makes little sense. If you want one page with a list of all your players, or of your games like the above example, then you can put the [SaveAs ..] command at the very end - after all cycles.

However, what would be really nice is to be able to create seperate pages for each cycle. For example, in the above game cycle, what if you wanted to create a separate page for each game? To do this, you simply put the SaveAs command within a cycle.

<html><body>
[CycleEach Game SortBy GameNumber]
Game #[Game.Number] - [Game.Name] turns in : [Game.TurnsIn]<br>
</body></html>
<!--[SaveAs \games\g[Game.Number].htm]-->
[EndCycle]

This is a modified example of the above. The EndCycle and SaveAs commands have swapped positions. Now, the SaveAs command is within the CycleEach Game .. loop, and thus executed for each cycle. Notice also that the SaveAs command allows a command ([Game.Number]) to help define the filename. The above example would create three pages : c:\autotroll\ftp\games\g1.htm, c:\autotroll\ftp\games\g3.htm, and c:\autotroll\ftp\games\g3.htm. This is exactly how the default web templates create separate home pages for each player. The contents of each file would be the one line shown above, e.g., in g1.htm:
<html><body>
#1 Game ExploreMap turns in : 1o34x_789A_
</body></html>

Of course these are very simple examples; instead of just one line you could print out the full details of the game, next hosting time, join buttons etc...,

Examples

When you installed AutoTroll there were some default templates put into the web templates\ directory as well as in the web templates\examples directory. In your designs, if you have some examples you think others might like to use, send them to me and I will include them in future releases and/or on the website for others to download. If you are just learning how to create web templates (or email templates) I suggest you look at the templates installed with AutoTroll to get more familiar with the syntax.