Raised This Month: $23 Target: $400
 5% 

Settings API (load/save data to INI files)


Post New Thread Reply   
 
Thread Tools Display Modes
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 07-02-2014 , 01:15   Re: Settings API (load/save data to INI files)
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
I guess I really don't understand the purpose. It appears to me that it's just a global .ini file that can be used by several plugins at once instead of each plugin using it's own.
Since you can specify filename each plugin can use it's own.

On glance it seems like a great API for people that are unable or too lazy to write their own parser.

Quote:
Originally Posted by meTaLiCroSS View Post
Yeah, I saw it, but it changes something the "readability" of it? Would be different reading a .txt from a .ini?
It depends on what you put in it, which is completely up to the author.
__________________
http://xyproblem.info/

Code:
if ( regex_match(ForumThreadTitle, regex("(zombie)|(vip)")) )    return NEXT;

Last edited by Black Rose; 07-02-2014 at 01:18.
Black Rose is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-02-2014 , 02:06   Re: Settings API (load/save data to INI files)
Reply With Quote #12

Firstly Good Job ..

I got 3 queries ..

1. Comparing it with plugins using nvault scenario ?

Its well know fact that nvault is not suitable for use with Mods (Like point mods,Xp mods) which store and fetch huge user data .. So is this going to be any better in efficiency and data fetching speed ?

2. What if i use 2 different plugins to read the same ini file at the same time .. Will that gonna be a problem ?

3. Okay I have my Cpanel .. and i have a plugin installed that is reading and writing data to this INI file.. in the meanwhile i open up the ini file for editing externally from cpanel .. Now what ? Data loss ?
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 07-02-2014 , 02:33   Re: Settings API (load/save data to INI files)
Reply With Quote #13

Quote:
Originally Posted by devilicioux View Post
Firstly Good Job ..

I got 3 queries ..

1. Comparing it with plugins using nvault scenario ?

Its well know fact that nvault is not suitable for use with Mods (Like point mods,Xp mods) which store and fetch huge user data .. So is this going to be any better in efficiency and data fetching speed ?

2. What if i use 2 different plugins to read the same ini file at the same time .. Will that gonna be a problem ?

3. Okay I have my Cpanel .. and i have a plugin installed that is reading and writing data to this INI file.. in the meanwhile i open up the ini file for editing externally from cpanel .. Now what ? Data loss ?
1. I think you misunderstood the purpose of this API. It's for settings, not for data storage.
2. Impossible. HLDS is single-threaded. One plugin cannot use it before the one before is done.
3. Probably related to the misunderstanding.
__________________
http://xyproblem.info/

Code:
if ( regex_match(ForumThreadTitle, regex("(zombie)|(vip)")) )    return NEXT;
Black Rose is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 07-02-2014 , 02:33   Re: Settings API (load/save data to INI files)
Reply With Quote #14

Quote:
Originally Posted by devilicioux View Post
Firstly Good Job ..

I got 3 queries ..

1. Comparing it with plugins using nvault scenario ?

Its well know fact that nvault is not suitable for use with Mods (Like point mods,Xp mods) which store and fetch huge user data .. So is this going to be any better in efficiency and data fetching speed ?

2. What if i use 2 different plugins to read the same ini file at the same time .. Will that gonna be a problem ?

3. Okay I have my Cpanel .. and i have a plugin installed that is reading and writing data to this INI file.. in the meanwhile i open up the ini file for editing externally from cpanel .. Now what ? Data loss ?
The purpose of this is to create config files, not databases lol don't compare it with nvault, there's no data loss or something, did you read the whole post?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-02-2014 , 04:10   Re: Settings API (load/save data to INI files)
Reply With Quote #15

So, really, it's just a fancy INI parser. I think I'd rather have an uncomplicated INI parser than what is described here.

I guess I don't entirley understand the part regarding that it "can store a variable amount of values in a single key". That sounds like it might just be a way of saying that instead of having a configuration variable as such:

Code:
myguns = "colt;luger;carbine;garand"
and then parsing the semi-colons manually into an array.

If I've interpreted the description correctly, this would instead become this:

Code:
myguns = "colt"
myguns = "luger"
myguns = "carbine"
myguns = "garand"
and I would get the same array but without the need to do the parsing step.

