| Author |
Message |
Karl Scherer (Karl)
| | Posted on Thursday, August 08, 2002 - 6:39 am: | |
When I started programming Zillions, I was sometimes annoyed that in a submacro I could not test what parameter was given to this routine. There is no construct such as (if ($1 = north)... in Zillions, where $1 is a direction that is passed. Well, there is a simple way to test such parameters: It takes three tiny steps of preparation. 1. In the piece definitions, declare the directions as pieces: (Pdot n)(Pdot e)(Pdot w)(Pdot s) where Pdot refers them to any empty or tiny image: (define Pdot (piece (name $1) (image Red "images\Halma_Star\dot.bmp" Blue "images\Halma_Star\dot.bmp") ) ) 2. In the board definition, define invisible (negative coordinates) positions for these "direction-pieces": ;direction storages (znorth 0 -3 0 -3) (zsouth 0 -4 0 -4) (zeast 0 -5 0 -5) (zwest 0 -6 0 -6) 3. In the board setup, store the direction-pieces on their positions: (Red (north znorth)... ) Now we can check a direction parameter: (if (piece? $1 znorth).... This method works for any parameter as long as there are not too many options (easy to do for piece-types etc). Cheers, Karl |
Karl Scherer (Karl)
| | Posted on Thursday, August 08, 2002 - 7:24 am: | |
..of course it must read: (Pdot north)... instead of (Pdot n)... above. |
|