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-29-2013 , 13:44   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #11

On windows the config file is built properly with the additional/missing CVars with appropriate formatting... on Linux, the new CVars and descriptions are all on one long line.

Maybe I don't have the permission on the file set properly, because I see you write "\n" but it just failed to write on my .cfg file...

The file attributes for my config file is: 664
__________________
View my Plugins | Donate

Last edited by TnTSCS; 07-29-2013 at 13:50.
TnTSCS is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-29-2013 , 17:33   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #12

I'm sorry if this sounds dumb, but which editor do you use to open/read the file?

Yours sincerely
Impact
__________________

Last edited by Impact123; 07-29-2013 at 17:40.
Impact123 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-29-2013 , 17:45   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #13

The last time I opened it and edited it was withing FileZilla from a Windows box... so, notepad.

I guess that could be the culprit

I'll have to open it with gedit again, remove a couple of CVars and let the plugin append the file and let you know how it goes. I've edited the cfg and remove 3 CVars that were set to default anyways, I'll reply once the map has changed.
__________________
View my Plugins | Donate
TnTSCS is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-29-2013 , 17:53   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #14

Yep, if you open up the file in a editor like notepad++ it looks fine.

Yours sincerely
Impact
__________________
Impact123 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-29-2013 , 18:01   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #15

That's right, because windows uses the \r\n for a new line... sorry about that.

...:: TnT Edit ::...

If, in my CreateConVar I have some \n's in there, they are not properly carried over in the config.

They show up missing the // characters, like:

PHP Code:
// Use the iBots_maxfrags?
NO
YES
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
iBots_usemaxfrags "1"

// Team number for bots (2 is T, 3 is CT)
// -
// Default: "2"
// Minimum: "2.000000"
// Maximum: "3.000000"
iBots_TEAM_BOT "2"

// Utilize 'Updater' plugin to auto-update iBots when updates are published?
1=yes0=no
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
iBots_useupdater "0" 
the usemaxfrags:
PHP Code:
AutoExecConfig_CreateConVar("iBots_usemaxfrags""1""Use the iBots_maxfrags?\n0 = NO\n1 = YES"_true0.0true1.0
__________________
View my Plugins | Donate

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

Well, the original autoexecconfig does the same, i don't know if it would be a good thing to alter this behavior.

Yours sincerely
Impact
__________________
Impact123 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-29-2013 , 18:09   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #17

The sourcemod autoexecconfig puts //'s on the new line created by the \n in the description

...:: TnT Edit ::...
You were probably talking about the \r\n thing, right? Not the //'s thing
__________________
View my Plugins | Donate

Last edited by TnTSCS; 07-29-2013 at 18:11.
TnTSCS is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-29-2013 , 18:37   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #18

Yeah, i see, it's this part that does it.
I see if i can implement it tomorrow.

Yours sincerely
Impact
__________________
Impact123 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-29-2013 , 21:19   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #19

Cool, thanks... I was going to try and update the code on github, but if you're going to do it, that's better, I'll learn by looking
__________________
View my Plugins | Donate
TnTSCS is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-30-2013 , 07:15   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #20

Well, feel free to contribute if you want
I added support for multiline comments, i used a different approach than the original autoexecconifig function, but it seems to work fine.
It was important to me that it doesn't slow things down when you don't use newlines, i think i found a good way between some overhead and easyness.
My only concern is that you might run into a "Not enough space on the stack" error if you have dozens of newlines, but we'll see.
Here is the commit.

Yours sincerely
Impact
__________________

Last edited by Impact123; 07-30-2013 at 07:19.
Impact123 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 04:29.


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