User Tag List

Results 1 to 8 of 8

Thread: Finding Lowest Global Value

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Oct 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Finding Lowest Global Value

    In the game I'm making, I have 8 Global Values each between 0-32. I'm trying to make it so that my object will change direction to that of the LOWEST Global Value. Is there any way to do this, or some workaround?

  2. #2
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    You could use nested min(x,y) statement, but it will be a bit unpretty. Maybe it would be best to store the current lowest value somwehere, and everytime you change one of those global values check if it's lower than the stored value, then change it.

    Depends what you're trying to do

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    Easiest and the most stupid work around is to compare values in pairs set to counter then repeat it until you've got 1 value.

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    simple 'min' algorithm looks like this:

    x = 999999
    what = "null"
    for each variable "var"
    if "var" < x
    then x = "var"
    and what = "var"
    end loop

    in other words, just compare each variable one by one in a row to a number, and each step check if the one you are looking at is lower than the record. If it is, use that one

  5. #5
    Clicker Multimedia Fusion 2

    Join Date
    Oct 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    Okay. I've figured out how to get it. It just took one Alterable Value and a Fast loop. First I set the Alt Value to a number equal or higher than all the Global Values (In my case, 32).

    After a certain condition, start loop "FindLowValue" to the number of values you want to compare. In my case, 8.

    In the example I use '12+LoopIndex', because I compare Global Value 12-19.
    Code:
    + On Loop "FindLowValue"
    + Global Value(12+LoopIndex("FindLowValue")) < Alt Value A (Object)
      - Set Alt Value A to Global Value(12+LoopIndex("FindLowValue"))
    The loop checks if the Global Value is lower than the Alt Value, and makes them equal if it's true.

    So far, this works fine for me. Thank you for all the suggestions. It really helped out.

  6. #6
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    Ini++ can easily find the lowest item in a group by the way.

  7. #7
    Clicker Multimedia Fusion 2

    Join Date
    Oct 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    Really? I've never used Ini++ before. I'll give it a try.

  8. #8
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding Lowest Global Value

    Thanks to the MFA repository, here is an example

Similar Threads

  1. Help with Highscore lowest score
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th May 2013, 03:56 PM
  2. from highest to lowest
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th January 2012, 04:29 PM
  3. Finding Lowest Value
    By Danny in forum Multimedia Fusion 2 - Technical Support
    Replies: 14
    Last Post: 4th October 2010, 07:12 PM
  4. Set to Lowest Value
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 1st September 2010, 12:13 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
  •