Keyfilter

From EventScripts Community Encyclopedia


Overview

Syntax: keyfilter <keygroup> <key> <not/only> <partial-keyvalue-name> [value]

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: {{{x}}}

Description

This command goes through the specified key and filters out any key-values matching your description. It's handy for es_foreachval, if you don't want it to be part of the loop.

Parameters

  • <keygroup>: - Keygroup that the key to filter is in
  • <key>: - Key to filter
  • <not/only>: - Will filter out any values NOT matching the inputs, or ONLY the inputs. (Doesn't apply to the [value] argument)
  • <partial-keyvalue-name>: - Any values containing the partial input will be either kept or filtered depending on the <not/only> input
  • [value]: - All value-names matching <partial-keyvalue-name> will need to have this value to be kept or deleted (Optional)

Examples

es_keygroupcreate example
es_keycreate example examplekey
es_keysetvalue example examplekey val1 deleteme
es_keysetvalue example examplekey val2 deleteme
es_keysetvalue example examplekey val3 keepme
es_keysetvalue example examplekey val4 keepme
es_keysetvalue example examplekey _delete_me 1
es_keysetvalue example examplekey _keep_me 0
Keygroup: example
  Key: examplekey
    Keyname: val1
    Keyvalue: deleteme
    Keyname: val2 
    Keyvalue: deleteme
    Keyname: val3 
    Keyvalue: keepme
    Keyname: val4 
    Keyvalue: keepme
    Keyname: _delete_me
    Keyvalue: 1
    Keyname: _delete_me2
    Keyvalue: 0
keyfilter example examplekey not val deleteme

Would filter out all of the keynames with "val" in it, only if it's value is deleteme

keyfilter example examplekey not val keepme

Would filter out all of the keynames with "val" in it, only if it's value is keepme We are left with the last two Keyname/values

keyfilter example examplekey only _delete 0

Would filter out the _delete_me with the value of 1. Since I said only keep the names with _delete in it and a value of 0 _delete_me2 was kept.


Notes

  • Good for cleaning up keys
  • You can now delete the values and they won't be included in es_foreachval anymore


See also


External links

none


{{{category}}}

blog comments powered by Disqus