User Tag List

Results 1 to 6 of 6

Thread: Mod Numbers - quickest route to a number

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export Module
    Ramses's Avatar
    Join Date
    Jul 2006
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mod Numbers - quickest route to a number

    Lets say I had a variable (A) that I want to always set as a mod of 10 ie 13 would equal 3. Now lets say I had a another variable (B) and if variable B was less than variable A, variable A would be subracted by 1 and if variable B was greater then 1 would be added to variable A. Hmmm... this is difficult to explain.

    Basically, what I want to do is sort of like the "rotate towards angle" function that's found in a few of the extensions. For example, if variable A is 9 and variable B is 2, 1 would be added to A instead of subtracted since it's quicker to get to B by adding. How would one do this via expressions? How would you find out if you should add or subtract?

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Mod Numbers - quickest route to a number

    I have tried to find a solution, but didn't come up with anything so far. One hint: Use min(a,b) and max(a,b) to limit numbers. min returns the lower, and max the higher of two numbers. You can use that to limit the difference to -1,1 or something like that.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Mod Numbers - quickest route to a number

    You probably want to use the Immediate If object..

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Mod Numbers - quickest route to a number

    True that. I tried to do it without it, but forgot suggesting it to Ramses. :blush:

  5. #5
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mod Numbers - quickest route to a number

    Add this to the <current> value to "rotate" it towards the <target> value:
    Code:
    max(min(((<target> - <current>) + <limit> + <limit>/2) mod <limit> - <limit>/2, 1), -1)
    Change -1 and 1 to change the speed.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export Module
    Ramses's Avatar
    Join Date
    Jul 2006
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mod Numbers - quickest route to a number

    Awesome. Thanks!

Similar Threads

  1. Random Numbers and expiring the result numbers.
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th April 2013, 04:11 PM
  2. Google Maps - Route Distance Calulation
    By Game_Master in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 14th June 2012, 03:05 PM
  3. Route Me
    By StingRay in forum iOS Export Module Version 2.0
    Replies: 0
    Last Post: 17th October 2011, 12:42 PM
  4. Chacking a number falls between 2 numbers
    By Rick in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 2nd April 2011, 06:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •