[Xotcl] Example script added

Gustaf Neumann neumann at wu.ac.at
Thu Jul 25 23:25:51 CEST 2013


Dear all,

I've added one more script to the example script collection for NX:
the  game of Ludo (in German "Mensch ärgere dich nicht"), which
is essentially the result of the airplane flight to my vacation:

https://next-scripting.org/xowiki/file/docs/nx/examples/tk-ludo.html?html-content=1

One interesting part is the usage of the "expression converter":
NX supports user-defined argument checkers and converters,
where converters might transform arguments. This can be
used e.g. to normalize values. In this game, this feature is used
to "normalize" expressions to values. This means, instead of
having to write

    $obj point [expr {$x-$d}] [expr {$y-$d}] [expr {$x+$d}] [expr {$y+$d}]

one can write

    $obj point $x-$d  $y-$d  $x+$d  $y+$d

when the 4 arguments of method "point" are defined as expression
converters. This is at least an option, when performance is not critical.

best regards
-gustaf neumann



More information about the Xotcl mailing list