Raised This Month: $51 Target: $400
 12% 

KvSetString overwrites entries


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pilger
Senior Member
Join Date: Sep 2010
Old 05-03-2015 , 20:28   KvSetString overwrites entries
Reply With Quote #1

Hey guys,

I need to write a KeyValue structure like this:
Code:
"Menu"
{
    "Category1"
    {
        "item"     "Command1"
        "item"     "Command2"
        "item"     "Command3"
        "item"     "Command4"
    }
    "Category2"
    {
        "item"     "Command5"
        "item"     "Command6"
    }
}
But all I get is this:
Code:
"Menu"
{
    "Category1"
    {
        "item"     "Command4"
    }
    "Category2"
    {
        "item"     "Command6"
    }
}
It seems that KvSetString() only allow one entry with a due name.

Is there a way to get around that!? To force it to repeat itself?

Thanks in advance.
__________________
pilger is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-03-2015 , 20:30   Re: KvSetString overwrites entries
Reply With Quote #2

No you can't. It's the way Valve coded the keyvalues system(The EXACT same system SM KeyValues natives use)
__________________
WildCard65 is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 05-03-2015 , 20:31   Re: KvSetString overwrites entries
Reply With Quote #3

The sub-keys must have unique names within each key. For example itemOne, itemTwo.
Darkness_ is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 05-03-2015 , 20:35   Re: KvSetString overwrites entries
Reply With Quote #4

Quote:
Originally Posted by pilger View Post
Code:
"Menu"
{
    "Category1"
    {
        "Command1"     "item"
        "Command2"     "item"
        "Command3"     "item"
        "Command4"     "item"
    }
    "Category2"
    {
        "Command5"     "item"
        "Command6"     "item"
    }
}
Fixed?
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
pilger
Senior Member
Join Date: Sep 2010
Old 05-03-2015 , 20:36   Re: KvSetString overwrites entries
Reply With Quote #5

This was intented to create a "admin_sorting.txt" file to sort my menus.

Guess I'll have to write my own function to write the file, then.

Thanks guys
__________________
pilger is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-03-2015 , 21:09   Re: KvSetString overwrites entries
Reply With Quote #6

admin_sorting.txt isn't KeyValues. It's in "SourceMod Configuration" (or SMC) format. While it looks a lot like KeyValues, the two aren't the same.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
pilger
Senior Member
Join Date: Sep 2010
Old 05-03-2015 , 21:20   Re: KvSetString overwrites entries
Reply With Quote #7

Oh. Didn't realize that. Thanks Powerlord.

My intention was to create a sorting file in the exact same order as the menu_custom.txt. So I've written a little function use the "files" functions that did the trick quite well. It even deletes the file afterwards. It's pretty simple and worked quite well.

Thanks to all for the assistance.
__________________
pilger is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode