Jump to content
The Bunny Gamer

HTML [SQLITE] Automatic HTML Leaderboards with Python

Recommended Posts

SQLITE AUTOMATIC HTML LEADERBOARDS

IN COLLABORATION WITH PYTHON

 

Rules for use

You don't have to credit me for the idea (although appreciated), but if you use the python script I made then you must credit me.

 

Advantages and Disadvantages of using this method

Advantages:

  • VERY simple.
  • Accepts SQLite.
  • Very customisable.
  • Uses Python and HTML.
  • The script tells you of any changes to the leaderboard.

Disadvantages:

  • Does not accept MySQL.
  • Only supports Windows (you must have onedrive accessible from file manager).
  • You must run the script at all times for the leaderboard to update.

 

Script

Automatic HTML Updater

 

How to use

It is very to simple to use. Just 10 simple steps.

 

1. Download the python script.

2. Open file manager.

3. There should be a "OneDrive" tab on the left. Click this.

4. Create a new, empty folder.

5. In the folder, create a HTML document. To do so, open notepad, create a new text document and save it in that same folder but with a ".html" extension.

6. Name the HTML file something like "[Your Game Name] Leaderboards".

7. Head to the online version of OneDrive.

8. Right click the HTML file (NOT folder) that you made and click share. Set the folder to have the sharing options: viewable by anyone with link.

9. Open an editable version of the python script (downloadable above). You can do this by downloading python (v2.7) or simply with notepad. Edit the configuration settings. The HTML file path is the HTML file you created in onedrive's directory in file manager, and the database is the directory of your SQLite database. DON'T USE BACKSLASHES (\) AS THEY WILL STOP THE SCRIPT FROM WORKING! Instead, replace all backslashes (\) with forward slashes (/).

10. You are done! To use the updater, just at the same time you are running your intersect server, run the python script. Keep it running - it acts like a server and updates the HTML to the up-to-date leaderboard every 20 seconds (you can modify this). For someone to find the leaderboard, you should share them the link of the HTML file. To make this link shorter, you could use tinyurl.

 

If you are stuck on any of the steps let me know!

Share this post


Link to post
Share on other sites
19 hours ago, buu said:

I'm sure I've seen this somewhere on this website before...

 

If you look up you can see the link to the SQLite <==> Python connector, but I added the leaderboard part and the automatic updater part.

Share this post


Link to post
Share on other sites

Also, I found a helpful tool while using this engine. When a difference is found, it tells you it in a big block. To compare the differences between two texts you can use this: https://www.diffchecker.com/diff

 

So for instance:

 

Update 1:

Bunny - lvl 1 exp 50

Blop - lvl 2 exp 999

Blinkyboopyblop - lvl 1 exp 56

 

Update 2:

Bunny - lvl 1 exp 51

Blop - lvl 2 exp 999

Blinkyboopyblop - lvl 1 exp 56

 

It will tell you that bunny has got 1 more exp.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...