#!/usr/local/bin/gracula ############################################################################### ## ## sec2000.gcl ## ## Copyright 1999 G. Adam Stanislav ## All rights reserved. ## ## This is a sample GCL script which randomly chooses one of three background ## images, and displays a count of either the number of seconds remaining till ## 2000-01-01T00:00Z or the number of seconds that passed since then, depending ## on when it is used. ## ## The purpose of this script is NOT to give you something to use on your web ## site, but rather to illustrate how you can create your own interesting ## counters using GCL, v3.0 or later. ## ## Note that this script will not work as expected in anything prior to v3.0. ## ############################################################################### ############################################################################### ## ## The common section. All three possible images use the same digit images ## (these are taken from g.gcl). Therefore, we only need to declare them once. ## ############################################################################### #0 [0, 0, 17, 24] #1 [18, 0, 12, 24] #2 [32, 0, 16, 24] #3 [48, 0, 16, 24] #4 [65, 0, 17, 24] #5 [81, 0, 16, 24] #6 [98, 0, 16, 24] #7 [114, 0, 15, 24] #8 [130, 0, 16, 24] #9 [147, 0, 16, 24] #- [182, 12, 11, 2] #% [174, 6, 6, 15] #^ [211, 0, 20, 24] #@ [231, 0, 17, 24] #< [182, 12, 11, 2] #> [194, 6, 18, 16] #~ [-12, -16, 12, 16] #; [174, 6, 6, 4] #, [165, 17, 6, 9] ## Change the path below to wherever the file is on your system: #[ "/usr/local/share/gracula/pix/g.gd" gd kern head -20 kern digits 2 kern commas 2 kern dots 2 kern dashes 2 kern colons 2 kern plusses 2 kern minuses 2 kern times 2 kern zones 2 align commas middle -9 align dots middle -7 align dashes middle -1 align colons middle -1 align plusses middle -2 align minuses middle -1 ############################################################################### ## ## Randomly choose one of three images. Use an "array statement" to decide ## of the images should be used. ## ############################################################################### [ random % 3 ## A random number between 0 and 2. 0 { ## Do this if the random % 3 condition == 0. ## Change the path below to wherever it is on your system: #$ "/usr/local/share/gracula/owl.gd" gd trans colorize 80 160 255 shift right 70 shift down 13 } 1 { ## Do this if the random % 3 condition == 1. ## Change the path below as necessary for your system: #$ "/usr/local/share/gracula/pix/read.gd" gd colorize 255 224 160 shift down 124 shift left 15 trans } default { ## Do this in all other cases. ## Change the path to wherever it is on your system: #$ "/usr/local/share/pix/space.gd" gd colorize 224 224 255 shift down 240 } ] ## The array statement ends here. nocompile ## This needs to be in all advanced scripts ## - or they'll disapper! ## Calculate the absolute value of the difference between now and ## 2000-01-01T00:00Z. For that to work properly, we need to treat ## any calculations as signed numbers. Otherwise, there would be ## no such thing as an absolute value. signed count = \(946684800 - now) ## That's all! For an alternative to achieve the exact same thing, see ## the file tri.gcl.sample. The difference is that you can easily ## add other images to this file but are restricted to exactly three ## in tri.gcl.sample.