1. #1

    [Guide] Separate a number into 1, 10, 100..

    Here's how you can convert a Variable Data Source (or any number) into separate data sources for each number position. This is often used when trying to create a large counter in the game world with numbers from the Trials Fusion pack, or decals in Trials Rising.

    It looks complicated but here we go.
    Modulo is the number(s) on the right, after a calculation.
    So 5 ÷ 10 = 0.5, the Modulo is 5.
    In your case, 237 ÷ 10 = 23.7, the Modulus is 7.

    Now subtract the Modulo value from your number, and then get the Modulo for the last 2 digits.
    230 Mod 100 = 30. Divide by 10 to remove the 0 gives your tens. (3)

    Do this again.
    230 - 30 = 200
    200 ÷ 100 = 2 (hundreds)

    This is a Modulo calculator:
    https://www.miniwebtool.com/modulo-calculator/

    The code:
    One of the math tool cards, I think it's the 2-input Operator, will have something in it called mod or modulo.

    Terms
    Your number = VDS
    Each result = Letters
    Toolcards are all 2-Input Operators, labeled 2IO.

    2IO
    Type = Mod
    input1 = VDS
    input2 = 10
    Result A should be 7.

    2IO
    Type = Subtract
    input1 = VDS
    input2 = A
    Result B (230)

    2IO
    Type = Mod
    input1 = B
    input2 = 100
    Result C (30)

    2IO
    Type = Divide
    input1 = C
    input2 = 10
    Result D (3)

    2IO
    Type = Subtract
    input1 = B
    input2 = C
    Result E (200)

    2IO
    Type = Divide
    input1 = E
    input2 = 100
    Result F (2)

    Now we have all 3 numbers in 3 VDS's:
    237
    E = 2
    D = 3
    A = 7
    Share this post

  2. #2
    Always wondered what modulo was for, thanks for the breakdown, just used it to convert the example clock display in Rising's 1/60 second fraction to the normal 1/1000 second fraction
    Share this post

  3. #3
    Thanks for the insight.
    I just went through figuring that stuff out too while creating a track with a display sign at each checkpoint to show the Bike Power level. (Each time you do a flip it adds 2% more power to the bike). It was tricky to figure out but it worked well. Seems you can do just about anything you can imagine with this track editor.
    Always enjoy learning new tips and tricks.
    Share this post

  4. #4
    Originally Posted by CynicalCreator Go to original post
    Always wondered what modulo was for, thanks for the breakdown, just used it to convert the example clock display in Rising's 1/60 second fraction to the normal 1/1000 second fraction
    Sounds interesting !
    Have you tried making clock countdown from any certain time ? That could be useful !
    Could you input what you did into interval trigger to get .001 ticks instead of .016 ?
    Share this post

  5. #5
    Awesome thread JolanXBL might have to try this out sometime .
    Share this post

  6. #6
    Ah, no, not 1000 ticks a second, just made the example clock display in 1000ths of a second instead of 60ths, still runs at 60 ticks a second but instead of showing as 00:0000, 01, 02, 03... 59) It shows 00:00.(000, 016, 033, 050... 983).

    The actual default clock is running at 1000ths of a second though, but if you use a custom timer for the score it converts a vds value to .016 second intervals as the display time in the corner, you can run it backwards, fast or slow, add or reduce time, anything you can do to a number.

    Then another thing is the custom clock display has a few .001 rounding errors, because its actually .016666666... Like .449 and .499 instead of .450 and .500, even though 3/60ths of 1000 is exactly .050... so i had to make a little correction logic to make it accurately show the same as the custom time score, then if i made it to where they both show the same when you pause a video, when the track ends it would be off by a tick or 2, so had to correct that too
    Share this post

  7. #7
    Oh your awesome you just answered a few of my other questions on here as well thank you very much CynicalCreator !
    I see what you mean with having to remove a tick for that to have the same time - also seems like you need to do this with the example clock as well ?
    I've been trying to clean up a space track I've been making for a couple months now it's short but fun, fully moving and rotating with movement of bike/rider !
    Share this post

  8. #8
    It's funny how computers like to round things off sometimes.
    Floor and Ceiling come in handy for rounding up and down. Then you can just multiply by 0.01 or whatever desired fraction you need.
    I had written a program once that took colors in an area and averaged them out for smoothing, but the color would get darker everytime it averaged. Eventually I found that adding 1 to my average result made it work because the computer would round a number like 1.99 down to 1.00 instead of up.
    Funny thing. Well, funny to me anyway.
    Share this post

  9. #9
    Right on, there's a lot of weird quirks in the editor, havent been able to not find a workaround yet though, crazy whats the game is capable of. Depending on if i ended the game with an end event or a checkpoint it needed a different amount of tick delay, cant remember what it ended up being though
    Share this post

  10. #10
    I just made a skill game that ends after 3 minutes (10800 ticks I think), but I see recorded times are 0.016 longer. Must be the end event trigger happens at the end of the interval process.
    That skill game also uses math similar to above ↑ to split a three digit number into individual digits to display the final score over the rider in the color of the medal earned as gravity glitches slam him around the track a bit.
    I agree it is crazy what the game & editor are capable of. Amazing bit of software really.
    Share this post