How to use the text parameter

This short tutorial will guide you through implementing the full set of features available in the Info Blocks applet. You need not make use of all (or even any!) of these extra features but they can enhance your display if you do. The parameter, text is effectively the only required parameter. If you do not enter any value then my default output will be displayed which is unlikely to be suitable for your site!

Primary default Image Block file
Example block image file - "blocks.jpg"

You can enter any string of characters you like as the value of the parameter. Each character is then mapped (using the charsonblocks parameter discussed on the main info blocks page) to an appropriate image block within the image block file which is subsequently displayed on screen. It should be remembered that this program doesn't use fonts of any kind, all the displayed blocks are images stored in a file. Thus not every keyboard character is represented. In the example graphics file I supply (see example graphic), the following keyboard characters are available (ie. these characters can be mapped to equivalent image blocks)

  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Space
  1 2 3 4 5 6 7 8 9 0 ! ? & . , : * ( ) $ " ' +

Although quotation marks (") can be used (since I have included the corresponding image block in the image block file) you obviously cannot utilise quotations within the text entered as a value to the text parameter! To solve this problem I simply map the quotation marks to the keyboard character ^. Thus any occurence of ^ in my text produces quotation marks on the screen.

The applet code attempts to "auto-format" the text you enter automatically. What it does is to ensure that no words are split over block lines while ensuring the text displayed is centred across the number of displayed blocks (screenblocks). However, you can also force the applet to break text at any point you desire. This is achieved through the following control code char,  |n  (on UK keyboards the vertical line can be found to the left of the z key). If the applet encounters this code it immediately stops processing any further characters and formats then displays what it has up till that point. For example take the following value of text:

  VALUE = "Hello!|nSimple Test"

This would result in the following line of blocks being displayed (using my default configuration) during the first drop:

The second drop would result in the following:

The actual number of blocks displayed on-screen (which is equal to 24 by default) can be modified by altering the value of screenblocks, for details see the main info blocks page.

You can use two newline characters to enclose a piece of text and thus ensure that it be placed on its own line. My demo text does just this at several stages such as for the "Info Blocks" output, or the "Click for details" display. Do remember though that only a limited number of blocks are displayed (the value you give to screenblocks or 24 if you've not entered a value) and thus your text will be split over two or more lines should it be greater than this number.

In addition if the newline character (|n) is not preceded or proceeded by any text, eg. when a newline is placed at the very start of the string, the very end of the string or when two newlines are placed next to each other with no gap a blank line of blocks will be displayed. This may be useful for splitting different messages. If you make use of the multi-block function (see later) you can actually create nice little break lines using two block image styles (as I do in my demo text).

This covers the basic use of the applet. The remaining features, namely multiple block styles, url's and sounds require a little more care to be taken over the text entry.


  Multiple Block Styles

To make use of the multiple block function two things need to be done, firstly your text must make use of the feature and secondly you must supply an additional block image file (on top of the basic one), see the filenames entry on the main info blocks page.

Alternative default Image Block file
Alternative block image file - "blocks-2.jpg"

To switch between the two types of image block file you use the following control character,  |b . Each time one of these is encountered the image block file being used is switched. For example, the applet running on the info blocks page uses the alternative block image file shown here. To make use of this alternative block I could enter the following text value:

  VALUE = "|b Hello! |b"

This would generate the following screen output:

The most important thing to remember is once you've switched blocks (using the control character) to the alternative block image file you will continue using those other block images until you switch back (again using the control character). It is quite easy to forget to switch the blocks back and hence have your alternative style spilling over between different lines. It is also important to remember that only text occuring between the multi-block control character will appear in the alternative block style. Thus if you want an *entire* line of blocks to be in the alternative style the best thing to do is:

  • Simply enter a newline control character followed by the multi-block character and then manually space out your line so that you have as many characters (including spaces) as you do screenblocks, then enter another multi-block character to switch back.

It is also possible using the multi-block character to produce some nice little break lines. For example in the applet I have running on the info blocks main page I have a multi-coloured break line created using the following text value snippet:

  VALUE = "|b  |b  |b  |b  |b  |b  |b  |b  |b  |b  |b  |b  "

This would generate the following screen output:

With a bit of thought and some painting ability you could produce some nice effects. Remember that the image blocks need not be square and neither must the alternative block be the same style as the default. So long as both block styles fit within the same dimensions and are located in the same places (within the image file) you can make them any shape you like. How mixing squares with circles? Or squares with hexagons? Or even hexagons with octagons!

I am also very interested in any users contributing block styles to a pool of designs which other users can use. If you develop your own block style/s and want to distribute them please contact me.

It is possible that certain quirks and problems still exist particularly in this multi-block implementation. If you come across something that is obviously wrong(!) then please email with the string you are trying to display.


  URL's and Sounds

To increase the functionality of the applet it is possible to incorporate url linked blocks as well as sound events. As with the newline and multi-block features both of these capabilities are acessed through special control characters.

URL's are signalled in your text string by the presence of a  |u . Whenever this character is encounterd the applet looks to see if it is followed by text enclosed within square brackets, ([). If it is then this text is extracted and used as the URL for the following line of blocks. If no text is found then the control character is ignored. When the applet encounters a url control code in the string then clicking anywhere on the entire line of blocks containing that url will cause the applet to load that page. Therefore I advise you use the url control code following a newline code. This will ensure that the key text you wish to link to a url will indeed function as a clickable link. Also remember that each line can have only a single URL associated with it. For example take the following string:

  VALUE = "|n|u[http://www.here.com/]Click me!"

The entire line of blocks (all 24 in my case) displayed will be clickable. When you move your mouse pointer over a line of blocks which offers a url link they will brighten slightly so as to separate them from the normal block display. Remember that the URL contained within the square brackets need not only be of the form [http:// ...], it could point towards something relative to this applet (eg. [/download/myfile.zip]), an ftp site (eg. [ftp://ftp.cdrom.com/pub/]), an email address (eg. [mailto:paul@pso-online.com]), etc.

A very similar philosphy applies to the use of sounds, in this case the occurence of the following code will cause a sound (in .au format) to play,  |s . Similarly to the way URL's are entered each occurence of the sound control code should be followed by square brackets containing the path (if needed) and filename of the sound to play, for example:

  VALUE ="|n|s[sounds/test.au]This is a test|n"

Just as with using URL codes, the sound will play when the line of blocks containing the code is first displayed. Thus again I recommend you either use a newline character or place the sound control char immediately before a relevant word for example. You should keep in mind that the sound will play till it stops. Thus if you have two sound control chars close together in your text string they may well overlap while playing. Therefore you need to either limit the length of the sounds you play or space them out through your string.

Well that's really about it folks! I hope this tutorial is useful, if you have any comments or serious problems then do contact me.