Macro Set Keyword
<macro set name = expression>
macro name designators:
c (a single ASCII
char)
.macroname.
Rounding out my wish list of features since forever is the macro
set operator added in version 4.3.0.0. that sets a macro to the string representing the result of the expression. This is really handy if there's some keyword that you want a parameter set from an expression and DMDX doesn't allow it otherwise (see the macro and other following sections of introduction for more examples). So the following for instance results in counter 49 getting assigned "49": ~1 <macro set .body. = 7*7> <set c49 = `.body.>;If for some perverse reason you wanted to use the legacy tilde macro lead in
the solution is to use two items. Note they're skip display items (that confusingly use tilde correct response indicators, sorry about that) so they execute almost as fast as one does: ~1 <macro set .body. = 7*7>;
Macro Fixed Point Set Keyword
<macro fxpset N name = expression>
macro name designators:
c (a single ASCII
char)
.macroname.
Back in the dark ages when I first added the expression evaluator to DMDX there was no call for floating point capability at all, indeed not all processors had floating point units so using them was sloooow, however as DMDX has evolved there are now several cases where they're used, screen coordinates can now be between zero and one and both font and bitmap multipliers can be fractional as well and when using <macro set> to manipulate them one needs to prepend leading zeroes to the fractional component of the value which used to be shown in the Stretch Blt modes discussion, now it just demonstrates use of fxpset. Prepending zeroes is a right pain and having recently come across another example that needs this in spades we now have the fxpset option. Here one decides how many fixed decimal places one is going to use and passes that as N and multiplies the values in the expression by a corresponding amount (so for three decimal places you multiply by 1000). So from my Corsi Block Tapping task where we have nine different targets on the screen and the coordinates of them have been generated randomly in counters 100 to 117 (a pair of them for each target, first being X and second being Y) with values between 0 and 100 where in order to display them they need to be 0.00 to 1.00 we have: ~1 <macro fxpset 2 .b1x. = c100> <macro fxpset 2 .b1y. = c101>
Note that we are deliberately using two items, one to set the macros and one to use them as in the past when using the legacy tilde macro expansion character you can't define a macro and use that new value in the same item, if the in place back tick macro expansion code had been written when I wrote the Corsi Block Tapping task then one item could have been used.