Is this interpretation of the description correct?




Quote:
Originally Posted by meTaLiCroSS View Post
Yeah, I saw it, but it changes something the "readability" of it? Would be different reading a .txt from a .ini?
A text file (.txt) is ambiguous. It means nothing other than it contains text (i.e. human readable text). The technicalities of "reading" the two files is exactly the same (since they are both technically "text" files containing human readable text).

It merely differs in the interpretation. Both .cpp and .sma source code files are text files but they are interpreted differently (by their respective compilers). The extension is merely used to tell programs [and humans] how to interpret it.
__________________
fysiks is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-02-2014 , 19:19   Re: Settings API (load/save data to INI files)
Reply With Quote #16

Quote:
Originally Posted by meTaLiCroSS View Post
What's the difference between using "txt" files and "ini" files? Or "cfgs", and others? I don't really know

This would be good as a 3rd party module, for avoiding usage
The only thing it changes it's the file extension name.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-03-2014 , 04:22   Re: Settings API (load/save data to INI files)
Reply With Quote #17

Quote:
Originally Posted by Black Rose View Post
1. I think you misunderstood the purpose of this API. It's for settings, not for data storage.
3. Probably related to the misunderstanding.
OOPs yes .. got it .. Misunderstanding.. !!

Quote:
Originally Posted by Black Rose View Post
Impossible. HLDS is single-threaded. One plugin cannot use it before the one before is done.
Even Reading the INI file from 2 plugins simultaneously is gonna be a problem ?

Quote:
Originally Posted by meTaLiCroSS View Post
The purpose of this is to create config files, not databases lol don't compare it with nvault, there's no data loss or something, did you read the whole post?
I did read the entire post but misunderstood few things .. i dont remember correctly but i found some plugin few weeks ago that was creating databases on ini files.Fetching things from 1 ini file and retrieving data from the other on bases of data fetched from the first.. so thought it was something related to that .. Database on ini files.My Bad.

and i am still confused about the purpose of this .. i think better dynamic parsing methods already exist .. whats better and different


Is there some fetching speed difference between txt , cfg and ini files or something ?
Why INI ?
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then

Last edited by devilicioux; 07-03-2014 at 04:24.
devilicioux is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-04-2014 , 08:09   Re: Settings API (load/save data to INI files)
Reply With Quote #18

You should know this:
1. A cfg file is a file that can be executed by server, it is very usefull when you want to create a cfg file to store cvars.
2. A ini file can't be directly executed by server, you need to create a function that will read it. Let's say that you have a plugin that set a player model, but you want that users to be able to change this models WITHOUT editing source code. You can make a ini file where you can put this line: model1 models/player/model1.mdl, then you could read model1 line and get value from it: models/player/model1.mdl
3. ini and txt file are the same AFAIK.

Hope now you understand why this is for ini files.

Last edited by HamletEagle; 07-04-2014 at 08:10.
HamletEagle is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 07-04-2014 , 08:55   Re: Settings API (load/save data to INI files)
Reply With Quote #19

Quote:
Originally Posted by HamletEagle View Post
You should know this:
1. A cfg file is a file that can be executed by server, it is very usefull when you want to create a cfg file to store cvars.
2. A ini file can't be directly executed by server, you need to create a function that will read it. Let's say that you have a plugin that set a player model, but you want that users to be able to change this models WITHOUT editing source code. You can make a ini file where you can put this line: model1 models/player/model1.mdl, then you could read model1 line and get value from it: models/player/model1.mdl
3. ini and txt file are the same AFAIK.

Hope now you understand why this is for ini files.
Ini files obviously do have a standard according to someone, but not all applications follow it, AMX Mod X for example.

All files are exactly the same. No matter what extension. Even binary files. It's up to each application to decide how the contents is interpreted.
__________________
http://xyproblem.info/

Code:
if ( regex_match(ForumThreadTitle, regex("(zombie)|(vip)")) )    return NEXT;
Black Rose is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-09-2014 , 15:01   Re: Settings API (load/save data to INI files)
Reply With Quote #20

You should increase strings buffer size
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Reply


Thread Tools
Display Modes

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:17.


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