Raised This Month: $7 Target: $400
 1% 

[INCLUDE] AutoExecConfig: Read and append to auto configs


Post New Thread Reply   
 
Thread Tools Display Modes
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-30-2013 , 09:55   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #21

nice - thank you Impact!
__________________
View my Plugins | Donate
TnTSCS is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-30-2013 , 12:36   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #22

Very nice work, I have only just seen this thread.

I made a plugin which does something similar. Backup the cvar configs, have plugins generate new configs and update any custom cvar values. http://forums.alliedmods.net/showthread.php?t=188756 for those plugins which do not use the include.
__________________
Silvers is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 08-05-2013 , 13:10   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #23

Another Update.
Thanks to Peace-Maker, the include is now a little bit easier to use, especially for bigger plugins.

Instead of using
PHP Code:
AutoExecConfig(true"plugin.myplugin"); 
You now can simply use this
PHP Code:
AutoExecConfig_ExecuteFile(); 
This makes an internal call to AutoExecConfig with the data you set by AutoExecConfig_SetFile.

The include is now able to create the configfile by itself if it doesn't exists, by default this is disabled and can be enabled like this
PHP Code:
AutoExecConfig_SetCreateFile(true); 
To those who haven't noticed, thanks to TnTSCS you can now use newline characters in your convar description like so
PHP Code:
AutoExecConfig_CreateConVar("newlinetest""SomeCvar""This\nIs\nA\nNewline\nTest"FCVAR_PLUGIN); 
The result will look something like this

PHP Code:
// This
// Is
// A
// Newlie
// Test
// Default: "SomeCvar"
newlinetest "SomeCvar" 
Yours sincerely
Impact
__________________
Impact123 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 08-05-2013 , 13:12   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #24

Thank you Impact

Now I'll be using this for all plugins, including the first release
__________________
View my Plugins | Donate
TnTSCS is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-21-2013 , 14:02   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #25

Just now finding this, where has this been all my life! Now to update all my plugins to use it.

Side note, missing ; on line 154.
__________________
thetwistedpanda is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 08-21-2013 , 16:44   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #26

yes, I meant to post that earlier today about the missing ;

The end of line 150 is where it needs a ";"

strcopy(g_sFolderPath, sizeof(g_sFolderPath), folder)

Pull request sent
__________________
View my Plugins | Donate

Last edited by TnTSCS; 08-21-2013 at 16:52.
TnTSCS is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 08-21-2013 , 17:15   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #27

My personal coding style is that i use the semicolon enforcing after including files, because of that i couldn't saw the warning.
The pull request by TnTSCS was merged (thank you), and the order of the pragmas in the testsuite were switched, it shouldn't happen again.
Thanks for letting me know, sorry for the inconveniences.

Yours sincerely
Impact
__________________

Last edited by Impact123; 08-21-2013 at 17:18.
Impact123 is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 12-07-2013 , 17:47   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #28

I would like to use this, but perhaps it doesn't do what I thought. I see that it's adding new cvars, but none of the default values change when I change them, not even the version. Does this not update default values, descriptions, etc. of existing cvars?

Edit:
What I want, is that when I update a plugin, the user's corresponding .cfg file automatically:
1. Updates all of the data to existing cvar, such as default value, description, minimum value
2. Adds any new cvars
3. Removes any cvars that have been removed from the plugin
4. If a cvar already exists, leaves any user entered values in place
5. User comments left in place

What I don't care about so much:
User commands/cvars unrelated to the plugin being removed

Does this include have all of those, or part of those capabilities?
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera

Last edited by Bittersweet; 12-07-2013 at 17:56.
Bittersweet is offline
dordnung
Veteran Member
Join Date: Apr 2010
Old 12-07-2013 , 17:52   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #29

How would you change to default value?
__________________
dordnung is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 12-07-2013 , 18:05   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #30

Quote:
Originally Posted by Popoklopsi View Post
How would you change to default value?
PHP Code:
AutoExecConfig_CreateConVar("myplugin_version"PLUGIN_VERSION"Version of myplugin"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY
Above, the default value for myplugin_version is specified as PLUGIN_VERSION. When PLUGIN_VERSION changes, the default value changes.
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera

Last edited by Bittersweet; 12-07-2013 at 18:07.
Bittersweet 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 06:14.


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