1. Moderator
    ASP Super Hero (2500 - 2999 posts)

    Join Date
    Dec 2006
    West London, UK
    Rep Power

    Math Formula Function required

    Hi All

    I have an issue with a site where users level up based on a points system and i need a function to calculate their level. The level is based on the following where the first column is the Level the second column is the points required to gain the level but these are on top of the points used to get the previous level so the third column shows the total points required to reach the level...

    1 1000 1,000
    2 2000 3,000
    3 3000 6,000
    4 4000 10,000
    5 5000 15,000
    6 6000 21,000
    7 7000 28,000
    8 8000 36,000
    9 9000 45,000
    10 10000 55,000

    So for level 1 they need 1000 points, to get to level 2 they need 2000 points above what was required for the level 1 so they need 3000 points, level 3 requires 3000 points above the 3000 of level 2 so they need 6000 etc if that makes any sence.

    I need a function that includes a formula to calculate their level based on the number of points they have. Any one with any ideas?

  2. #2
  3. 0x800A0C93
    ASP Super Hero (2500 - 2999 posts)

    Join Date
    Jan 2009
    Ridin' through this world...
    Rep Power
    Must it be done by formula? I would lean toward throwing your level/points table into a dictionary object or an array and doing a lookup as needed.

    two dimensions, level and max points for level

    userlevel = 0
    for i to upper bound
    if user points > than max points
    set userlevel = that level
    end if
    Brinkster- free development account. Not affiliated, but I sure like free. Brinkster.com

Similar Threads

  1. JavaScript + Math expert required.
    By icoombs in forum HTML, JavaScript And CSS Help
    Replies: 4
    Last Post: August 22nd, 2010, 08:42 AM
  2. Simple math formula not working
    By mystic7 in forum ASP Development
    Replies: 4
    Last Post: August 21st, 2009, 12:27 PM
  3. Function to deal with math fractions
    By samjaynes in forum ASP Development
    Replies: 7
    Last Post: October 18th, 2006, 12:40 PM
  4. Function Implementation Advise Required
    By hauruapai in forum ASP Development
    Replies: 2
    Last Post: April 19th, 2006, 06:47 PM
  5. math function based on drop down list selection
    By maxtrixx in forum HTML, JavaScript And CSS Help
    Replies: 2
    Last Post: November 22nd, 2004, 04:50 PM

IMN logo majestic logo threadwatch logo seochat tools logo