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

Discuss and distribute tools and methods for modding. Moderator - Grognak
sandrew26
Posts: 5
Joined: Sun Dec 02, 2012 7:16 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby sandrew26 » Sun Dec 02, 2012 9:56 pm

Re Boa: Hmn, it looks like that isn't working.

Code: Select all

SyntaxError: invalid syntax
Morrions-Mac:~ Andrew$ python /Users/Andrew/Library/Application\ Support/Steam/SteamApps/common/FTL\ Faster\ Than\ Light/FTL.app/Contents/main.py
  File "/Users/Andrew/Library/Application Support/Steam/SteamApps/common/FTL Faster Than Light/FTL.app/Contents/main.py", line 438
    dir_mods = ~/Documents/FTL mods
                ^
SyntaxError: invalid syntax

Maybe there's a way to make it a relative path (can you do that in python?) and direct to "/mods"? I don't know if that would mess up any of the rest of main.py, though.

for reference, here's the whole portion of that bit of code (with the replacement):

Code: Select all

elif platform.system() == "Darwin":
    steam = msgbox.askyesno(progname, "Did you purchase FTL through Steam?")
    if steam == True:
        dir_res = os.path.join(os.environ['HOME'], 'Library/Application Support/Steam/SteamApps/common/FTL Faster Than Light/FTL.app/Contents/Resources')
    if steam == False or steam == None:
        if not os.path.isfile(os.path.join(dir_root, "MacOS", "FTL")):
            msgbox.showerror(progname, "Grognak's Mod Manager must be located directly above the MacOS folder in FTL.dat")
            sys.exit(0)
        dir_res = os.path.join(dir_root, 'Resources')
    os.chdir(dir_root)
    dir_mods = ~/Documents/FTL mods
    dir_mods = os.path.expanduser(dir_mods)
    if not os.path.exists(dir_mods):
       os.makedirs(dir_mods)
       copy(os.path.join(dir_root, "mods/Beginning Scrap Advantage.ftl"), dir_mods)
       msgbox.showinfo(progname, "A folder has been created in " + dir_mods + ". Please place any FTL mods there.")
else:
    msgbox.showwarning(progname, "Unsupported platform; unexpected behavior may occur.")


EDIT: Mwuahahaha! I have mastered the powers of python! No, not really. But I did change "~/Documents/FTL mods" to "os.path.join(dir_root, 'mods')", which seems to have worked! I got through the steam bool, and then the GUI opened up! Hooray!

I'm guessing that "dir_root" is the way of making the .py file you're running the root (so it can have a relative filepath), and then 'mods' is the folder (I think it's case-sensitive). Would 'mods/subfolder' then go to a folder/file inside mods?

So, the final/edited code for that section:

Code: Select all

elif platform.system() == "Darwin":
    steam = msgbox.askyesno(progname, "Did you purchase FTL through Steam?")
    if steam == True:
        dir_res = os.path.join(os.environ['HOME'], 'Library/Application Support/Steam/SteamApps/common/FTL Faster Than Light/FTL.app/Contents/Resources')
    if steam == False or steam == None:
        if not os.path.isfile(os.path.join(dir_root, "MacOS", "FTL")):
            msgbox.showerror(progname, "Grognak's Mod Manager must be located directly above the MacOS folder in FTL.dat")
            sys.exit(0)
        dir_res = os.path.join(dir_root, 'Resources')
    os.chdir(dir_root)
    dir_mods = os.path.join(dir_root, 'mods')
    dir_mods = os.path.expanduser(dir_mods)
    if not os.path.exists(dir_mods):
       os.makedirs(dir_mods)
       copy(os.path.join(dir_root, "mods/Beginning Scrap Advantage.ftl"), dir_mods)
       msgbox.showinfo(progname, "A folder has been created in " + dir_mods + ". Please place any FTL mods there.")

I'm sorry to have solved the final piece without your input, but I thank you for helping get to this. I definitely wouldn't have figured it out if you hadn't shown me where to look, boa ^^.

@Grognak: I really would like to know why main.py couldn't find the ini file, though - perhaps I put it in the wrong location? I hope I haven't offended you by changing main.py with boa's help - I definitely respect your code, but I just really wanted to use it to play/mod FTL with, and couldn't wait for you to come in with an official answer XD =)
for reference, this was with v1.4, not the latest files from github/src.
boa13
Posts: 829
Joined: Mon Sep 17, 2012 11:42 pm
Location: Nantes, France

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby boa13 » Sun Dec 02, 2012 10:31 pm

Code: Select all

    dir_mods = ~/Documents/FTL mods
                ^
SyntaxError: invalid syntax

You forgot the quotes around "~/Documents/FTL mods". :) This is why Python is complaining; ~/Documents/FTL mods is not a valid Python instruction. The proper code would have been:

Code: Select all

    dir_mods = "~/Documents/FTL mods"


