Bay 12 Games Forum

Dwarf Fortress => DF General Discussion => Topic started by: xnrad on June 07, 2010, 01:19:50 am

Title: DFInit file editor [v1.53 ~ 0.31.16]
Post by: xnrad on June 07, 2010, 01:19:50 am
After seeing some comments about the subject of the init file, and how a utility would be nice, I decided to reach back to my high school programming days and make one.

DFInit file editor is exactly what it says on the tin. A small application used to [gasp] edit your init file without using notepad.

Clicky. (http://dffd.wimbli.com/file.php?id=2461)

Spoiler (click to show/hide)

Questions, comments, bugs, angry letters and proclamations of love are all welcome.

iF YOU USED V1.52, PLEASE LOAD DEFAULTS AND SAVE.
1.52 KIND OF ATE THE SPATTER OPTIONS.

Currently version 1.53 for DFv0.31.16:
Fixed Spatter options
Added 'current DF directory' label
Added 'open current DF directory' button


Still has +1 hfs.
I wonder if anyone found it.
Title: Re: DF init file editor
Post by: Thief^ on June 07, 2010, 05:35:35 am
OMG it's VB6 if I'm not mistaken.
EDIT: And the "Royale Noir" Windows XP theme. I used that too before I moved to Windows 7...

The font choices would be nice as a dropdown, it shouldn't be too hard to populate a list from the contents of a folder.
Title: Re: DF init file editor
Post by: darius on June 07, 2010, 05:49:36 am
OMG it's VB6 if I'm not mistaken.
EDIT: And the "Royale Noir" Windows XP theme. I used that too before I moved to Windows 7...

The font choices would be nice as a dropdown, it shouldn't be too hard to populate a list from the contents of a folder.
Yeah theme is da best!... And font choice would be really nice.
Not too sure but i think there is (was) shader printing mode (although undocumented)
Title: Re: DF init file editor
Post by: SanDiego on June 07, 2010, 12:09:04 pm
Duude, that is a good piece of work! I made you a nice ad on czech forums ;)
Title: Re: DF init file editor
Post by: zergl on June 07, 2010, 01:19:48 pm
Nice. I was sketching out a sane design (I hate just hacking away at something especially if it's easy enough to do proper. Specifically I was thinking about which way to go to make it support changes in the init.txt options without recompiling where I was leaning towards an xml file describing the layout. I guess I was overthinking it...) in my mind for pretty much exactly that, but apparently I was beaten. ;(
Title: Re: DF init file editor
Post by: Aklyon on June 07, 2010, 02:22:00 pm
This is really just more convenient than helpful to me, but nice job. it'll be good for new peoples.

You need to make it work with both init.txt AND d_init.txt, though. (or have two programs).
Title: Re: DF init file editor
Post by: xnrad on June 07, 2010, 02:35:38 pm
This is really just more convenient than helpful to me, but nice job. it'll be good for new peoples.

You need to make it work with both init.txt AND d_init.txt, though. (or have two programs).

Oh. Whoops.
So that's where all the other settings went.
I'll get right on that.
:-[
Title: Re: DF init file editor
Post by: Djohaal on June 07, 2010, 03:16:46 pm
Awesome, loved the idea.  :D
Title: Re: DF init file editor
Post by: mnjiman on June 07, 2010, 03:18:14 pm
Nice job man.

Title: Re: DF init file editor
Post by: Funk on June 07, 2010, 03:42:27 pm
look good.
Title: Re: DF init file editor
Post by: Shadowfury333 on June 07, 2010, 04:23:02 pm
Hmm, it doesn't seem to see \data\init\init.txt if any setting isn't correct.

Also, there is no setting for Windowed: PROMPT, only the checkbox. This contributes to the above problem, as Windowed: PROMPT is seen as an incorrect setting.

That aside, great job.
Title: Re: DF init file editor
Post by: xnrad on June 07, 2010, 05:11:58 pm
Hmm, it doesn't seem to see \data\init\init.txt if any setting isn't correct.

Also, there is no setting for Windowed: PROMPT, only the checkbox. This contributes to the above problem, as Windowed: PROMPT is seen as an incorrect setting.

That aside, great job.

I thought that not finding the init would be the only error that function could throw so I only gave it that message. It seems I needs to tell it to yell at you more specifically.
And another oversight; I forgot about having PROMPT as a setting for startup.

Good thing I have you people to help test. :D
Title: Re: DF init file editor
Post by: xnrad on June 10, 2010, 11:35:02 pm
Alright, v1.2 is up.
It adds d_init editing and more helpful error messages.
Title: Re: DF init file editor
Post by: Quatch on June 11, 2010, 10:09:32 am
Toss in a "restore to default" button?

How about a dwarven women have beards checkbox? Its not in the init, but its basically an init option.
Title: Re: DF init file editor
Post by: K4el on June 11, 2010, 12:10:07 pm
Suggestion: Detailed tool tips for each option on mouse over? This utility could make things alot less daunting for new players.
Title: Re: DF init file editor
Post by: Cruxador on June 11, 2010, 01:55:08 pm
Suggestion: Detailed tool tips for each option on mouse over? This utility could make things alot less daunting for new players.
This is a damn good idea.
Title: Re: DF init file editor
Post by: SolarShado on June 11, 2010, 02:55:06 pm
Nice. This idea'd been mentioned before, and I'd considered trying it myself. Cool to see it finally done ;)

How easy'd it be to add support for new options when/if they're added?
Title: Re: DF init file editor
Post by: xnrad on June 11, 2010, 04:06:29 pm
Tooltip text is currently being added.

The ability to support future options would not work with how I wrote this program, unfortunately. I pretty much hard coded everything, and unless I made everything generated on load with a label for a name and a textbox for the value [which would result in an interface similar to just opening the text file anyway], it's not going to happen.

The fact that I'm leaving for navy boot camp in about a month makes this a sobering fact.
I'll make sure to release the source though, if someone wants to keep it up to date.
Title: Re: DF init file editor
Post by: SolarShado on June 11, 2010, 04:39:27 pm
Best of luck in the navy!

I'm not familiar with VB, but I'll definitely look at your source when it becomes available.
Title: Re: DF init file editor
Post by: xnrad on June 26, 2010, 06:53:03 pm
Now supporting 0.31.08, and with arguably helpful tooltips, it's version 1.3

Yay
Title: Re: DF init file editor
Post by: xnrad on June 30, 2010, 02:11:33 pm
Alrighty then, version 1.4 is up for use.

New to this version is the requested default value button, which loads either its built-in defaults or init files found in the base directory.
Internally, the program will handle 'homeless' values much better, meaning it should be at least mostly compatible with future releases.
Which is good, as starting on the 12th, I will be very much AFK.

Also I remembered how to give programs icons so it looks at least 84% prettier.

This should be the second to last release; I am just cleaning up the code and waiting for possible version changes for the final +source release.
Title: Re: DF init file editor
Post by: Tstrangelove on July 26, 2010, 05:20:42 pm
Hi I tried the Lazy newb pack which bundles DF init in with it but whenever I try to run it an error says that tabctl32.ocx or one of it's dependencies is not correctly registered. Do you know how to fix this issue?
Title: Re: DF init file editor
Post by: LucasUP on July 26, 2010, 06:48:43 pm
I think I got a problem like this once. Try running DF Init in administrator mode
Title: Re: DF init file editor
Post by: Tstrangelove on August 13, 2010, 08:25:04 am
Forgot I posted this, it works! thanks.
Title: Re: DF init file editor
Post by: xnrad on September 03, 2010, 06:49:55 pm
So yea.
Things didn't exactly go the way I wanted before I left. And not just with DF Init, but I digress.
Literally the day I was going to finish up and post the .09 update with source, my computer's power supply blew out and I had already packed all my spares and tools away so recovery was effectively impossible. The source is still on two hard drives and a flash drive, so no worries there.
Additionally, I am unable to have any electronics of any kind as I am still living at RTC until the 18th [currently using my mom's laptop which will be departing tomorrow], so all I can do is post this update letting you know I am still alive and well and unable to do much more until further notice.

EDIT::
I need to make a correction, I am in CT right now, in possession of a laptop, and awaiting delivery of my hard drive so I may continue updating. Woo hoo.
Title: Re: DF init file editor
Post by: JonBrant on September 03, 2010, 07:56:55 pm
Love the tool, but it doesn't seem to save some settings. For me, it won't turn autosaves off. /shrug
Other than that, I <3 it
Title: Re: DF init file editor
Post by: xnrad on September 25, 2010, 04:09:19 pm
Update: I have the source files again and am relearning the innards of my own program. Currently adding better file handling so it doesn't have to sit directly in the DF directory; are there any other things you folks would like to see added?

EDIT::

In the meantime, enjoy the new version that doesn't have to spoon Dwarf Fortress.exe to work anymore.
Title: Re: DF init file editor
Post by: LucasUP on September 26, 2010, 01:52:55 pm
Cool beans dude! Glad you can get to updating this again.

Unfortunatley I'm getting the error about missing COMDLG32.OCX or one if its dependencies. I'd occasionaly get a similiar issue with the other version, but it would work most of the time (and almost always when running in admin mode). Not so with this new version.

I'm running Windows Vista 64, and I have the latest VC x86 and x64 redistributables as far as I know.
Title: Re: DF init file editor
Post by: Heliman on September 26, 2010, 01:58:08 pm
*Starts feverishly clapping* stuff like this is good enough to be in the real version! good show man!
Title: Re: DF init file editor
Post by: xnrad on September 26, 2010, 05:18:40 pm
Cool beans dude! Glad you can get to updating this again.

Unfortunatley I'm getting the error about missing COMDLG32.OCX or one if its dependencies. I'd occasionaly get a similiar issue with the other version, but it would work most of the time (and almost always when running in admin mode). Not so with this new version.

I'm running Windows Vista 64, and I have the latest VC x86 and x64 redistributables as far as I know.

Argh. Comdlg32 is a 'common' control for the file select dialog; what's so common about it when it has to be manually included is beyond me.  Also what the heck that file doesn't even exist on my computer.
I will find a copy and add it to the package. And hope it works.
Title: Re: DF init file editor
Post by: Cyntrox on September 26, 2010, 06:08:04 pm
are there any other things you folks would like to see added?
The ability to load the available options from a file (xml?) would be great. That way it doesn't have to be recompiled with new releases just for adding new options.

Other than that, great work!
Title: Re: DF init file editor
Post by: LucasUP on September 28, 2010, 03:01:43 pm
Cool beans dude! Glad you can get to updating this again.

Unfortunatley I'm getting the error about missing COMDLG32.OCX or one if its dependencies. I'd occasionaly get a similiar issue with the other version, but it would work most of the time (and almost always when running in admin mode). Not so with this new version.

I'm running Windows Vista 64, and I have the latest VC x86 and x64 redistributables as far as I know.

Argh. Comdlg32 is a 'common' control for the file select dialog; what's so common about it when it has to be manually included is beyond me.  Also what the heck that file doesn't even exist on my computer.
I will find a copy and add it to the package. And hope it works.

Nice, it works! You still need to run in admin mode in vista, for anyone else having problems.
Title: Re: DFInit file editor [v1.52 ~ 0.31.16]
Post by: thebigJ_A on October 09, 2010, 01:41:30 am
Hey, I just DL'd Phoebus' tileset along with DF .16. Then I downloaded this. A few odd things are happening.

When I go to save the settings, I get two error messages. One says "RESIZABLE was never loaded" and not to worry, it had been put back. The next is the same, but it says [:0] was put back.

The next thing worries me more. When I go to launch DF through DFinit, there's a popup asking if I want to rub un fullscreen (even though I have windowed toggled, and prompt untoggled). Whether I say yes or no, another error pops up saying "tileset not found" for the tileset curses_640x300.png.

Looking in the data/art folder, that tileset is there. Regardless, I'm using the Phoebus tileset.

The game launches when I start it directly, but this has me worried something is messed up. When I got .12 through the Lazy Newb Pack, everything worked fine, aside from the truetype message (which oddly isn't appearing anymore).
Title: Re: DFInit file editor [v1.52 ~ 0.31.16]
Post by: xnrad on October 09, 2010, 08:04:45 am
Hey, I just DL'd Phoebus' tileset along with DF .16. Then I downloaded this. A few odd things are happening.

When I go to save the settings, I get two error messages. One says "RESIZABLE was never loaded" and not to worry, it had been put back. The next is the same, but it says [:0] was put back.

The next thing worries me more. When I go to launch DF through DFinit, there's a popup asking if I want to rub un fullscreen (even though I have windowed toggled, and prompt untoggled). Whether I say yes or no, another error pops up saying "tileset not found" for the tileset curses_640x300.png.

Looking in the data/art folder, that tileset is there. Regardless, I'm using the Phoebus tileset.

The game launches when I start it directly, but this has me worried something is messed up. When I got .12 through the Lazy Newb Pack, everything worked fine, aside from the truetype message (which oddly isn't appearing anymore).

Could I possibly see the init files you are using? I just opened the hood and resizable looks no different from all the other load/save functions. It almost sounds like your resizable value got borked and looks like
[RESIZABLE
:YES]
or something strange like that and I would like to see what makes my program throw up all over itself so I can perhaps add a bib.
Also, you just reminded/inspired me to add a label stating which directory DFInit is working in, as it doesn't necessarily have to be working in the DF folder it is currently in. It may be trying to mess with another directory entirely, yielding these errors.
Title: Re: DFInit file editor [v1.52 ~ 0.31.16]
Post by: LucasUP on October 09, 2010, 02:24:47 pm
I don't know if this helps, but I've gotten the "tileset not found" error before. It happened with my batch files "run DF" command AS WELL AS running DFInit through the batch file and then clicking "launch DF".
The problem was something to do with the batch file trying to run the program without actually changing its current working directory. It was as if DF launched but it didn't know what directory it was supposed to be in (and where its supporting files were!).

Everything was fixed when I explicitly told the batch file to CHANGE DIRECTORY to where DF is, and THEN launch the .exe

Didn't work:
Code: [Select]
START "" "Dwarf Fortress 31.14\Dwarf Fortress.exe"
Worked:
Code: ( Worked) [Select]
SET dfDir=Dwarf Fortress 31.14
...
CD %dfDir%
START "" "Dwarf Fortress.exe"
Title: Re: DFInit file editor [v1.52 ~ 0.31.16]
Post by: thebigJ_A on October 09, 2010, 10:40:51 pm
Lucas, hitting the change directory button worked, I can now launch the game through DFinit.

I still get the errors when I save, though. Xnrad, I've got two sets on inits, the rgular ones, and ones that came with Phoebus (called init.phoebus and d_init.phoebus). I'll assume you want the regular ones, though idk which the game uses.

Here's the init:
Spoiler (click to show/hide)

and d_init:
Spoiler (click to show/hide)
Title: Re: DFInit file editor [v1.52 ~ 0.31.16]
Post by: xnrad on October 10, 2010, 07:36:41 pm
[TEMPERATURE:NO]
[WEATHER:NO]
[ECONOMY:NO]
[INVADERS:YES]
[CAVEINS:YES]
[ARTIFACTS:YES]
[ZERO_RENT:NO]
[TESTING_ARENA:YES]
[RESIZABLE:0]
[:0]


So it turns out I omitted the letter 'D' from the code handling the new spatter options.
Title: Re: DFInit file editor [v1.52 ~ 0.31.16]
Post by: thebigJ_A on October 10, 2010, 08:53:17 pm
[TEMPERATURE:NO]
[WEATHER:NO]
[ECONOMY:NO]
[INVADERS:YES]
[CAVEINS:YES]
[ARTIFACTS:YES]
[ZERO_RENT:NO]
[TESTING_ARENA:YES]
[RESIZABLE:0]
[:0]


So it turns out I omitted the letter 'D' from the code handling the new spatter options.

I don't... what?
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: SolarShado on October 10, 2010, 09:33:45 pm
Misspelled variable name? AFAIK VB's pretty loose about the "declare before first use" thing. (I could be completely wrong, never much used VB.)
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: thebigJ_A on October 10, 2010, 10:13:04 pm
I don't understand. You just made part of the init I sent you bold. I know those lines are in there, that's what makes the error message strange.
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: xnrad on October 10, 2010, 10:23:39 pm
I highlighted it because that's what tipped me off to what was going wrong.

ahem

The array that holds init.txt is called iniArray; d_init's is DiniArray.
While saving, for each line in each init file, it looks for a number in column 10, which gets assigned the line number during loading when the line in question has an editable value. This was done to separate the values from the rest of the text.
If it finds a number in line x, column 10, it begins a big case statement to match the value it's looking at, so it can save from the proper text box/checkbox/dropdown menu.
For the spatter options, I thought they belonged to init.txt, so I omitted the D, thus resulting in that statement looking at the wrong array and getting resizable and a blank line instead of dwarfspatter and adventurespatter.


tl;dr I had a brain fart while programming.
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: SolarShado on October 10, 2010, 10:42:16 pm
I love being right (even if it was for the wrong reason)
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: thebigJ_A on October 11, 2010, 01:47:40 am
Ah, I get it now.

Well, at least it's nothing major. I mean, blood tracking is off by default in fortress mode anyway, and I doubt its somethng people would change often. Glad I could help with this quite useful utility.

Now, if only someone could make something like Therapist for the military, I'd have everything I need (aside from a better processor on my pc!  ;)).
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: xnrad on October 19, 2010, 07:50:09 pm
OK then, I have finally received my gaming laptop, which comes with Win7 64bit and I now see what issues you people have been going through. I will do my best to fix these and deliver the DFInit experience as it was originally intended.
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: daveftw on February 27, 2011, 06:59:14 pm
Hi, I noticed a small bug in 1.53, dunno how far back it goes.  On initial startup, when DFInit asks for the Dwarf Fortress directory, canceling the open file dialog causes an alert box to pop up: "Can't save or load or do anything useful until DF folder is located."  When you click OK, the open file dialog is displayed again.  If you close the alert box window, DFInit's main window displays, but the program hangs.  It seems like closing the alert box should terminate the program instead.  Just my two cents, good program otherwise!
Title: Re: DF init file editor
Post by: Thundercraft on February 26, 2013, 01:55:39 am
OMG it's VB6 if I'm not mistaken.
...[snip]...
The font choices would be nice as a dropdown, it shouldn't be too hard to populate a list from the contents of a folder.

This hasn't been updated in years. And yet, it continues to be a part of the Lazy Newb Pack (http://www.bay12forums.com/smf/index.php?topic=59026.0).

Some questions:

* Is it true that this was written in Visual Basic?

* Is DFInit compatible with Linux and/or OS-X? Will it run under Wine?

* If there are no plans to update this utility or make a Linux version, have you considered releasing the source code?

Hi, I noticed a small bug in 1.53, dunno how far back it goes.  On initial startup, when DFInit asks for the Dwarf Fortress directory, canceling the open file dialog causes an alert box to pop up: "Can't save or load or do anything useful until DF folder is located."  When you click OK, the open file dialog is displayed again.  If you close the alert box window, DFInit's main window displays, but the program hangs.  It seems like closing the alert box should terminate the program instead.  Just my two cents, good program otherwise!

I can confirm this bug. Seems very minor, though.
And, yes, it's a nice little program.  :D
Title: Re: DFInit file editor [v1.53 ~ 0.31.16]
Post by: LucasUP on February 26, 2013, 03:08:30 am
This hasn't been updated in years. And yet, it continues to be a part of the Lazy Newb Pack (http://www.bay12forums.com/smf/index.php?topic=59026.0).
I replied to this over here (http://www.bay12forums.com/smf/index.php?topic=59026.msg4061145#msg4061145)