User Tag List

Results 1 to 4 of 4

Thread: Finding the closest value...

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Finding the closest value...

    Hello all,

    I need to retrieve either Value A or Value B depending on which is closer to Value C. I did find a way to do it.... but it utterly disgusts me and I can't shake the feeling, a more elegant solution exists.

    Any help would be greatly appreciated.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    EdSabbath's Avatar
    Join Date
    Oct 2010
    Location
    Oklahoma, USA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check for:
    Alterable Value C("Active") - Alterable Value A("Active") > Alterable Value C("Active") - Alterable Value B("Active")
    then Alterable Value B is closer


    Alterable Value C("Active") - Alterable Value A("Active") < Alterable Value C("Active") - Alterable Value B("Active")
    then Alterable Value A is closer

    Very simple

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Two conditions:

    If Abs( ValueC - ValueA ) < Abs( ValueC - ValueB )
    --> Set Counter to ValueA

    If Abs( ValueC - ValueB ) < Abs( ValueC - ValueA )
    --> Set Counter to ValueB

    ...
    Just from the top of my head, i have not tested this but think this should work.
    I believe ther should be a way of doing this in just 1 Condition though.

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ed, you're a life saver.

    May the gods protect you from a sharp knife in a dark alley real soon.

Similar Threads

  1. Number closest to 0
    By Skyhunter in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 27th October 2012, 02:27 AM
  2. Pick the closest enemy
    By StardustSpeedman in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 26th July 2012, 07:27 AM
  3. which active is closest to?
    By StingRay in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th July 2010, 07:13 PM
  4. Finding Closest Enemy example
    By TreeHugger in forum File Archive
    Replies: 1
    Last Post: 2nd February 2009, 02:35 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
  •