I'm guessing that "dir_root" is the way of making the .py file you're running the root (so it can have a relative filepath), and then 'mods' is the folder (I think it's case-sensitive). Would 'mods/subfolder' then go to a folder/file inside mods?

dir_root is actually the name of variable, a place in memory that contains whatever the program author wants it to contain, with whatever name the program author wants. In the present case, obviously, this piece of memory contains the directory where the Mod Manager resides. Using the os.path.join instruction, you told Python to compute a new directory name, composed of whatever was in dir_root, and then "mods", and to store the result in the variable named dir_mods. You are right that you could add deeper subdirectories this way, though the proper way to write the instruction, so that it also works on Windows (with backslashes instead of slashes) would be os.path.join(dir_root, 'mods', 'subfolder').
Forum janitor — If you spot spam, PM me the URL and/or the username of the spammer.
I have powers, moderator powers. I am not keen on using them, but will do so if needed.
sandrew26
Posts: 5
Joined: Sun Dec 02, 2012 7:16 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby sandrew26 » Sun Dec 02, 2012 10:44 pm

Re boa: Ah, I see. You can tell I don't really know anything about python :oops: . I assumed that the quotes weren't part of the construction (I'm used to seeing quotes used only for print/text things), so that's my fault - thank you for clarifying. I also didn't realize dir_root was a variable, although I guess I never really checked to see if it was declared somewhere. I'm so lazy XD this is why I've never liked programming. I'll keep all of this in mind in case I have to do it again, though. Thank you again for all of your help!
Grognak
Posts: 172
Joined: Tue Sep 18, 2012 9:42 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby Grognak » Mon Dec 03, 2012 2:33 am

Thank you boa, for the help. :D And yeah sandrew, I assume the reason it didn't work in the first place was because the INI file wasn't in the "right place." Unfortunately, I'm not quite sure where that right place is on Mac (I'd assume it'd be the same folder that main.py was in.)
jocelyn
Posts: 6
Joined: Mon Nov 12, 2012 5:57 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby jocelyn » Wed Dec 05, 2012 7:32 am

Grognak wrote:Thank you boa, for the help. :D And yeah sandrew, I assume the reason it didn't work in the first place was because the INI file wasn't in the "right place." Unfortunately, I'm not quite sure where that right place is on Mac (I'd assume it'd be the same folder that main.py was in.)


Hi again,

To be more "mac like" on OSX you should write the settings to a .plist file and store it in: ~/Library/Preferences

I don't really know python (at least I've never tried to learn it, I might for this) but you can read, write, delete, plist files from the command line on osx using the native "defaults" command, so I'd assume it would be easy enough to use via python.

It looks to me like you accomplish this by using either os.system() and then using the defaults tool directly, or by using plistlib which has been available since python 2.6 (according to this page here at least: http://www.doughellmann.com/PyMOTW/plistlib/)

Unless someone else beats me to this I might look into this, it would make it a lot easier to get new users up and running on OSX at least.

Cheers :)
Flamingdodo
Posts: 6
Joined: Fri Nov 30, 2012 1:25 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby Flamingdodo » Thu Dec 06, 2012 1:09 pm

Okay so I am a little confused by all these comments, if anyone knows can they please just message me a list of what to do to get it working, thanks.

I am running windows 7 with the steam version of FTL.
Grognak
Posts: 172
Joined: Tue Sep 18, 2012 9:42 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby Grognak » Thu Dec 06, 2012 8:55 pm

If there is an issue for you, you will have to be more specific to get help. :)
Sparfell
Posts: 1
Joined: Thu Dec 06, 2012 9:46 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby Sparfell » Thu Dec 06, 2012 10:14 pm

Hi

I have the linux version of FTL. I tried using the mod manager, at first to install the "disable fleet" mod, then trying to patch with nothing seleced. Each time I get the same error :

Code: Select all

OSError: [Errno 2] No such file or directory: '/home/thierry/opt/FTL/resources'

So, I take a look at my directory structure, and I'm not surprised by the error, the directory is in fact located in FTL/data/resources. I tried a quick google search ... in vain :| am I the only one using the linux version :mrgreen: or ??? Any help ?
marchpumpkin
Posts: 2
Joined: Sun Dec 09, 2012 2:12 am

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby marchpumpkin » Sun Dec 09, 2012 2:16 am

I am banging my head against a wall.
I am running Mac OS 10.8.2 and have the STEAM version of FTL.
I cannot get GMM to run...honestly, I cannot even figure out how to install it.
I have dug through these forums but cannot find a simple, step-by-step solution....
AAARRGGHHH!!!
UltraMantis
Posts: 2141
Joined: Thu Sep 20, 2012 3:17 pm

Re: Grognak's Mod Manager v1.4.1 (Updated Nov 9 2012!)

Postby UltraMantis » Sun Dec 09, 2012 2:24 am

It's all in the readme file.

Code: Select all

To install the mod manager itself, unzip all of the files in the archive and move them into the folder:
Windows: in which FTLGame.exe resides.
Mac OS X: in which FTL_README.html resides.
Linux: in which FTL resides.

For Mac/Linux users: Move the contents of src into the same folder as modman.exe. In order to use GMM, run main.py via python. (It is safe to delete modman.exe.)

Mods come in .ftl files. To make one available to GMM, simply drag it into the /mods folder.

To install mods, open GMM, select the mods you want to be installed, and hit the button labled "Patch." Please note that you need to re-select mods that you already have installed, otherwise they will uninstall themselves.

In order to completely uninstall all mods, simply start the patching process with nothing selected.
Report spam using the handy Report Button Mod.

Who is online

Users browsing this forum: No registered users and 20 guests