Grognak's Mod Manager v1.7 (Updated March 6, 2013!)

Discuss and distribute tools and methods for modding. Moderator - Grognak
Grognak
Posts: 172
Joined: Tue Sep 18, 2012 9:42 pm

Re: Grognak's Mod Manager (v1.3)

Postby Grognak » Mon Oct 01, 2012 6:57 pm

fdp139 wrote:i got this error

...

also its the ubuntu version not the steam

Looks like you're trying to run the exe via wine or something? Check the /src/ directory and it's readme.

tdoe wrote:Well, I looked on the master mod list, and it said that the ones I downloaded were compatable with GMM

Could you be more specific on which mod you're trying to install?

rolfy wrote:You, sir or madam, are a legend.
But I do have one teensy little request
Is there any chance that, in v1.4, the mod manager could launch the game when it's finished with all its patching and merging and whatnot?

Thank you, and I'll put that on my TODO list.
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: Grognak's Mod Manager (v1.3)

Postby Icehawk78 » Mon Oct 01, 2012 7:18 pm

Grognak wrote:
tdoe wrote:Hey again, How do I put .zip files into the Mod Manager? Some of the mods I downloaded are in .zip form and im not sure how to convert them to .ftl files

If it's .zip, it probably isn't compatible with GMM! Ask the author to convert it (if not for convenience reasons, for ethical ones.) :)

I thought you added zip support in 1.3?

On a semi-related note, have you gotten anywhere with adding XML merging?

I was able to get Nokogiri in Ruby to finally actually parse the base XML files with a number of workarounds:

For each line of the source files and mod files which contain anything other than tabs/spaces/newlines, I performed the following steps (presented with regex to be language agnostic):
  • Remove any/all beginning/trailing spaces (unnecessary, adds extra whitespace nodes which may slow performance; not completely necessary)
  • Replace anything matching /\s=\"/ with '="'
  • Replace anything matching /\=\s\"/ with '="' (these two remove spaces around the '=' in property assignments, which is nonstandard XML)
  • Replace anything matching /(\S+?)-->/ with '\1 -->' (\1 = first matching group; many XML parsers are unable to handle comment nodes with either more -'s than two before the closing comment tag, so we're adding an extra space to the end so it matches)
  • Replace anything matching /<!--(\S+?)/ with '<!-- \1' (same as above, but for the beginning of the comment node)
  • Replace anything matching /(\s\w+=\"\S+?\")(\S+>)/ with '\1 \2' (Several locations have XML nodes like <tagName attribute="value"attribute2="value" />; A majority of XML parsers blow up on this, so this spaces all attributes out)

In Ruby, this was implemented as follows:

Code: Select all

def contents (filename)
  f = File.open(filename)
  t = f.read
  f.close
  return t.each_line.map{|x| x.strip.gsub(/\s=\"/, '="').gsub(/\=\s\"/, '="').gsub(/(\S+?)-->/, '\1 -->').gsub(/<!--(\S+?)/, '<!-- \1').gsub(/(\s\w+=\"\S+?\")(\S+>)/, '\1 \2')  unless x.strip.empty?}.compact * ""
end


Presumably, something similar can be incorporated within Python, though you still have design considerations to determine how best to actually handle the merging itself (ie adding attributes to mods - my current method was to look for a "mergeMode" attribute in the mod file which either indicated that its children should be merged by tagName/name, or that its children should replace any matching tagName/name, etc).

There doesn't seem to be a "right" or "wrong" way to do that. I may look into seeing what "packaging" options are available for installing Rubygems to possibly provide my almost-but-not-quite working Ruby version, but since redistribution requires it to be run locally, I'd either need to provide a Ruby/Gem bundled installer, or have end users install both Ruby and a Gem to use it, which seems quite untenable, lol.

[edit]
One other thing - in Ruby/Nokogiri (which uses libxml2, which I think it what the native Python XML parsers also use), I had to specify the input as an XML fragment, since the XML standard only allows for a single root node. If the parser you end up using doesn't have this as an option, you'll need to find some manner to work around this, though with the base game files, you'd need to do more than simply wrap the entire file in <ftlRoot></ftlRoot> tags, since that would wrap the XML directive at the top inside, and that would need to come before the root note (that's the <?xml version="1.0" encoding="utf-8"?> part).
Last edited by Icehawk78 on Mon Oct 01, 2012 7:30 pm, edited 1 time in total.
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: Grognak's Mod Manager (v1.3)

Postby All4n » Mon Oct 01, 2012 7:27 pm

I can't get it to work, the files are in "Mac OS X: in which FTL_README.html resides." :(

EDIT: Forgot that I could code Python :lol: Looked around and it seems that it is important that you CD to the dir and then run the main.py from there, you can'y just write "python /blabla/blabla/main.py" this will not work.

You could update this in the future maybe :)
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
tdoe
Posts: 11
Joined: Mon Oct 01, 2012 3:25 am

Re: Grognak's Mod Manager (v1.3)

Postby tdoe » Mon Oct 01, 2012 8:10 pm

Grognak wrote:
tdoe wrote:Well, I looked on the master mod list, and it said that the ones I downloaded were compatable with GMM

Could you be more specific on which mod you're trying to install?


Quite a few actually, including Somewhat faster than light, Extra names mod, Faster than hard light, Blazing cruser, and a few more.
Torchwood202
Posts: 132
Joined: Sun Sep 30, 2012 4:10 pm

Re: Grognak's Mod Manager (v1.3)

Postby Torchwood202 » Mon Oct 01, 2012 8:13 pm

Torchwood202 Again... So I updated and installed Python 2.7.3 and tried to open main.py with it, and I got this...

Last login: Mon Oct 1 16:12:43 on ttys000
Denise-Irizarrys-MacBook-Pro:~ Denise$ cd '/Users/Denise/Desktop/Grognaks Mod Manager v1.3/src/' && '/usr/local/bin/pythonw' '/Users/Denise/Desktop/Grognaks Mod Manager v1.3/src/main.py' && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Users/Denise/Desktop/Grognaks Mod Manager v1.3/src/main.py", line 8, in <module>
import easygui as eg
ImportError: No module named easygui
Denise-Irizarrys-MacBook-Pro:src Denise$

Soo.....wat now :?
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: Grognak's Mod Manager (v1.3)

Postby All4n » Mon Oct 01, 2012 8:36 pm

Torchwood202 wrote:Torchwood202 Again... So I updated and installed Python 2.7.3 and tried to open main.py with it, and I got this...

Last login: Mon Oct 1 16:12:43 on ttys000
Denise-Irizarrys-MacBook-Pro:~ Denise$ cd '/Users/Denise/Desktop/Grognaks Mod Manager v1.3/src/' && '/usr/local/bin/pythonw' '/Users/Denise/Desktop/Grognaks Mod Manager v1.3/src/main.py' && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Users/Denise/Desktop/Grognaks Mod Manager v1.3/src/main.py", line 8, in <module>
import easygui as eg
ImportError: No module named easygui
Denise-Irizarrys-MacBook-Pro:src Denise$

Soo.....wat now :?


You have to run the setup.py file :-) It is in the ReadMe!
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
Grognak
Posts: 172
Joined: Tue Sep 18, 2012 9:42 pm

