Es key commands

From EventScripts Community Encyclopedia

The following is a tutorial for using the following commands at a very basic level:


If you're familiar with the Windows registry, that's not a bad parallel to the es_key* commands. Creating an es_keygroup is a lot like creating a top-level hive in the registry (e.g. something like HKEY_LOCAL_MACHINE). Underneath it, you can use es_keycreate to make subkeys. (At the moment you can only make a single level of subkeys.) In each subkey you can store named values, just like in the registry you might have a value named "Logging" that you store the value "0x04" in.

So if you did this:

es_keygroupcreate Players

You'd get this in memory.

"Players"
{
}

Basically, an empty hive/keygroup. Then if you did this:

es_keycreate Players AceRimmer

it would change the tree in memory to look like this:

"Players"
{
       "AceRimmer"
       {
       }
}
Where we now have a subkey named 'AceRimmer', but we don't have any values stored in him.

Now we'll toss in your rank:

es_keysetvalue Players AceRimmer Rank "Expert"

This will change the layout to be like this:

"Players"
{
       "AceRimmer"
       {
              "Rank" "Expert"
       }
}
You can then add other values that related to "AceRimmer":
es_keysetvalue Players AceRimmer STEAMID "STEAM_0:000000"
es_keysetvalue Players AceRimmer Administrator 0
"Players"
{
       "AceRimmer"
       {
              "Rank" "Expert"
              "STEAMID" "STEAM_0:000000"
              "Administrator" "0"
       }
}

Now I might want to create the same sort of thing for Mattie:

es_keycreate Players Mattie
es_keysetvalue Players Mattie Rank Newbie
es_keysetvalue Players Mattie STEAMID "STEAM_0:000001"
es_keysetvalue Players Mattie Administrator 1

And now you've got more information to use.

es_keylist Players

Outputs:

"Players"
{
       "AceRimmer"
       {
              "Rank" "Expert"
              "STEAMID" "STEAM_0:000000"
              "Administrator" "0"
       }
       "Mattie"
       {
              "Rank" "Newbie"
              "STEAMID" "STEAM_0:000001"
              "Administrator" "1"
       }
}

If you wanted to find out Mattie's rank, you'd just do this:

es_setinfo mattierank 0
es_keygetvalue mattierank Players Mattie Rank
es_msg Mattie is ranked server_var(mattierank)

Would output:

Mattie is ranked Newbie

To delete a key you can use, for example:

es_keydelete Players Mattie

This would delete from the keygroup everything under the "Mattie" key.

You can then save the entire keygroup/tree/hive to disk by using this command:

es_keygroupsave Players

Whenever you want to get it back into memory, use es_keygroupload. Though do not load it if it already exists in memory or it will *append* to the tree in a yucky way. (You can just use es_keygroupdelete to clear it out before a load if you want.)


You can also list all keygroups currently loaded in memory by using this command:

es_keygrouplist
blog comments powered by Disqus