PDA

View Full Version : v3arcade reduce scores to keep arcade competitive


bairy
08-24-2006, 10:00 PM
After my arcade had been installed for while I found that all the high scores were practically unbeatable.
I wanted a way to make them beatable again.

I thought about the possibility of just removing the top 5 high scores, but that wouldn't be fair on the winners.
I thought about resetting all the scores but that wouldn't be fair on any of the players.
Then I came to a perfect compromise: Reduce the scores. All the ranks are kept in tact but the high scores are achievable again. As a bonus, it increases competitiveness when the previous top scorers get beaten.

It's all done by a single cron job.

Upload arcadescores.php to /includes/cron
Set a new scheduled task. This one runs on the first of each month:
Day of week: *
Day of month: 1
Hour: 0
Minute: 4
Log: up to you
Filename: ./includes/cron/arcadescores.php

By default the scores are reduced by 15%. If you want to change this percentage, change the 15 to whatever you like on lines 11, 15 and 19 of the script.

Important note: This script will reduce the scores by 15% each time you run it manually or on cron. That means if you install it and want to play around with it, you might want to make a backup of the arcade_games, arcade_sessions and arcade_news tables.

Version 1.01
- Updated to account for games that have reverse scoring
- Now includes table_prefix
- Made the change percentage easier to change

Version 1.02
- Fixed a tiny bug I created in 1.01: If you had no reverse-scoring games it errored.

MissKalunji
08-27-2006, 12:47 AM
i dont get it !?!?

bairy
08-27-2006, 07:50 AM
Once a month (or whenever the cron is run), all the scores that people have acheived are reduced by 15%

HuntrCkr
08-27-2006, 03:17 PM
Excellent mod! I installed this on my arcade and it works flawless. Great work.

MissKalunji
08-27-2006, 09:02 PM
Once a month (or whenever the cron is run), all the scores that people have acheived are reduced by 15%


ohhh smart move!

Thanks

Snake
08-30-2006, 03:56 PM
Thanks for the hack! I'll install it right away... :)

Breaker
10-06-2006, 10:04 PM
great mod/idea... just one problem though. I haven't looked at the code yet, but it appears that all this does is lower the score which is great for all games but ones with reverse scoring which will, over time make it impossible to beat the scores :D

lazydesis
10-07-2006, 01:58 AM
i get this error ...and have no clue why

Database error in vBulletin 3.6.1:

Invalid SQL:

UPDATE arcade_games SET highscore = CEIL(highscore - ((highscore / 100) * 15));

MySQL Error : Table 'lazyindi_comm.arcade_games' doesn't exist

lazydesis
10-07-2006, 03:53 AM
juz realised in the arcadescores.php
instead of

$vbulletin->db->query_write("
UPDATE arcade_games SET highscore = CEIL(highscore - ((highscore / 100) * 15))

u need to have

$vbulletin->db->query_write("
UPDATE forum_arcade_games SET highscore = CEIL(highscore - ((highscore / 100) * 15))


or watever they have there for the prefix

lazydesis
10-07-2006, 03:53 AM
great hack thanx meanwhile :)

bairy
10-07-2006, 02:09 PM
great mod/idea... just one problem though. I haven't looked at the code yet, but it appears that all this does is lower the score which is great for all games but ones with reverse scoring which will, over time make it impossible to beat the scores :D
Oops. You're right, it will.

I'll update it later today or tomorrow so that it lowers normal games and raises reversed games.
I'll also add the table prefix in *slaps wrist*

bairy
10-07-2006, 03:30 PM
Version 1.01
- Updated to account for games that have reverse scoring.
- Now includes table_prefix
- Made the change percentage easier to change.

To upgrade, just replace the includes/cron/arcadereducescores.php with the new one.

Version 1.02 (released very shortly after 1.01)
- Fixed a tiny bug I created in 1.01: If you had no reverse-scoring games it errored.

Blittz
10-07-2006, 03:46 PM
Database error in vBulletin 3.6.1:

Invalid SQL:

UPDATE arcade_games SET highscore = CEIL(highscore - ((highscore / 100) * 15)) WHERE gameid NOT IN ();

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
Error Number : 1064


I just downloaded and installed the script, it seems that $reversegames never got populated, and caused that error.

also... just a tiny suggestion.. put some comments in, at least containing the version number so people know if they have the latest, and perhaps a reminder of where to go to get any updates, etc... Also give yourself credit! :)

bairy
10-07-2006, 04:29 PM
You know when I uploaded it I just had this hunch something was gonna error. And yes, I forgot to test without any reversed games.

Sorted, tested and reuploaded.

With the comments, I've dropped in the version and thread number, good idea :)

Blittz
10-07-2006, 04:31 PM
Ding! yup that fixed it, yay! Thanks again for a usefull script.

lazydesis
10-08-2006, 10:18 PM
u named the file as arcadereducescores.php while the previous file was arcadescores.php

u might want to change the code for the cron or rename the file :)

bairy
10-09-2006, 08:07 AM
Oops. Thanks! Renamed the upload.

WhyDoesItMatter
02-03-2007, 11:39 AM
Could never get this to work properly.. seems to want to run 3 times instead of once for some weird season.

Deadly Assassin
04-06-2007, 06:04 AM
Works like a charm, cheers m8 :up: