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

Keyvalues


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
IBeMad
Junior Member
Join Date: Apr 2011
Old 06-28-2011 , 17:44   Keyvalues
Reply With Quote #1

Hey everyone,

I was wondering if it was possible to have either multiple root nodes in a keyvalues file or put a subkey within a subkey. Something like this:

Code:
"MyFile"
{
	"STEAM_0:0:7"
	{
		"Brutal"
		{
			"key"		"value"
		}
	}
}
or this:

Code:
"MyFile"
{
	"STEAM_0:0:7"
	{
		"key"		"value"
	}
}
"MyFile2"
{
	"STEAM_0:0:8"
	{
		"key2"	"value2"
	}
}
IBeMad is offline
Benjamin1995
SourceMod Donor
Join Date: May 2009
Location: Germany
Old 06-28-2011 , 17:59   Re: Keyvalues
Reply With Quote #2

I Think it is:

CreateKeyValues("Firstnode");

Regards Benni
__________________
Benjamin1995 is offline
Send a message via Skype™ to Benjamin1995
IBeMad
Junior Member
Join Date: Apr 2011
Old 06-28-2011 , 18:24   Re: Keyvalues
Reply With Quote #3

I've tried that already.

CreateKeyValues("SecondNode");
FileToKeyValues //To load the existing file
//blah blah blah
KeyValuesToFile
CloseHandle

It ends up not making any changes, and I still have only 1 root node.
IBeMad is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-28-2011 , 18:42   Re: Keyvalues
Reply With Quote #4

You can't have multiple root nodes in one file, but you can have multiple subkeys, they are like rootnodes so it doesn't matter.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
IBeMad
Junior Member
Join Date: Apr 2011
Old 06-28-2011 , 18:44   Re: Keyvalues
Reply With Quote #5

Can I have subkeys within subkeys? If so, how?
IBeMad is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-28-2011 , 19:14   Re: Keyvalues
Reply With Quote #6

Using KvJumpToKey or KvGotoNextKey.

Also read: KeyValues (SourceMod Scripting)
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
IBeMad
Junior Member
Join Date: Apr 2011
Old 06-28-2011 , 21:23   Re: Keyvalues
Reply With Quote #7

Nevermind. Forgot you can't have empty sections.

Last edited by IBeMad; 06-28-2011 at 21:36.
IBeMad 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 12:05.


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