[messages] Edit: Re: [Module Design] noob help please

JustaBill martinson2005 at netscape.net
Thu Jul 12 10:15:21 MST 2012


[This message has been edited.]


"irishwulf" wrote:
> In 3.1, to subtract one number from another, the only method I know of
> is to use a loop, decrementing both values until the one reaches zero.
> 

If you know that the result of the subtraction will be non-negative,
another method would be to create an invisible piece and use Send to
Location to move it to, say, (0,$FirstNumber$). In the Advanced Options,
your Additional Y Offset would be -1 and the "times" value would be
$SecondNumber$. Then have your invisible piece update a 'Result' global
property with its CurrentY value.  (You could also perform
multiplication in this way.)

Negative results probably could be accommodated by using a bias on the Y
coordinate, the negative of which you have already stored in another
global property; for example, a 'SubtractionBias' GP that's set to
-10000.  In this case, you would first do a Send to Location to
(0,10000) with no advanced options, then perform a Move Fixed Distance
of (0,$FirstNumber$) with the Advanced Options on the Y coordinate of -1
and $SecondNumber$ as described above. After setting your 'Result' GP
equal to $CurrentY$, you would then de-bias it by Incrementing it by
$SubtractionBias$.

But really, though, all of this is duck-tape abuse of the Vassal engine.
 Personally I'd rather be patient for the stable production release of
3.2 and just use BeanShell to do the math.

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=35146#p35146


More information about the messages mailing list