TuxType Custom Scripting Reference

Contents

Introduction
File Locations
The Basics
XML Tag Hierarchy
Samples
Tag Reference




Introduction

Tuxtype lessons can be customized with relative ease. It just takes a little
imagination, and a text editor.

File Locations

Tuxtype first looks in your language (theme) directory for lesson files
(Non-English Users Only)
eg: (<TuxType directory>/data/themes/<language>/scripts/),

or in the default directory if you are using TuxType in english
(<TuxType directory>/data/scripts/)

If there is not a scripts folder in your language (theme) directory, You may
safely create it

The Basics

Tuxtype will attempt to load any xml file contained in your scripts directory.
Each XML file represents one entry in the lessons menu.

note: TuxType will NOT load cascade.xml, laser.xml, or ProjectInfo.xml. These
are custom scripts used elsewhere in the program. DO NOT DELETE THEM!

The tags that TuxType recognizes are listed below. You MUST
open every script with the <script> tag, and enclosed within
the script tags there must be at least one <page> tag. To have
any sort of functionality, you should include the <prac> tag within
your page tags to provide a typing lesson.

This is not mandatory however.

You could if you like, just create a page with instructions in text and
images for student reference. If you do so, include a <waitforinput>
tag so that the screen does not disappear before being read. Simply hitting
space at this point will take you to the next page in the lesson, or to the
main menu, if there are no more pages in the lesson.

Section Hierarchy

Your script should honor the following hierarchy

script
|--page
    |--text
    |--img
    |--wav
    |--prac
    |--waitforinput
    |--waitforchar

Examples

Finally, here are some sample lesson scripts showing working examples of
TuxType lessons
Example: The simplest script
Example: A little more complex





Tag Reference

<script>

starts a script (mandatory)

attributes:

  • title - title of the script
  • bgcolor - solid background color for the script
  • background - image to display as the background
  • fgcolor - foreground (text) color



    <page>

    starts a new page for the script (mandatory)

    (must be enclose within a script section)

    attributes:

  • background - background image for the page
  • title - page title
  • bgcolor - solid background color for the page
  • fgcolor - foreground (text) color for the page


    <text>

    - displays static text in the script

    (must be enclosed within a page section)

    attributes:

  • size - size of the font
  • align - screen alignment (center/middle, left, right)
  • color - text color
  • x - upper left x coordinate of the text (overrides align attribute)
  • y - upper left y coordinate of text


    <img>

    -embeds an image on the page

    (must be enclosed within a page section)

    attributes:

  • onclickplay - the filename of a sound to play when the user clicks the image
  • x - upper left x coordinate of the image (overrides align attribute)
  • y - upper left y coordinate of the image
  • src - name of the image file, theme image directory is checked first, then the default (data/images) directory is checked
  • align - screen alignment (center/middle, left, right)


    <wav>

    - embeds a sound file into the page (wav format)

    (must be enclosed within a page section)

    attributes:

  • src - name of the wav file
  • loop - whether or not to loop the sound after it has finished playing, 0=no 1=yes


    <prac>

    - practice typing, any text here will create a typing lesson

    (must be enclosed within a page section)

    attributes:

  • size - text size for the lesson
  • goal - target time, in seconds for the lesson (currently does nothing)
  • align - text alignment for the lesson
  • color - text color for the lesson


    <waitforinput>

    - pauses script until some sort of input is given

    valid keys

  • escape - quit the script
  • left arrow - go back one page
  • right arrow, space, return - go to the next page


    <waitforchar>

    pauses the script until the p key is pressed or the user quits the script using escape





    Samples

    The Simplest Script


    In this barebones example, the lesson would go directly to the typing screen,
    and display the words "hello world!" for the student to type.
    <script>
      <page>
        <prac>hello world!</prac>
      </page>
    </script>
    







    A More Complex Example


    In this example, a few information screens are presented before the lesson,
    including one that shows an image of a keyboard with the relevant keys showing.
    after the lesson is complete, the user is shown a congratulatory message.
    <script title="Test Lesson" bgcolor="#3f4f1f">
       <page title="Introduction to Example Lesson">
       <text align="center">The Lesson that follows is only an example</text>
       <text align="center">lesson to help you to see how to write lessons.</text>
       <text align="center">To start writing your own lessons, edit the file,</text>
       <text align="center">"Lesson_1.xml" in your "TuxType/data/scripts"</text>
       <text align="center">directory.</text>
       <text align="center" y="300"> PRESS SPACE TO START THE LESSON!</text>
      <waitforinput/>
       </page>
       <page title="Home Row Keys" bgcolor="#3f7f3f">
       <img src="/keyboard/keyboard-us.png" x="45" y="220"/>
       <text align="center">In this exercise we practice the home row keys.</text>
       <text align="center">asdfjkl;asdfjkl;asdfjkl;</text>
       <text align="center">To start practicing hit the p key</text>
       <text color="#000000" x="100" y="273">A</text>
       <text color="#000000" x="130" y="273">S</text>
       <text color="#000000" x="160" y="273">D</text>
       <text color="#000000" x="190" y="273">F</text>
       <text color="#000000" x="320" y="273">J</text>
       <text color="#000000" x="350" y="273">K</text>
       <text color="#000000" x="380" y="273">L</text>
       <text color="#000000" x="410" y="273">;</text>
      <waitforchar/>
       <prac goal="15">asdfjkl;asdfjkl;asdfjkl;</prac>
       <prac>asdfjkl;asdfjkl;asdfjkl;</prac>
       <prac>asdfjkl;asdfjkl;asdfjkl;</prac>
       </page>
     <page>
       <img src="keyboard/space.png" x="200" y="160"/>
       <img src="keyboard/larrow.png" x="460" y="18"/>
       <img src="keyboard/esc.png" x="515" y="50"/>
       <text align="center">Great Job!</text>
       <text align="left">         To repeat the last exercise, press</text>
       <text align="center">To go back to the main menu hit</text>
       <text align="center">To continue on to the next exercise,</text>
       <text align="center">press</text>
       <text align="center">Space</text>
       <text></text>
       <text></text>
       <text></text>
       <text align="center">Next Exercise:</text>
       <text align="center">lad lass dad sad fad gas had jag ask;</text>
       <waitforinput/>
     </page>
     <page title="Home Row Keys" bgcolor="#b07bc6">
       <img src="/keyboard/keyboard-us.png" x="45" y="220"/>
       <text align="center">In this exercise we practice the home row keys,</text>
       <text align="center">but, a little bit differently!</text>
       <text align="center">See how fast you are at this one!</text>
       <text align="center">lad lass dad sad fad gas had jag ask;</text>
       <text align="center">To start practicing hit the p key</text>
       <text color="#000000" x="100" y="273">A</text>
       <text color="#000000" x="130" y="273">S</text>
       <text color="#000000" x="160" y="273">D</text>
       <text color="#000000" x="190" y="273">F</text>
       <text color="#000000" x="320" y="273">J</text>
       <text color="#000000" x="350" y="273">K</text>
       <text color="#000000" x="380" y="273">L</text>
       <text color="#000000" x="410" y="273">;</text>
       <waitforchar/>
       <prac>lad lass dad sad fad gas had jag ask; lad lass dad sad fad gas had jag ask;</prac>
       <prac>lad lass dad sad fad gas had jag ask; lad lass dad sad fad gas had jag ask;</prac>
       <prac>lad lass dad sad fad gas had jag ask; lad lass dad sad fad gas had jag ask;</prac>
     </page>
    </script>