Jump to content

How do I save data?


MasterBroNetwork

Recommended Posts

What do you mean? You want to save player data like their level amount into a variable with skript?

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

Heya


I think you are referring to Variables. If you would like to store a (custom) level, a simple solution would be to do this:

set {Level::%player's uuid%} to 20

or If you want player data like experience levels, you can simply do:

send "You are currently level %level of player%" to player

https://skripthub.net/docs/?id=928

Remember a variable can store pretty much anything as long as it's a valid "type". Using Skripthub, expressions in green, those return a value or determine one. When you want to send an expression, it returns a value.
Many expressions can also be edited. You can of course mathematically add/subtract if appropriate.

set player's level to 20

 

I hope this provides an answer. 🙂 

Feel free to contact me or continue this thread if you need more help

 

  • Like 1

 

image.png.e46e91961f1d6d4604a6e5f3dcb5a2bd.png

unknown.pngunknown.png

Link to comment
Share on other sites

1 hour ago, AWorthySon said:

Heya


I think you are referring to Variables. If you would like to store a (custom) level, a simple solution would be to do this:


set {Level::%player's uuid%} to 20

or If you want player data like experience levels, you can simply do:


send "You are currently level %level of player%" to player

https://skripthub.net/docs/?id=928

Remember a variable can store pretty much anything as long as it's a valid "type". Using Skripthub, expressions in green, those return a value or determine one. When you want to send an expression, it returns a value.
Many expressions can also be edited. You can of course mathematically add/subtract if appropriate.


set player's level to 20

 

I hope this provides an answer. 🙂 

Feel free to contact me or continue this thread if you need more help

 

Mainly on how to save player data so it stays after a server restart.

🙂 Enjoy your life because you never know when it could end.

Former VIP - Minehut

OWNER - Arcame

image.png.df1c3f201cda084b7313b77eff612802.png

Link to comment
Share on other sites

1 hour ago, DivisionG said:

Mainly on how to save player data so it stays after a server restart.

All variables except local variables are saved in the memory until deleted. Whenever the server shuts down, it's written down into the variable.csv file. Unless that file is touched, variables/data WILL NOT be lost.

 

Example of "LOCAL" variables.

command /test:
	trigger:
    	set {_hey} to "hey!"
        send {_hey} to player
        
command /test2:
	trigger:
    	send {_hey} to player
        #This will NOT send anything.

Everything else are just regular variables, and will not delete unless you manually do it. You can change the value if you wish to.

  • Like 1

 

image.png.e46e91961f1d6d4604a6e5f3dcb5a2bd.png

unknown.pngunknown.png

Link to comment
Share on other sites

On 8/25/2020 at 9:30 PM, AWorthySon said:

All variables except local variables are saved in the memory until deleted. Whenever the server shuts down, it's written down into the variable.csv file. Unless that file is touched, variables/data WILL NOT be lost.

 

Example of "LOCAL" variables.


command /test:
	trigger:
    	set {_hey} to "hey!"
        send {_hey} to player
        
command /test2:
	trigger:
    	send {_hey} to player
        #This will NOT send anything.

Everything else are just regular variables, and will not delete unless you manually do it. You can change the value if you wish to.

Thanks @AWorthySon for your assistance!

So backing up data like scores and all of that is as easy as copying the .csv file?

🙂 Enjoy your life because you never know when it could end.

Former VIP - Minehut

OWNER - Arcame

image.png.df1c3f201cda084b7313b77eff612802.png

Link to comment
Share on other sites

2 hours ago, DivisionG said:

Thanks @AWorthySon for your assistance!

So backing up data like scores and all of that is as easy as copying the .csv file?

Skript does everything for you. All Scores/data will be in the .csv file.

Don't touch it 😉

There is an automatic backup system, you'll find backups of the variables.csv file in the backups folder, but yes, you can copy-paste the .csv file if you'd like.

Reminder: The file only updates when you close the server.

Edited by AWorthySon
  • Like 1

 

image.png.e46e91961f1d6d4604a6e5f3dcb5a2bd.png

unknown.pngunknown.png

Link to comment
Share on other sites

17 hours ago, AWorthySon said:

Skript does everything for you. All Scores/data will be in the .csv file.

Don't touch it 😉

There is an automatic backup system, you'll find backups of the variables.csv file in the backups folder, but yes, you can copy-paste the .csv file if you'd like.

Reminder: The file only updates when you close the server.

Thanks, good to know.

🙂 Enjoy your life because you never know when it could end.

Former VIP - Minehut

OWNER - Arcame

image.png.df1c3f201cda084b7313b77eff612802.png

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...