• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA XML - Increment Variable w/Modulo Reset HELP!

Messages
1,749
Country
unitedstates
I need help with how to add 10 digits each time I click. This example works perfect but only counts 1 digit at a time and will repeat at 5.

I want the code to repeat continues and add 10 digits per click.:banghead:



Code:
(L:FUEL_REM, Number) ++ 5 % (>L:FUEL_REM, Number)
 
Why not try:
Code:
(L:FUEL_REM, Number) 10 + (>L:FUEL_REM, Number)

++ is increment so it will always add 1. -- is decrement and will always subtract 1.

% is modulo and will always return the remainder. So 23 5 % will return 3 (ie 23 divided by 5 = 4 remainder 3, modulo returns the 3).

What your code is doing is adding 1 and then dividing by 5 and returning the remainder. Hence the result will always be 0 to 4.
 
Thank you Anthony

Yep it's always 0 - 4 because if you try 1 - 5 it will skip 5 and do nothing for 1 click when it get to 0!

I tried a few ways to just add 10 + but i did it without the first variable. Then after trying this code it was hard to add 10 + and use the repeat as well. So I figured it had to be like my first try. I was close! Thanks...
 
Back
Top