How To: Save Data
I've been seeing a lot of confusion over how to save data cross mapchange/server disconnect, so I wanted to write a tutorial on how to correctly pick and save data.
There are four basic ways to save data cross mapchange, and three cross server disconnect: 1. Files <direct> 2. Vault Systems <files indirect> 3. MYSQL 4. ArrayX ArrayX is a dynamic array module that is not quite done yet, so I will not go into detail about it quite yet. It will, however, support cross map change dynamic storage. Step 1: Choosing your saving method. Choosing a saving method can be a little confusing to some, so follow these simple rules: FILE: For very small settings, you might want to use a direct file. For example, if you need to save five variables cross server connect, you might wanna just use a file system. In addition, if you want to save things that cannot easily be saved into the vault, your not going to want to use vault or mysql. For a quick and simple file system, I rescripted and tested CVault, which is stocks for making a simple file vault systems, no module. VAULT: If a file solution is not for you, then perhaps a Vault solution is best. If you need to save a few entries, you can probably use Vault. Vault (default) lags like hell, but if your not using it too much, its very simple to use. If you need to save and recover hundreds of entries, with lightning fast speed, and the capability for various vault files, and you don't feel like compiling NVault or waiting, VaultX might be best for you. If you don't care about the amount of RAM you might use, and want faster Has Table saving, you might wanna pick NVault over VaultX. MYSQL: If you don't care about the end user, or need to save thousands upon millions of entries, all in one database, MYSQL might be for you. Also, if you want info from one server to go to another and do not feel like working with SOCKET module, MYSQL is for you. However, the speed of MYSQL (even on local DB's), can actually be slower then NVAULT and VAULTX, thus negating some of its usefulness. Step 2: Saving Now you've decided which method to save using, you'll have to learn how to save to it right? Files: You can direct write and read to a file using the write_file, read_file commands. However, I like to do it with a simply custom vault system: Code:
However, you could just use write_ and read_ to read direct lines, if you know exactly what line it is on. I recommend using the CVault I just provided if you want to save maybe like, some default values, that have nothing to do with players. Otherwise, use a VAULT system thats a module: VAULT: Vault have a few simple commands: Code:
The default vault saves to ONE file, and allows you to get a key/value pair. It allows you to store data easily. For example: set_vaultdata("Default_Time","1.00") Then you can get it back, no matter what map it is in. However, default Vault is very laggy, and does not allow custom files. VaultX and NVault (which I am not versed in, so will not mention ever again) VaultX simply makes you set the path to the file you want, then use commands as normal. Example: set_vaultxpath(); set_vaultxdata("key","value") VaultX allows for much better vaulting then default vault, and much faster. MYSQL Mysql module is fairly complex, and so will take some time to discuss. When I get home, I will describe how to effectively use it. This Tutorial is incomplete, due to the fact I am writing it away from my home computer, so I will finish it later tonight. - Mel |
Nice... Ill maybe add this to my XP Tutorial later...
(If its ok for you...?) Btw is it there you got the idea? :P |
No, actually its not. I am just sick of people asking me how to use VaultX, why their crappy MYSQL coding doesnt work, etc.
And you can link to it, but this tutorial is entirely seperate. |
Whoa, sounds like Twilight is a bit hot under the collar. Relax dude :) It's the down side of being famous, everybody wants you! lol Seriously though, you released vaultx without an example file; of course people are going to ask for your help.
|
If you read the thread, you can use VaultX. Also, why ask me about MYSQL?
I'm not famous at all tbh. |
All times are GMT -4. The time now is 07:16. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.