User Tag List

Results 1 to 10 of 10

Thread: Chacking a number falls between 2 numbers

  1. #1
    No Products Registered

    Join Date
    Nov 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Chacking a number falls between 2 numbers

    Hello everyone,

    Here is what I am trying to do.

    I need to check if value “A” which lets say is 5.45 falls between value “B” 6.45 and Value “C” 4.45 if it does than “A” is correct and the Color changes to Green, if it is incorrect the color changes to Red. Keep in mind that A, B, and C are all variables.

    “A” is user input answer

    “B” HC1 [color:#FF0000]6.45[/color]
    HC1 = value( "Drop Loss 1" )+1 [color:#FF0000]5.45 + 1= 6.45[/color]
    Drop Loss 1 = Str$(value( "Footage Counter Drop" )*4.66/100)[color:#FF0000]117 * 4.66 /100 = 5.45[/color]


    “C” LC1 [color:#FF0000]4.45[/color]
    LC1 = value( "Drop Loss 1" )-1 [color:#FF0000]5.45 - 1= 4.45[/color]
    Drop Loss 1 = Str$(value( "Footage Counter Drop" )*4.66/100) [color:#FF0000]117 * 4.66 /100 = 5.45[/color]


    What I have tried is:

    A <= B and A<= C Change Color to green

    A > B or A < C Change color to red

    The issue I am running across is that it don’t seam to take in to account the Decimal places. It will mark the answer correct from 4 – 6.99 I need it to be wrong at 6.46 and above and at 4.44 and below.

    Can someone out there please help me with this?

    Thanks, Rick

  2. #2
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    OMG Rick this is way over my brain loss body. Forgive me, but you write like a PHD person. Is there anyway to ask this different?

    Thanks
    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    set HC1 to value("Drop Loss 1")+1.0

    also do the same for LC1, use 1.0 instead of 1.

    Also, you may want to make 100 turn into 100.0, that actually looks like it's the bigger problem. When you divide by an integer, you're going to get an integer back.

    Try those and let us know.

    -Eliyahu

  4. #4
    No Products Registered

    Join Date
    Nov 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    Thanks for your quick response.
    Eliyahu – I tried what you said and am still getting the same results. I changed where I had +1 to +1.0, -1 to -1.0 and /100 to /100.0

    Nivram – In a nut shell I have 3 values which are all going to be values that contain decimals.

    Value “A” is an Edit box that the user will type in a number
    Value “B” is the highest the number can be and still be correct
    Value “C” is the lowest the number can be and still be correct

    I am using compare two general values. Is there something I have to do to the edit box? I did try this and still got the same results.

    Compare two general values:
    Edit Value( "Drop Loss Ans 1" )*1.0
    Greater
    value( "Drop Loss HC 1" )

    Thanks,
    Rick

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    Rick, Edit Value of an edit box return an integer. If you want the user to be able to enter a float, you need to use Val(EditText$("edit box")). That's where your problem is coming from.

  6. #6
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    You never said you were using an edit box...

    Saying Edit Value( "Edit Box" ) will *always* return an integer.
    To get a float, you have to use Val(Edittext$( "Edit Box" ))

    EDIT: Nevermind - Eliyahu got there first

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    Yea I'm just ninja like that. ^_^
    Having to use Val around the string is quite frustrating, perhaps Edit Box should have an Edit Decimal("Edit Box") Expression so the code doesn't look so bad.

  8. #8
    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: Chacking a number falls between 2 numbers

    Frustrating? It makes perfect sense to me - In my opinion the Edit Value expression is completely unnecessary, actually. As we can see, it has disadvantages and makes people overlook Val().

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    Right, I just don't see why there is Edit Value but only for integers. It should either be 1 or both. To me it'd make more sense for Edit Value to return a decimal. If you want it as an int, you could do Int(Edit Value())

  10. #10
    No Products Registered

    Join Date
    Nov 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Chacking a number falls between 2 numbers

    Thanks Eliyahu that worked. Sorry about the confusion in my first post I made the mistake of assuming that you knew how "A" was being inputed. Thanks again for the help as I would have never thought of that.

Similar Threads

  1. PMO falls through obstacles on iOS devices
    By WhatPixelYouOn in forum iOS Export Module Version 2.0
    Replies: 4
    Last Post: 10th July 2013, 03:17 PM
  2. 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
  3. Mod Numbers - quickest route to a number
    By Ramses in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 7th July 2009, 02:39 PM
  4. How do you make an enemy that falls off platforms?
    By Jocastus in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 3rd May 2009, 12:45 AM

Posting Permissions

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