View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Example script added

From: Gustaf Neumann <neumann_at_wu.ac.at>
Date: Fri, 26 Jul 2013 02:55:51 +0530

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