User Tag List

Results 1 to 5 of 5

Thread: converting negative numbers to 1

  1. #1
    No Products Registered

    Join Date
    Sep 2009
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    converting negative numbers to 1

    Is there a way in the expression editor to convert numbers that are negative to 1?

    let's say P1 ATK - P2 DEF = P2 Damage,
    P1 ATK = 6
    P2 DEF = 9
    therefore 6 - 9 = -3

    I want this -3 changed to a 1 so that if I subtract it from a value (P2 HP)it doesn't say that a negative minus a negative equals a positive and add HP where it should be removing it. Any help would be great. Thanks

  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Jan 2007
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: converting negative numbers to 1

    Use max(). It will return the highest of 2 numbers.
    E.g.: max(P1 ATK - P2 DEF , 1)
    Note that a 0 would become 1 too.

  3. #3
    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: converting negative numbers to 1

    If that isn't ok, you could use the IIF object.

  4. #4
    No Products Registered

    Join Date
    Sep 2009
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: converting negative numbers to 1

    Thanks guys.
    using max() worked a treat. I've been wondering how to pull this one off for a while to be honest. Thanks again.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: converting negative numbers to 1

    Using max() as Hernan explained it wouldn't work perfectly, although it might suit your needs. That method will just set a number to 1 if it's lower than 1, so 0 or 0.5 for example will return 1 as well. But that might not be a problem depending on what you're doing.

Similar Threads

  1. Problem returning a Negative Numbers
    By EZubby in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 30th July 2011, 05:56 AM
  2. Negative Numbers bug
    By ffomega in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 5th November 2010, 12:20 AM
  3. how to make masked edit allow negative numbers?
    By BrashMonkey in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 10th February 2010, 05:02 PM
  4. can masked edit object support negative numbers?
    By BrashMonkey in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 11th October 2009, 04:06 PM
  5. Converting part of a string to negative number
    By Simion32 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th April 2007, 12:44 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
  •