A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [F8] How to create an Automatic High Score Reset?

Hybrid View

  1. #1
    Member
    Join Date
    Nov 2006
    Posts
    50

    [F8] How to create an Automatic High Score Reset?

    I am working on a game that uses a MySQL database for high score list tables. The reading and updating of the scores to the MySQL database table is done via Flash Remoting/Coldfusion methods.

    I am not sure how to get the high score database to "Reset" automatically after every 7 days, or once every 24 hours or something like that. Where automatically after a certain duration, the database table rows are reset to a default value, chronically and automatically after a set duration of time has passed on a cyclic basis.

    I realize that I could have the instance of the flash game itself, when downloaded and played, check to see how much time has passed since last reset.. But what about making the reset independent of the game itself? So that scores can be reset at a specific time interval, whether or not anyone is actually running the game .swf.. At Neave.com, his score lists automatically reset, but I don't know how he accomplishes it.

    Any suggestions on how this can be done?

  2. #2
    When the user requests the high score you need to check if it has been > 7 days from the last reset. If so then you reset the scores before sending them to the user. No magic really

  3. #3
    Member
    Join Date
    Nov 2006
    Posts
    50
    So that is the only way then. To have the actual game SWF check the database to see when the last reset was done, when it goes to read the high score table. Which means the "reset" will not occur exactly after 7 days, only on the first time the game SWF is run after 7 days have passed, which may be 10 or 14 days after the last reset.

    I thought perhaps there might be another way of doing it..

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Why do you need to reset the table "exactly" at the set time? If nobody is going to look at the highscores for 14 days then it doesnt matter if the scores were reset at 7 days or not, it only matters that they get reset once someone wants to see them.

  5. #5
    Senior Member webgeek's Avatar
    Join Date
    Sep 2000
    Posts
    1,356
    I agree with Tonypa. I'd just check when someone loads the scores to see if they need to be cleared or not. If you want to do it on an actual schedule, ColdFusion has the ability to schedule a page for execution on a timer. You can just schedule it to occur every 7 days at 2am or some such.

    http://livedocs.adobe.com/coldfusion...s/tags-a30.htm

  6. #6
    Member
    Join Date
    Nov 2006
    Posts
    50
    Thanks webgeek! I was thinking that maybe Coldfusion could do it somehow on a schedule. I looked up the cfschedule tag and will check if my host provider allows it to be used on their CF server.

  7. #7
    Member
    Join Date
    Apr 2007
    Posts
    43
    failing that you could use 'cron jobs' which is what I do whenever I want something to happen every minute or hour, day, month etc... Most linux hosting systems I've used allow you to set one up fairly easily... post again if you have any problems and i'll try to help

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center