project-navigation
Personal tools

Author Topic: how to apply a mod (Win 7)  (Read 8909 times)

Offline cannonfodder558

  • Rookie
  • ***
  • Posts: 27
    • View Profile
how to apply a mod (Win 7)
« on: February 05, 2015, 08:06:16 am »
Hello everybody.

Could someone please tell me how to apply a mod using the command "./ufo +set fs_gamedir mymod"? To be honest, I don't know how/where to enter it (OS: Win 7).

I know how to start a mod from the game menu.

Thank you in advance.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: how to apply a mod (Win 7)
« Reply #1 on: February 06, 2015, 03:41:27 am »
You need to either:
A) Open a command prompt window navigate to the game directory and run it with ufo.exe +set fs_gamedir yourmod
B) Run it from the windows run dialogue: navigate to  ufo.exe, select it then add the +set fs_gamedir yourmod part once the exe is on the text box
C) Edit the program's shortcut: Open the shortcut properties and add the +set fs_gamedir yourmod after the path to ufo.exe that appear in one of the text boxes (not the working dir one!)

Disclaimer: I haven't used windows in a good while, that is how I remember things working, instructions might not be 100% accurate...

Offline AntJam

  • Rookie
  • ***
  • Posts: 91
    • View Profile
Re: how to apply a mod (Win 7)
« Reply #2 on: February 06, 2015, 12:40:19 pm »
Actually you need    ./ufo +set fs_gamedir yourmod

I use the shortcut method because you can easily switch between different mods by creating multiple shortcuts

Offline cannonfodder558

  • Rookie
  • ***
  • Posts: 27
    • View Profile
Re: how to apply a mod (Win 7)
« Reply #3 on: February 06, 2015, 06:00:19 pm »
Thanks a lot, guys. :)

Offline cannonfodder558

  • Rookie
  • ***
  • Posts: 27
    • View Profile
Re: how to apply a mod (Win 7)
« Reply #4 on: February 14, 2015, 06:31:20 pm »
I'd like to provide the details for all enthusiastic beginners, like me (starting with the quite cool mod ajguns - I recommend it, works perfectly with 2.5 stable):

WIN 7

Starting a mod via command line:
- WIN + R
- enter: C:\Program Files\UFOAI-2.5\ufo.exe ./ufo +set fs_gamedir ajguns
  (without quotation marks)
- hit ENTER
=> Here we go.

...via Shortcut:
- right-click the standard UFO AI shortcut on the desktop
- select "properties"
  In the register "link/conjunction/assignment" (?)
  there are two spaces that can be corrupted:
  (1) Target: "C:\Program Files\UFOAI-2.5\ufo.exe"
  (2) Execute in/ Working area: "C:\Program Files\UFOAI-2.5"

(I translated the terms from german, so don't burn me if they're titled a bit different in the english win version).

- change the entry in no. 1 exactly - including the quotation marks given - to:
  "C:\Program Files\UFOAI-2.5\ufo.exe" ./ufo +set fs_gamedir ajguns
- save the amendments   

=> Here we go.

Ubuntu:

 ;D No idea ;D

Have fun.
« Last Edit: February 14, 2015, 07:05:12 pm by cannonfodder558 »

Offline homunculus

  • Sergeant
  • *****
  • Posts: 387
    • View Profile
Re: how to apply a mod (Win 7)
« Reply #5 on: February 12, 2023, 08:02:47 pm »
Maybe for some people this +set fs_gamedir seems confusing, and they might use some background info to feel more confident about what they are doing.

Disclaimer
=======
I am not a C programmer, nor a Windows programmer or expert. I have just been using some Windows, UNIX and Linux for some time, including some programming. However, I hope an explanation by a casual user might be easier to understand by other casual users.

Ancient History
=========
Once upon a time there were no smartphones, not even mobile phones, and 10 kilobytes hard drive (compared to 10 terabytes nowadays) was a luxury.

Commands on computers had a limit of 6 letters. Same for variable names and function names in, say, Fortran77 (a programming language).

So, you want a command SetEnvironmentVariable? You abbreviate it to setenv.
MakeDirectory? mkdir (Folders were called directories back then).
ChangeDirectory? chdir.
BasicInputOutputSystem? bios.

Sometimes things can get funny, like I myself have invented function names like simsym and symsum because they were the most meaningful abbreviations (SimulateSymmetry, and SumOfSimulatedSymmetry).

I mean, the abbreviations were created with best intentions of being easy to understand, but with 6 letters you can only do so much.

Later, when this 6 letter limit was not necessary, people still understood that ch means change, mk means make and dir means directory.
It is like nowadays Application is called App even without the 6 letters limit and everybody should understand what it means (not Apparition).

