Jump to content

stupid data storage


JoshG

Recommended Posts

These days people will do anything to store data outside of just regular skript variables.

Some good options include:
- an external database
- yml


but I came up with the most stupid idea and i think it might actually work
a brief description, is that I will be offloading all skript variables to a webserver. thats it!
yes I know this is dumb and slow and not made for production
i will be attaching the github here and posting updates to this thread!


i've come up with a file tree, and opted to use php.
Here's the file tree:

get.php:
- returns value of variable, if not exist return NULL
- use: get.php?uuid=UUID&variable=VARIABLE


reset.php:
- resets / creates their directory
- use: reset.php?uuid=UUID

set.php:
- sets a variable to a new value
- use: set.php?uuid=UUID&variable=VARIABLE&value=VALUE

 

A hurdle to get over will be storing server variables, not just player data. This will be stored under the uuid "server"
So to get say, the price of dirt in the "dirtPrice" variable, we request get.php?uuid=server&variable=dirtPrice

For the serverside, the variables will be stored in a master directory called "data"

In this directory resides more directories, named the UUIDs. Inside of those, even more directories, one for each variable. Inside those directories, is variable.txt. Containing just the value of the variable.

So dirtPrice, will be:
data/server/dirtPrice/variable.txt

the value of variable.txt just being "1.00" or something.


All files and changes will be on https://github.com/diamondscode/php-skript-what

Enjoy lmao

If I helped you at all please consider boosting my account with the follow button!
Minehut ♥ [VIP] 12/19/2020 - Present

I am either extremely active or not lol.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...