Re: Grognak's Mod Manager (v1.3)

Postby Grognak » Mon Oct 01, 2012 8:36 pm

Icehawk78 wrote:I thought you added zip support in 1.3?

Half-way, it's a bit broken right now. And in any case, mod authors should never distribute GMM mods as .zip files, as it's supposed to be a tool for development and nothing more.

Icehawk78 wrote:On a semi-related note, have you gotten anywhere with adding XML merging?

...

Holy crapola. Great stuff. I personally haven't really looked into it for a while (I got bored :lol: .) But if you feel like making something work in Python and submit a pull request, that would be a great feature.

All4n wrote:You could update this in the future maybe

A patch has already been committed. :)

Torchwood202 wrote:Soo.....wat now

Reread the readme.txt in /src/ :p

tdoe wrote:Quite a few actually, including Somewhat faster than light, Extra names mod, Faster than hard light, Blazing cruser, and a few more.

I just checked, all of those use the .ftl format. If it doesn't use .ftl, then it's not compatible.
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: Grognak's Mod Manager (v1.3)

Postby Icehawk78 » Mon Oct 01, 2012 8:38 pm

Also, Grognak, didn't you used to have a README.md on Github? Currently there's nothing there, so the installation/usage instructions that I could have sworn I'd seen before are no longer there.

Torchwood202: You'll need to install the python easygui module. Hopefully someone else can respond, because I'm not certain how that's done on a mac, but that's what the error's telling you.
Grognak
Posts: 172
Joined: Tue Sep 18, 2012 9:42 pm

Re: Grognak's Mod Manager (v1.3)

Postby Grognak » Mon Oct 01, 2012 8:43 pm

I have not since end users download directly from mediafire anyway.
tdoe
Posts: 11
Joined: Mon Oct 01, 2012 3:25 am

Re: Grognak's Mod Manager (v1.3)

Postby tdoe » Mon Oct 01, 2012 9:05 pm

Grognak wrote:
tdoe wrote:Quite a few actually, including Somewhat faster than light, Extra names mod, Faster than hard light, Blazing cruser, and a few more.

I just checked, all of those use the .ftl format. If it doesn't use .ftl, then it's not compatible.

So are you saying that they ARE compatable because they use the .ftl format? Because when I downloaded them, they came in .zip form.