Leaderboard - displaying full score as decimal time

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hi All.

    I an using the Leaderboard plugin, which creates a leaderboard and submits the scores to a mySQL database. Works great, but one problem.

    The game is a driving game, which records the time taken to go round the track.

    The score records the time in seconds.milliseconds, and in the MySQL database, the scores are indeed stored in this fashion: (e.g. 12.34)

    But, when the leaderboard publishes the scores, which are being pulled down form the database, it only show seconds - e.g. 12

    scirra.com/store/construct2-plugins/easyleaderboard-4145

    Has anyone used this plugin, and would you know how to add the full entry form the database?

    I contacted the author of the plugin, but haven't heard back.

  • Check the source code, maybe there is an floor/round/ceil/trunk function somewhere.

  • Hmm Thanks - I've just searched the PHP files which game with it - nothing relating to floor/round/ceil/trunk in those.

    Or do you mean within Construct itself?

  • Hmm Thanks - I've just searched the PHP files which game with it - nothing relating to floor/round/ceil/trunk in those.

    Or do you mean within Construct itself?

    Have you set your mysql field to decimal type.

    example, in the structure the Type should be Decimal(4,2) The 4 means the length before the decimal + the number of digits after the decimal, so 67.78, would be Decimal(4,2), 9299.365 would be (7,3) and so on.

    Edit, Forgot to say, I don't have the plugin, but do this with my own scoreboard.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for your reply!

    Do you mean in the actual database, or within Constuct?

    Sorry - fairly new to this, and not sure where to look.

    In the database itself, the values are set up as 'text', and the times (scores) look correct.

  • Thanks for your reply!

    Do you mean in the actual database, or within Constuct?

    Sorry - fairly new to this, and not sure where to look.

    In the database itself, the values are set up as 'text', and the times (scores) look correct.

    In the database.(presuming it's mysql)

  • OK thanks - tried that, but it didn't work. It's only loading the digits before the decimal point.

    The values in the DB say:

    1. Andy 12.34

    2. Andy 12.45

    3. Andy 15.65

    But i my leaderboard they show as:

    1. Andy 12

    2. Andy 12

    3. Andy 15

    So it seems as though the plugin, or construct is rounding the number before displaying it somehow.

  • OK thanks - tried that, but it didn't work. It's only loading the digits before the decimal point.

    The values in the DB say:

    1. Andy 12.34

    2. Andy 12.45

    3. Andy 15.65

    But i my leaderboard they show as:

    1. Andy 12

    2. Andy 12

    3. Andy 15

    So it seems as though the plugin, or construct is rounding the number before displaying it somehow.

    Have a look at ajax (in construct) in the debug mode, it will show you the raw data that is coming from your mysql table.

  • Thank you for your continued help - I really appreciate it.

    The data from MYSQL only comes in when the game is live on a server - in Debug mode, the leaderboard is empty - so it doesn't pull in the scores. I think this is a security setting in the plugin which means that the game only works in the location you specify.

  • Thank you for your continued help - I really appreciate it.

    The data from MYSQL only comes in when the game is live on a server - in Debug mode, the leaderboard is empty - so it doesn't pull in the scores. I think this is a security setting in the plugin which means that the game only works in the location you specify.

    I have no experience with that plugin, so maybe it is rounding the data?

  • Yes I'm sure it is - it's rounding down the whole time.

    I just cannot see where this is happening.

  • Yes I'm sure it is - it's rounding down the whole time.

    I just cannot see where this is happening.

    Just as a side note, in construct 3 you need a https server to see the ajax info.

    Most Servers let you use a free Https, called Let's Encrypt.

  • Thanks - I am on an https server using Construct3 - but it only shows when i upload the files to the server manually and view through a browser.

  • If I remove the decimal point, e.g. 12.34 > 1234 - the full four digit number shows.

    so it's definitely rounding on the decimal.

    if i change the value in the database to 20s 12ms, it comes into the leaderboard as 20. So it seems like it will only read a number, and then anything after that is clipped??

  • You can simply multiply all scores by 100 before submitting them.

    And then when you retrieve scores from the server to show on the leaderboard, divide them by 100.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)