Command Prompt
===========
People are talking about command prompt or command line interface or cmd. Back then, the little command prompt window was your whole screen that you had. But the monitors were not that small? It is because the resolution was lower.

So, in this command line interface you would navigate (by using chdir) to the folder (directory) where ufo.exe is.
.exe means ufo.exe is an executable, or in other words, a program that you can run.
You wouldn't need to type ufo.exe to run it just ufo is enough.

So, congratulations, you have managed to run ufo from command line.

Command Line Parameters
=================
Those +set fs_gamedir things are command line parameters. When ufo.exe runs, the program also knows what those command line parameters are.
set (most likely) means set like in English.
fs (most likely) means file system.
gamedir (most likely) means game directory.

Additional Game Directory
================
If you run ufo.exe (without command line parameters), you can mod the game by putting files and folders in the directory where ufo.exe is, and if those folders and files have the same directory structure as in the source code of the game, they get used instead of the corresponding originals.

But putting mods in that directory is a bit invasive.

So, when you run ufo.exe for the first time, it also creates another directory, on Windows 10 it would be
C:\Users\<your user name>\AppData\Roaming\UFOAI\2.6-dev
(note that AppData is a hidden folder, you need to set 'show hidden folders' to see it)
(and you need to have run the game at least once to have the UFOAI\2.6-dev folder created at all)

This directory is (most likely) also treated as the game directory where ufo.exe is.
Also, you have folder 'base' there where the game stores your configurations and save files.

A Folder for a Mod in User Data Directory
==========================
The directory
C:\Users\<your user name>\AppData\Roaming\UFOAI\2.6-dev
is (most likely) called the user data directory.

You can create a folder 'mods' in that directory, next to the 'base', and tell ufo.exe to treat the directory 'mods' as an additional game directory by starting ufo.exe from command line as
ufo +set fs_gamedir mods
(there is no need to get confused if someone writes '.\ufo +set fs_gamedir mods', the dot just means current directory and can be omitted, same goes for the full path if you are already in the directory where ufo.exe is)

Organizing Mods
==========
But what if you want to try one mod today and another mod tomorrow, meaning, you want several mods?
Then you might create a subfolder of the folder 'mods' for each mod.
Like, you might create 'mods\lazy_hud_v2' and 'mods\lazy_hud' and 'mods\radar_mod' and put the mods in their own folders.
And now, when you want to play ufo with a mod, say, lazy hud version 2, you open the command line interface and navigate to the folder where ufo.exe is and type
ufo +set fs_gamedir mods\lazy_hud_v2
I have not tried this, but most likely you could run two mods at the same time by passing multiple game directories as command line parameters like this:
ufo +set fs_gamedir mods\lazy_hud_v2 mods\radar_mod

Creating a Batch File
=============
Navigating to the ufo.exe folder in Command Prompt and typing all those command line parameters can be tedious.

You can create a plain text file (extension .txt) where you write
ufo +set fs_gamedir mods\lazy_hud_v2
and you save it not with the extension '.txt' but with extension '.bat' (say, lazy2.bat).
Then you can move the batch file to the folder where ufo.exe is (Windows will ask for admin password).

.bat means batch, like a batch of commands. You could put multiple commands in a batch file, and if you run the batch file (same way you run an executable) all those commands get executed.

Now you could navigate to the folder where ufo.exe and lazy2.bat are and type
lazy2
and you have executed the command in the .bat file which is
ufo +set fs_gamedir mods\lazy_hud_v2

Creating a Shortcut to the Batch File
=======================
You can skip the command line altogether.

Just like .exe can be run by double-click, a .bat can also be run by double-click.
If you want to edit the .bat file you choose Edit from right mouse button menu (Open will just run the commands in the .bat).

And you can create a shortcut of the batch file and place it on your desktop.
Then you can run
ufo +set fs_gamedir mods\lazy_hud_v2
in the directory where ufo.exe is by double-clicking the shortcut on your desktop.

You can also change the icon of the shortcut by opening Properties (in right mouse click menu on the shortcut) and pressing 'Change Icon...' button in the 'Shortcut' tab. Then you can navigate to UFOAI-2.6-dev folder and choose ufo.exe file as the "icon".

Now you should have a nice looking clickable shortcut on your desktop.

Summary
======
Please put your mods in a separate folder in AppData rather than in the folder where ufo.exe is.
Like, say,
C:\Users\<your user name>\AppData\Roaming\UFOAI\2.6-dev\mods\lazy_hud_v2
and run the modded game as
ufo +set fs_gamedir mods\lazy_hud_v2

Now, after writing all of this, I am wondering if I clarified things or if I made it even more confusing.
« Last Edit: February 18, 2023, 03:14:47 pm by homunculus »