How to Write Installation Scripts

which determine how your mod is going to be installed



Automatic Installation

Simply paste a direct download link to the file and the installer will figure out what to do on its own. If there's more than one file to download then put another link in a new line.

ftp://ftp.armedassault.info/ofpd/unofaddons2/ww4mod25rel.rar
ftp://ftp.armedassault.info/ofpd/unofaddons2/ww4mod25patch1.rar

If an archive requires a password then add /password: to the line.

http://example.com/locked.rar  /password:123

How does it work?

Installer examines the extension of the downloaded file:

  • If it's .rar, .zip, .7z, .ace, .exe or .cab then it will extract it and inspect its contents.
  • If an .exe couldn't be unpacked and nothing else was copied up until that point then it will ask the user to run it.
  • If it's a .pbo then it will detect its type and move it to the addons, Missions, MPMissions, Templates or SPTemplates directory in the modfolder.
  • Other types of files are ignored.


When installer encounters a directory it will check its name and contents:

  • If its name matches the name of the mod that's being installed then it will be moved to the game directory. All remaining files and folders in this location (except for other mods) will be moved to the modfolder. If directory addons is present then it will be merged with IslandCutscenes in the modfolder.
  • Other modfolders will be ignored (exceptions: 1. Res folder 2. if the downloaded archive contains only a single folder then it won't be skipped).
  • If its name matches addons, bin, campaigns, dta, Missions, MPMissions, Templates, SPTemplates, MissionsUsers, MPMissionsUsers or IslandCutscenes then it will be moved to the modfolder (contents will be merged). If MPMissions contains only a single folder then that folder will be moved instead. If Missions contains only a single folder that matches mod name then its contents will be merged with the mod missions. If it doesn't match then it will be moved as a separate folder.
  • If it contains overview.html then it will be moved to the Missions folder in the modfolder.
  • If its name ends with "anim", "_anim" or "_anims" then it will be moved to the IslandCutscenes. If any of the parent folders was named "res" or they have words "res" and "addons" in their names then the current directory will be moved to the IslandCutscenes_Res instead.
  • If it's a mission folder then the installer will detect its type and move it to the Missions, MPMissions, Templates or SPTemplates in the modfolder. If the folder name contains words "demo" or "template" or if any of the parent folders names had words "user" or "mission" and "demo/editor/template" then the current folder will be moved to the MissionsUsers or MPMissionsUsers instead.
  • In any other case it will go through its contents and apply the same rules for each folder (first) and file there.


Installer overwrites existing files. Automatically creates necessary folders.


Download Links

1. Links should start with the protocol. Spaces should be replaced with %20. Links have to directly point to the file.

http://ofp-faguss.com/addon/winterofp/[coop]%20nogova%20virus%20-%20they%20hunger.noe_winter.7z


2. If a website requires you to go through intermediate pages in order to receive a direct link then write address to each page.

<starting url>  <optionally intermediate links>  <output file name>

You don't actually have to type in full intermediary URL but only the unique part that's easy to find in the page's source code. The last item is the name under which the file will be saved. If it contains spaces then put it in quotation marks.

https://www.moddb.com/mods/sanctuary1/downloads/ww4-modpack-25 /downloads/start/ /downloads/mirror/ ww4mod25rel.rar

In the above example installer will:

  • Download page https://www.moddb.com/mods/sanctuary1/downloads/ww4-modpack-25
  • Find URL containing phrase /downloads/start/ and download web page behind that link
  • Find URL containing phrase /downloads/mirror/ and download its contents as ww4mod25rel.rar

On the mod update page, below the script input field you'll find a tool that automatically writes intermediate links (for a few selected sites). More information on how to find such links yourself you'll find below.



3. If you have backup links then place all of them between a pair of curly brackets. Example:

{
	http://files.ofpisnotdead.com/files//ofpd/mods/fdfmod14_ww2.rar
	http://fdfmod.dreamhosters.com/ofp/fdfmod14_ww2.rar
	https://www.gamefront.com/games/operation-flashpoint/file/fdf-mod  fdf-mod/download  expires=  fdfmod14_ww2.rar
}

If the first one fails then the installer will try the second one and so on. The files have to be identical because interrupted downloads will be continued from the last position.

Download file names also should be identical. Example:

{
	https://docs.google.com/uc?export=download&id=17oRbO4tnrXSFQgCPYCJ48b7dDF0TfIPx sandy.zip
	http://files.ofpisnotdead.com/files/ofpd/unofaddons2/footsandy.zip sandy.zip
}

4. To save disk space downloaded file is deleted as soon as the next download starts. To keep the files use GET command.


Commands

There are commands to make the installer do exactly what you want:


Some commands have aliases. For example remove and delete are the same.

Write each command in a separate line.

Commands usually require arguments. They have to be given in the specified order. Separate them by spaces. If an argument contains space then put it in quotation marks.

COMMAND argument1 "argument 2" ...

Commands may also use switches which are optional arguments that may be written anywhere in the argument order. They begin with a forward slash.

COMMAND /switch argument

I recommend to capitalize commands for readability.

Invalid command names will be ignored.

Leading and trailing spaces will be ignored.

Script can consist of both automatic installation and commands.


Unpack, Extract

UNPACK  <url or file>  /password:<text>

Extracts selected archive from the fwatch\tmp\ directory to the _extracted subfolder (its previous contents are wiped). If URL was given then it will download the file to the fwatch\tmp\ and extract it.



Example:

UNPACK  ftp://ftp.armedassault.info/ofpd/mods/fdfmod13_installer.exe

How to open nested archives:

UNPACK  first.rar
UNPACK  _extracted\second.rar
UNPACK  _extracted\_extracted\third.rar

Add /password: switch if the archive requires a password.

UNPACK  example.rar  /password:123

If no argument was given then it will extract the last downloaded file.

Back

Move, Copy

MOVE  <file or url>  <destination>  <new name>  /no_overwrite  /match_dir  /match_dir_only

Moves or copies selected file or folder from the fwatch\tmp\_extracted directory to the modfolder.

Overwrites files.

Automatically creates sub-directories in the destination path.



Example:

MOVE  "FDFmod Readme.html"

This will move
<game folder>\fwatch\tmp\_extracted\FDFmod Readme.html
to the
<game folder>\<modfolder>\



MOVE  example.pbo  addons

This will move
<game folder>\fwatch\tmp\_extracted\example.pbo
to the
<game folder>\<modfolder>\addons\



Exception: if the directory you want to move has the same name as the modfolder you’re installing then the destination path is changed to the game folder.

MOVE  finmod

This will move
<game folder>\fwatch\tmp\_extracted\finmod
to the
<game folder>\

You can cancel this behaviour by specifying destination argument.



Wildcards (see MSDN and StackExchange) can be used to match multiple files.

MOVE  *.pbo  addons

To match both files and folders add /match_dir switch. To match exclusively folders use /match_dir_only instead.

MOVE  *  /match_dir
MOVE  *  /match_dir_only


To rename the file that's being moved write new name after the destination path.

MOVE  misc\readme.txt  docs  readme_old.txt

Use dot if you don’t want to change destination.

MOVE  misc\readme.txt  .  readme_old.txt


Add /no_overwrite switch to disable overwriting files.

MOVE  *.pbo  addons  /no_overwrite


To download a file write link(s) between curly brackets.

MOVE  {ftp://ftp.armedassault.info/ofpd/gameserver/editorupdate102.pbo}  addons


To move files in the modfolder start the first argument with <mod>.

MOVE  <mod>\addons\example.pbo  obsolete


To move the last downloaded file use <download> or <dl> as the first argument.

MOVE  <dl>  addons


Command Copy can copy files from the game directory if the path starts with <game>.

COPY  <game>\bin\Resource.cpp  bin
Back

UnPBO, UnpackPBO, ExtractPBO

UNPBO  <file>  <destination>

Extracts PBO file from the modfolder.

Overwrites existing files.



Example:

UNPBO  addons\ww4_fx.pbo


Optionally you can specify where to extract files. Sub-directories in the destination path are automatically created.

UNPBO  addons\ww4_fx.pbo  temp


To unpack file from the game directory start the path with <game>. If destination wasn’t specified then the addon will be unpacked to the modfolder.

UNPBO  <game>\addons\kozl.pbo  addons
Back

MakePBO

MAKEPBO  <folder>  /keep_source  /timestamp:<date>

Creates a PBO file (no compression) out of a directory in the modfolder and then removes the source directory. PBO file modification date will be set to the day the specific mod version was added.



Example:

MAKEPBO  addons\ww4_fx


Add switch /keep_source to keep the original folder.

MAKEPBO  addons\ww4_fx  /keep_source


If no argument was given then it will pack the last addon extracted with UnPBO.

Add switch /timestamp: for a custom file modification date (see FILEDATE command for details).

Back

Edit

EDIT  <file name>  <line number>  <text>  /insert  /newfile  /append  /timestamp:<date>

Replaces text line in the selected file from the modfolder.

If the new text already contains quotation marks then use a custom separator to avoid conflict. Start the argument with >> and any character. End it with the same character.

File modification date will be set to the day the specific mod version was added.



Example:

EDIT addons\FDF_Suursaari\config.cpp 58 >>@cutscenes[]      = {"..\finmod\addons\suursaari_anim\intro"};@


Add switch /insert to add a new line instead of replacing. If the selected line number is zero or exceeds the number of lines in the file then the text will be added at the end.

Add switch /append to append to the end of the line instead of replacing it.

Add switch /newfile to create a new file. Existing file will be trashed.

Add switch /timestamp: for a custom file modification date (see FILEDATE command for details).

To select the last downloaded file use <download> or <dl> as the first argument.

Back

Delete, Remove

DELETE  <file name>  /match_dir

Deletes file or folder from the modfolder.



Example:

DELETE  Install_win98_ME.bat


Wildcards (see MSDN and StackExchange) can be used to match multiple files.

DELETE  addons\*.txt

To match both files and folders add /match_dir switch.

DELETE  temp\*  /match_dir


If no argument was given then it will delete the last downloaded file.

Back

If_version, else, endif

IF_VERSION  <operator>  <number>
ELSE
ENDIF

Further commands will be executed only if game version matches given condition.

If it does then the following instructions are executed until the end of the script or until else or endif command is encountered. Content between else and endif will be ignored.

If the condition wasn’t met then the following commands are skipped until the end of script or until else or endif commands.

Allowed comparison operators are: =, ==, <, <=, >, >=, <>, !=. If there’s no operator then equality is assumed.

Conditions can be nested.



Example:

IF_VERSION  <=  1.96
	UNPACK	https://www.mediafire.com/download/86d97zspupnjk9c  ://download  "WW4 Extended OFP patch v111.zip"
	MOVE	v196_patch\ww4ext_inf_cfg.pbo.OFP  addons  ww4ext_inf_cfg.pbo
ENDIF
IF_VERSION  >=  1.99
	COPY	<game>\bin\Config.cpp  bin
ELSE
	COPY	<game>\Res\bin\Config.cpp  bin
ENDIF
Back

Merge_with, Alias

MERGE_WITH  <name1> <name2> <...>

Changes the behavior of the automatic installation as well as Move and Copy commands so that they will merge specified folder with the modfolder that's being installed. Effect lasts until the end of the current script (to make it work for all the versions use option from the mod details page).



For example: mod @wgl5 is being installed. Archive "CoC_UA110_Setup.exe" was downloaded which contains folders: @CoC and @wgl5. By default auto installation will copy @wgl5 and ignore @CoC but if you'll write:

MERGE_WITH  @CoC
https://files.ofpisnotdead.com/files/ofpd/unofaddons2/CoC_UA110_Setup.exe

then the installer won't skip @CoC but merge its contents with the @wgl5 in the game directory.

If no argument was given then the option is turned off.

Back

Rename

RENAME  <file>  <new name>  /match_dir

Renames file or folder from the modfolder.



Example:

RENAME  addons\lo_res_tex.pbo  lo_res_tex.pbx


Wildcards (see MSDN and StackExchange) can be used to match multiple files.

RENAME  addons\*.pbo  *.pbx
RENAME  addons\*.pbo  ??????????????????_OLD*

To match both files and folders add /match_dir switch.

RENAME  *  *_old  /match_dir
Back

Makedir, Newfolder

MAKEDIR  <path>

Creates folder(s).



Example:

MAKEDIR  addons
MAKEDIR  dta\hwtl

This will create:

<game folder>\<modfolder>
<game folder>\<modfolder>\addons
<game folder>\<modfolder>\dta
<game folder>\<modfolder>\dta\hwtl
Back

Filedate

FILEDATE  <file>  <date>

Changes modification date of a seleted file in the modfolder. Acceptable formats are ISO 8601 (YYYY MM DD HH MM SS) or Unix timestamp. It must be in the GMT timezone.



Example:

FILEDATE  addons\example.pbo  2021-02-11T21:36:37
Back

Get, Download

GET  <url>

Downloads selected file to the fwatch\tmp\ directory. It will be removed at the end of the current installation script.



Example:

GET  http://example.com/part1.rar
GET  http://example.com/part2.rar
Back

Ask_get, Ask_download

ASK_GET  <file name>  <url>

Requests the user to manually download the selected file. Installation is paused until user decides to continue or abort.



Example:

ASK_GET  ww4mod25rel.rar  https://www.moddb.com/mods/sanctuary1/downloads/ww4-modpack-25
Back

Ask_run, Ask_execute

ASK_RUN  <url or file>

Requests the user to manually launch the selected file from the fwatch\tmp\ directory (will be opened in Windows Explorer). Installation is paused until user decides to continue or abort.

Use this command for executables that cannot be extracted.



Example:

ASK_RUN  ftp://ftp.armedassault.info/ofpd/mods/ECP%20v1.085%20(Full%20Installer).exe
ASK_RUN  _extracted\example.exe


If the file is in the modfolder then start the path with <mod>.

ASK_RUN  <mod>\Install_win2k_XP.bat


If no argument was given then the last downloaded file will be selected.

Back

Exit, Quit

EXIT

Causes the installer to skip all remaining commands in the current script.

Back

Where To Put Mission Files

Original game only makes use of the modfolder\Campaigns but with Fwatch 1.16 you can now conveniently store any kind of mission in the modfolder.

When you launch the game with a mod it will move contents of the mod sub-folders to the folders in the game directory.


Source Destination
<mod>\Missions Missions
<mod>\MPMissions MPMissions
<mod>\Templates Templates
<mod>\SPTemplates SPTemplates
<mod>\IslandCutscenes Addons
<mod>\IslandCutscenes\_Res Res\Addons
<mod>\MissionsUsers Users\<player>\Missions
<mod>\MPMissionsUsers Users\<player>\MPMissions

Both PBO files and mission folders are moved. In the case of cutscenes and user missions only folders are moved.

Files are moved back when you quit the game.


Example Scripts

This is a script for installing WW4 2.5 mod

; Download archive from one of these two sources and then extract it to a temporary location

UNPACK {
	https://files.ofpisnotdead.com/files/ofpd/unofaddons2/ww4mod25rel.rar 
	ftp://ftp.armedassault.info/ofpd/unofaddons2/ww4mod25rel.rar
}

; Move all the unpacked content (including folders) to the modfolder in the game directory (will be created if it doesn't exist)

MOVE    *  /match_dir

; Download and extract

UNPACK {
	ftp://ftp.armedassault.info/ofpd/unofaddons2/ww4mod25patch1.rar
}

; Move text files (from the directory with extracted files) to the modfolder root

MOVE    *.txt

; Move addons (from the directory with extracted files) to the modfolder\addons

MOVE    *.pbo  addons

; Move all remaining extracted files and folders to the modfolder\Bonus

MOVE    *  Bonus  /match_dir

; Replace modfolder\bin\resource.cpp (file that defines user interface) for widescreen compatibility

UNPACK {
	http://ofp-faguss.com/fwatch/download/ofp_aspect_ratio207.7z 
	http://faguss.paradoxstudio.uk/fwatch/download/ofp_aspect_ratio207.7z
}
MOVE    Files\WW4mod25\Resource.cpp  bin

; Replace modfolder\dta\anims.pbo (island cutscenes) so that a message will show up in the main menu when Fwatch is enabled

UNPACK {
	http://ofp-faguss.com/fwatch/download/anims_fwatch.7z 
	http://faguss.paradoxstudio.uk/fwatch/download/anims_fwatch.7z
}
MOVE    Files\WW4mod25\Anims.pbo  dta

This is a script for installing Finnish Defence Forces 1.4 mod

; Download base version of the mod from one of these five sources and then run automatic installation

{
	http://files.ofpisnotdead.com/files/ofpd/mods/fdfmod13_installer.exe
	http://fdfmod.dreamhosters.com/ofp/fdfmod13_installer.exe
	ftp://ftp.armedassault.info/ofpd/mods/fdfmod13_installer.exe
	https://www.gamefront.com/games/operation-flashpoint-resistance/file/finnish-defence-forces finnish-defence-forces/download expires= fdfmod13_installer.exe
	http://pulverizer.pp.fi/ewe/mods/fdfmod13_installer.exe
}


; Download update from one of these five sources and then run automatic installation

{
	http://files.ofpisnotdead.com/files/ofpd/mods/fdfmod14_ww2.rar
	http://fdfmod.dreamhosters.com/ofp/fdfmod14_ww2.rar
	ftp://ftp.armedassault.info/ofpd/mods/fdfmod14_ww2.rar
	https://www.gamefront.com/games/operation-flashpoint/file/fdf-mod fdf-mod/download expires= fdfmod14_ww2.rar
	http://pulverizer.pp.fi/ewe/mods/fdfmod14_ww2.rar
}


; Download and extract desert pack

UNPACK {
	http://files.ofpisnotdead.com/files/ofpd/mods/FDF_desert_pack.rar
	http://fdfmod.dreamhosters.com/ofp/FDF_desert_pack.rar
	ftp://ftp.armedassault.info/ofpd/mods/FDF_desert_pack.rar
}

; Move extracted readme file to the modfolder\readme_addons

MOVE  "FDF Mod - Al Maldajah - Readme.txt" readme_addons

; Move all remaining extracted files and folders to the modfolder

MOVE  * /match_dir


; Download and extract Winter Maldevic island

UNPACK {
	http://files.ofpisnotdead.com/files/ofpd/islands2/fdf_winter_maldevic.rar
	http://fdfmod.dreamhosters.com/ofp/fdf_winter_maldevic.rar
	ftp://ftp.armedassault.info/ofpd/islands2/fdf_winter_maldevic.rar
}

; Move extracted readme file to the modfolder\readme_addons

MOVE  "FDF Mod - Winter Maldevic - Readme.txt" readme_addons

; Move all remaining extracted files and folders to the modfolder

MOVE  * /match_dir


; Download and extract Suursaari island

UNPACK {
	http://files.ofpisnotdead.com/files/ofpd/islands/Suursaari_release_v10.zip
	http://fdfmod.dreamhosters.com/ofp/Suursaari_release_v10.zip
	ftp://ftp.armedassault.info/ofpd/islands/Suursaari_release_v10.zip
}

; Move extracted addon the modfolder\addons

MOVE    FDF_Suursaari.pbo  addons

; Move extracted folder with island cutscenes to the modfolder\IslandCutscenes

MOVE    Suursaari_anim  IslandCutscenes

; Move all remaining extracted files to the modfolder\readme_addons

MOVE    *  readme_addons


; Download and extract Winter Kolgujev island

UNPACK {
	http://files.ofpisnotdead.com/files/ofpd/islands/WinterNogojev11.zip
	https://fdfmod.dreamhosters.com/ofp/WinterNogojev11.zip
	ftp://ftp.armedassault.info/ofpd/islands/WinterNogojev11.zip
	https://www.gamefront.com/games/operation-flashpoint-resistance/file/winternogojev11-zip winternogojev11-zip/download expires= winternogojev11.zip
	https://ds-servers.com/gf/operation-flashpoint-resistance/modifications/islands/winternogojev11-zip.html files/gf/ store.node winternogojev11.zip
	https://www.lonebullet.com/mods/download-winternogojev11-operation-flashpoint-resistance-mod-free-42045.htm /file/ files.lonebullet.com winternogojev11.zip
}

; Move all extracted addons the modfolder\addons

MOVE    *.pbo  addons

; Move extracted readme file to the modfolder\readme_addons

MOVE    "Readme-Winter Nogojev.txt"  readme_addons

; Move extracted folder with island cutscenes to the modfolder\IslandCutscenes

MOVE    KEGnoecainS_anim  IslandCutscenes


; Download and extract MT-LB addon

UNPACK {
	http://fdfmod.dreamhosters.com/ofp/mt-lb22.zip
	http://ofp-faguss.com/addon/finmod/mt-lb22.zip
	http://faguss.paradoxstudio.uk/addon/finmod/mt-lb22.zip
}

; Move all extracted addons the modfolder\addons

MOVE    *.pbo  addons

; Move extracted readme file to the modfolder\readme_addons and rename it to mt-lb22_release_info.txt

MOVE    release_info.txt  readme_addons  mt-lb22_release_info.txt


; Download and extract Russians Weapons Pack

UNPACK {
	http://files.ofpisnotdead.com/files/ofpd/unofaddons/RussianWeaponsPack11.zip
	http://fdfmod.dreamhosters.com/ofp/RussianWeaponsPack11.zip 
	ftp://ftp.armedassault.info/ofpd/unofaddons/RussianWeaponsPack11.zip
}

; Move all extracted addons the modfolder\addons

MOVE    *.pbo  addons

; Move extracted readme file to the modfolder\readme_addons and rename it to RussianWeaponsPack11_readme.txt

MOVE    readme.txt  readme_addons  RussianWeaponsPack11_readme.txt


; Automatically install fixed version of Smith & Wesson Revolvers Addon

{
	http://ofp-faguss.com/addon/finmod/SWRevolvers10_fixed.7z
	http://faguss.paradoxstudio.uk/addon/finmod/SWRevolvers10_fixed.7z
	https://docs.google.com/uc?export=download&id=1wAoTEeAuEvveYe2EZnVu_Gic7Nib-7qO SWRevolvers10_fixed.7z
}


; Replace resource.cpp for widescreen compatibility

UNPACK {
	http://ofp-faguss.com/fwatch/download/ofp_aspect_ratio207.7z 
	http://faguss.paradoxstudio.uk/fwatch/download/ofp_aspect_ratio207.7z
}
MOVE    Files\FDF\Resource.cpp  bin

; Replace island cutscenes so that a message will show up when Fwatch is enabled

UNPACK {
	http://ofp-faguss.com/fwatch/download/anims_fwatch.7z 
	http://faguss.paradoxstudio.uk/fwatch/download/anims_fwatch.7z
}
MOVE    Files\FDF\Anims.pbo  dta


; Create a UI config for Fwatch - it will enlarge action menu and chat and make them blue

EDIT    bin\config_fwatch_hud.cfg  0  ACTION_ROWS=43;CHAT_ROWS=12;CHAT_Y=0.56;GROUPDIR_Y=0.5;ACTION_COLORTEXT=[1,1,1,1];ACTION_COLORSEL=[0.133333,0.643137,1,1];CHAT_COLORTEAM=[0.133333,0.643137,1,1];  /newfile

This is a script for installing WarGames League 5.12 mod


; Installer will automatically download file from one of these three sources, extract it and then move files to the game directory

{
	ftp://ftp.armedassault.info/ofpd/unofaddons2/WGL5.1_Setup.exe
	https://www.moddb.com/downloads/start/93621  /downloads/mirror/  WGL5.1_Setup.exe
	https://ofp.today/Addons?dir=mods  file=WGL5.1_Setup.exe  WGL5.1_Setup.exe
}

; Same with mod patch

{
	http://pulverizer.pp.fi/ewe/mods/wgl512_2006-11-12.rar
	https://www.moddb.com/downloads/start/93801  /downloads/mirror/  wgl512_2006-11-12.rar
	http://www.mediafire.com/file/4rm6uf16ihe36ce  ://download  wgl512_2006-11-12.rar
}

; If user has 1.96 version of the game or older

IF_VERSION  <=  1.96
	; Extract Res\Dta\HWTL\data.pbo (contains game textures) to the modfolder\dta\hwtl

	UNPBO  <game>\Res\Dta\HWTL\data.pbo  dta\HWTL
	
	; Copy all paa and pac files from the modfolder\newdata to the modfolder\dta\hwtl\data

	COPY   <mod>\newdata\*.pa?           dta\HWTL\Data
	
	; Generate pbo file out of the recently extracted addon (data.pbo) and remove the source

	MAKEPBO
	
	; Extract Res\Dta\HWTL\data3d.pbo (contains game models) to the modfolder\dta\hwtl

	UNPBO  <game>\Res\Dta\HWTL\data3d.pbo  dta\HWTL
	
	; Copy all p3d files from the modfolder\newdata to the modfolder\dta\hwtl\data3d

	COPY   <mod>\newdata\*.p3d             dta\HWTL\data3d
	
	; Generate pbo file out of the recently extracted addon (data3d.pbo) and remove the source

	MAKEPBO
	
; For game versions newer than 1.96

ELSE
	; Extract Dta\data.pbo (contains game textures) to the modfolder\dta

	UNPBO  <game>\DTA\Data.pbo  dta
	
	; Copy all paa and pac files from the modfolder\newdata to the modfolder\dta\data

	COPY   <mod>\newdata\*.pa?  dta\Data
	
	; Generate pbo file out of the recently extracted addon (data.pbo) and remove the source

	MAKEPBO
	
	; Extract Dta\HWTL\data3d.pbo (contains game models) to the modfolder\dta

	UNPBO  <game>\DTA\Data3D.pbo  dta
	
	; Copy all p3d files from the modfolder\newdata to the modfolder\dta\data3d

	COPY   <mod>\newdata\*.p3d    dta\Data3D
	
	; Generate pbo file out of the recently extracted addon (data3d.pbo) and remove the source

	MAKEPBO
	
; Close section of commands that depend on the game version

ENDIF

; Replace resource.cpp for widescreen compatibility

UNPACK {
	http://ofp-faguss.com/fwatch/download/ofp_aspect_ratio207.7z 
	http://faguss.paradoxstudio.uk/fwatch/download/ofp_aspect_ratio207.7z
}
MOVE    Files\WGL\Resource.cpp  bin

; Replace island cutscenes so that a message will show up when Fwatch is enabled

UNPACK {
	http://ofp-faguss.com/fwatch/download/anims_fwatch.7z 
	http://faguss.paradoxstudio.uk/fwatch/download/anims_fwatch.7z
}
MOVE    Files\WGL\Anims.pbo  dta

Testing Scripts

Launch fwatch\data\addonInstarrer.exe. The installer will start in test mode.


Section "Edit Script":

  • write your installation script here
  • "Save and Test" (CTRL-S) - saves written text to the fwatch\data\addonInstaller_test.txt and then interprets it
  • "Reload file" - reads contents of fwatch\data\addonInstaller_test.txt to the text input
  • "Documentation" - opens this page in a web browser
  • "Convert download link" - opens dialog for making links (from certain sites) usable by the installer
  • "Insert DTA template" - pastes code for modifying dta\data.pbo and dta\data3d.pbo
  • CTRL-A - selects entire text
  • CTRL-D - duplicate current line

Section "Testing":

  • "Mod name" - determines destination folder; it's also important for the auto installation and "move" command
  • "Dir name" - use it to install to a different directory
  • "Game version" - for testing conditions

  • "Open mod folder" - opens destination folder in the Windows Explorer. If it doesn't exist then it opens game directory instead
  • "Open fwatch\tmp\_extracted" - opens folder (in the Windows Explorer) to which the installer extracts archives

  • |< - rewinds installation to the beginning
  • << - move to the previous command
  • >> - executes current command
  • > - executes commands until the end. Press again to stop (after the current action)

  • "Commands" - list of commands from the installation script. Click on one to get more information about it
  • "Jump to this step" - makes installer start from the selected command. If you're using this option to go backwards then installer will revert changes
  • "Show in script" - selects line with the current command in the script text input
  • "Open documentation" - opens page with information about this command in a web browser

Section "Log":

  • upper window shows what the installer has done so far
  • lower window shows progress for the current action

In testing mode more disk space is required:

  • downloaded files won't be removed
  • installer backups more files than in normal mode

Installer generates fwatch\tmp\__downloadtoken file which you can use to find intermediate download links:

  • Open it in your web browser
  • Find the Download button, right-click on it and select Inspect
  • Property href contains the link you're looking for. Pick a small part of it that is constant
  • Do a search to make sure that the selected part does not occur anywhere else in the file
  • If it doesn't then you can add it to your installation script

Version History
0.61 (13.06.2023)
  • Ask_run - opens directory in Windows Explorer
  • Auto Install - removed subfolder "worlds" from mod detection


0.6 (29.04.2021)
  • Edit - added /timestamp: switch
  • MakePBO - added /timestamp: switch


0.59 (05.03.2021)
  • Auto Install - If "Missions" contains only a single folder inside then that subfolder will be merged with "<mod>\Missions" only if its name matches the mod name. Otherwise it will be moved as a separate subfolder


0.58 (25.02.2021)
  • Added EXIT command
  • Move – added switch /match_dir_only
  • Installer removes previously downloaded file when starting download for a new file except when using GET command
  • Intermediary URL part may contain phrase href=" and installer will read the link following that phrase


0.57 (11.02.2021)
  • Added FILEDATE command


0.56 (05.02.2021)
  • Auto Install - will try to extract .cab files
  • Auto Install - will detect if mission is a wizard template and move it to the "Templates" or "SPTemplates"
  • Auto Install - will detect if "MPMissions" folder contains a single folder inside and move it instead (previously it only did that for "Missions")
  • Auto Install - will not ignore "Res" folder
  • Auto Install - if downloaded archive contains a single folder then that folder won't be ignored (previously it could have been treated as a different mod and skipped)
  • Auto Install - if a folder contains "overview.html" then it will be copied to "Missions"
  • Auto Install - if a directory contains wanted modfolder then installer will move all files and folders from that dir (except for other modfolders). Folder "addons" will be copied as "IslandCutscenes"
  • Auto Install - will try open all executables; will ask user to run it if nothing else was copied (instead of asking about the first encountered)
  • Auto Install - will move directories ending with "anim", "_anim", "_anims" to the "IslandCutscenes" or "IslandCutscenes\_Res" if parent was named "res" or had words "res" and "addons"
  • Auto Install - will move mission directories containing words "demo" or "template" to the "MissionsUsers" or "MPMissionsUsers"
  • Auto Install - will move folders "Templates", "SPTemplates", "MissionsUsers", "MPMissionsUsers", "IslandCutscenes" to the modfolder
  • Auto Install - will scan directories before files (previously it was alphabetic)
  • Auto Install - will move mission folder to the to the "MissionsUsers" or "MPMissionsUsers" if one of the parent folders contained word "user" or words "mission" and "demo/editor/template"
  • MakePBO - renamed switch /no_delete to /keep_source
  • Alias - added alternative name for this command: Merge_With


0.55 (12.01.2021)
  • Removed /mirror switch. Instead there are now url blocks indicated by curly brackets
  • Move – curly brackets are now used (instead of a vertical bar) to separate url arguments from move arguments


0.53 (01.03.2020)
  • Alias – effect now lasts until the end of the script (instead of throughout the entire installation)
  • Added shorter name UnPBO for the command UnpackPBO


0.52 (16.02.2020)
  • Command arguments can now be escaped with custom delimiters (relevant for the Edit command)


0.51 (14.02.2020)
  • Added command: Alias
  • Auto installation - reverted change from 0.31: file name irrelevant for auto installation again (use command Alias instead)
  • Auto installation - now detects if mission is SP or MP and copies it to the correct folder
  • Edit – added /append switch
  • MakePBO – fixed bug where it wouldn't work with files with spaces in their names


0.4 (15.07.2019)
  • Edit – added /newfile switch
  • Edit – switch /insert can now be used to append text at the end


0.31 (06.04.2019)
  • Auto installation - doesn't ignore modfolders if their name is contained in downloaded filename


0.3 (02.04.2019)
  • Download links can now be followed with /mirror switch
  • Download links can now be followed with extra arguments for multi-step downloading

  • Move – wildcard with /match_dir will move modfolder to the game dir but not recursively
  • Move – added vertical bar to separate download arguments from move arguments

  • Ask_Get – doesn't make a request if file already exists
  • Ask_Get – asks user to select download directory and saves its location
  • Ask_Get – automatically moves file to the fwatch\tmp\

  • Ask_Run – executes the file instead of opening folder with it
  • Ask_Run - restores "Aspect_Ratio.hpp" from before executing the file in order to keep user's settings

  • Get - now considered active again
  • Get - cannot pass custom wget arguments anymore

  • added -testdir parameter


0.2 (11.03.2019)
  • added commands: Ask_Download, Delete, Rename, If_version, else, endif, Makepbo, UnpackPBO, Edit
  • renamed command Execute to Ask_Execute
  • renamed command Mdir to Makedir

  • Move – now overwrites by default, added /no_overwrite switch
  • Move – can access modfolder files with >mod> macro
  • Move – can now rename files
  • Move – wildcards will not match folders unless /match_dir switch was added
  • Move – renamed macro DOWNLOADED_FILENAME to <download> and <dl>
  • Move – now source argument can be url

  • Copy – can access game root directory with <game> macro

  • Makedir – could be used to create custom folders in the game root directory – fixed
  • Makedir – now creates modfolder if it’s missing

  • Unpack, Ask_Execute – will work on downloaded file if no argument given
  • Unpack, Ask_Execute – now source argument can be url
  • Unpack – archive within archive was unpacked to the wrong folder – fixed
  • Unpack – added /password: switch

  • Auto Installation – added /password: switch

  • Get – now considered obsolete

  • added -testmod parameter


0.1 (03.03.2017)
First release.