El Foro

[Script] Civilization IV: Complete

Autor Respuestas
Jump to the page: 1 - 2 - 3 - 4 - 5 - 6
alcorsepol Tuesday 9 July 2013 at 1:54
alcorsepolAnonymous

Description:

This script installs Civilization IV: Complete according to the following order:

1: d3dx9
2: Civ IV: Complete
3: Patch 3.19 (This will be done automatically if Steam is used)
4: Override for msxml3 and msvcr71
5: msxml3

It creates an icon for all three versions of the game.

Extra notes:

If you find any bugs or have any improvements that you would like to suggest, then please let me know!

When the installation has finished, Civilization IV and the Warlords expansion might crash on the first try, but don't worry, just let it crash and then try again and it will work (Beyond the sword does not crash). This information is also available in the script when installing, so you will get reminded of this.

There's already a script available for Civilization IV, but it's old and doesn't work correctly on the Complete edition it seems. This one is updated, uses a newer version of Wine and has been tested and tailored to make sure that everything works directly after installation :)


Like I mentioned, of you see anything that I have forgotten or that can be improved, then please let me know!


Screenshots:

Screenshot 1


Screenshot 2


Screenshot 3





Install images:

Left


Top





Icons:

22x22 - For the POL List


48x48 - For the Civilization IV shortcut


48x48 - For the Warlords shortcut


48x48 - For the Colonization shortcut


48x48 - For the Beyond The Sword shortcut




Code:
[code language=playonlinux]
#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-23)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3, d3dx9
 
# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLECIV="Civilization IV"
TITLE="Civilization IV: Complete"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
TITLECOL="Civilization IV - Colonization"
AUTHOR="Jimmy Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
STEAM_ID_CIV="3900"
STEAM_ID_W="3990"
STEAM_ID_BTS="8800"
STEAM_ID_COL="16810"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"

POL_SetupWindow_InstallMethod "DVD,STEAM"

if [ "$INSTALL_METHOD" == "DVD" ]; then
    # Let the user select a DVD
    POL_SetupWindow_cdrom
 
    # Check if this DVD is the Civilization IV DVD
    POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
fi
 
# Set and install the correct Wine version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"

# Install DirectX9
POL_Call POL_Install_d3dx9

if [ "$INSTALL_METHOD" == "DVD" ]; then
    # Run installer
    POL_Wine_WaitBefore "$TITLECIV"
    POL_Wine start /unix "$CDROM/setup.exe"
    POL_Wine_WaitExit "$TITLECIV"

    #Patch Civilization IV: Beyond the sword to 3.19
    cd "$POL_USER_ROOT/tmp"
    POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
    POL_Wine_WaitBefore "$TITLECIV"
    POL_Wine Civ4BeyondTheSwordPatch3.19.exe
    POL_Wine_WaitExit "$TITLECIV"
else
    POL_Call POL_Install_steam
   
    # Start steam, update it, and install the games
    cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Steam"
    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_CIV
    POL_SetupWindow_message "$(eval_gettext 'Steam is about to perform an update.\\nAfter Steam finishes updating and shows you to the login interface, login and then let $TITLE install.\\n\\nWhen the installation is finished, press next (Do not close Steam)')" "$TITLECIV"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_W
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLEW, press next when the installation is finished')" "$TITLECIV"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_BTS
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLEBTS, press next when the installation is finished')" "$TITLECIV"
   
    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_COL
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLECOL, please quit Steam properly when the installation is finished (make sure Steam is not still in the traybar) and then press next so that the installation script can continue.')" "$TITLECIV"
    POL_Wine_WaitExit "$TITLECIV"
fi
 
# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
if [ "$INSTALL_METHOD" == "STEAM" ]; then
    POL_Shortcut "Steam.exe" "$TITLECIV" "" "-applaunch $STEAM_ID_CIV" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "$TITLEBTS" "" "-applaunch $STEAM_ID_BTS" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "$TITLEW" "" "-applaunch $STEAM_ID_W" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "$TITLECOL" "" "-applaunch $STEAM_ID_COL" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "Steam - Civ IV" "" "" "Game;"
else
    POL_Shortcut "Civilization4.exe" "$TITLECIV" "" "" "Game;StrategyGame;"
    POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "" "" "Game;StrategyGame;"
    POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "" "" "Game;StrategyGame;"
fi
 
#Done!
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nThe game might crash on the first attempt, but no worries, just try one more time.')" "$TITLECIV"
POL_SetupWindow_Close
exit 0
[/code]

Editado por: alcorsepol

petch Tuesday 9 July 2013 at 20:23
petch
Developer

Hi alcorsepol,

If you find any bugs or have any improvements that you would like to suggest, then please let me know!

Quote from alcorsepol


Ok then ;)

Well, the first thing is that many statements or code styles are deprecated, PlayOnLinux 3 statements are still supported so the script should work now, but it could very well break under PlayOnLinux 5, so better switch to up-to-date style ASAP:

POL_SetupWindow_Init

You should also be initializing PlayOnLinux debug support with POL_Debug_Init, to be sure the installation is logged.

PREFIXDIR="$HOME/.PlayOnLinux/wineprefix/$PREFIX"
...
select_prefix "$PREFIXDIR"

Deprecated, use POL_Wine_SelectPrefix "$PREFIX" instead and drop this $PREFIXDIR.

POL_SetupWindow_install_wine "$WORKINGWINEVERSION"
Use_WineVersion "$WORKINGWINEVERSION"
POL_SetupWindow_prefixcreate

Deprecated, use POL_Wine_PrefixCreate "$WORKINGWINEVERSION", that will take care of everything.
 
POL_SetupWindow_message "When the installer asks you for the second CDROM, click Forward." "$TITLECOMPLETE"

A general comment about all the script messages: you should be using $(eval_gettext '...') to support their localization. See http://www.playonlinux.com/en/dev-documentation-10.html

cd "$HOME/.PlayOnLinux/ressources"
POL_Download_Resource "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"

From my point of view, "resources" should be reusable files. The only script that will probably use this file is yours, I don't know how large it is, but it will probably from there on only take space in some hidden corner of the disk ;)
Downloading with POL_Download in $POL_USER_ROOT/tmp seems more appropriate to me, and it supports checksumming just as well (unless you have a good reason to put it into ressources).

POL_SetupWindow_wait_next_signal "Patching game..." "$TITLECOMPLETE"
wine Civ4BeyondTheSwordPatch3.19.exe
POL_SetupWindow_detect_exit

Two things here:
- calling wine directly is now forbidden, as such call won't appear in the installation logs. Always use POL_Wine in its place.
- POL_SetupWindow_wait_next_signal and POL_SetupWindow_detect_exit are both deprecated. A POL_Wine_WaitBefore "$TITLE" before the POL_Wine is usually enough, if the program detaches itself, there's also a POL_Wine_WaitExit "$TITLE" that can be used after the POL_Wine line.

PROGRAMFILES="Program Files"
POL_LoadVar_PROGRAMFILES
...
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/2K Games/Firaxis Games/Sid Meier's Civilization 4 Complete" "Civilization4.exe" "" "$TITLE"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "$TITLE"

POL_SetupWindow_make_shortcut and Set_WineVersion_Assign are deprecated, use POL_Shortcut instead. Since it can usually find the path of the program by itself, it also makes the $PROGRAMFILES extra code obsolete. Per shortcut Wine version is no longer supported by PlayOnLinux 4.
[/code]

Too many scripts are still coded in POL3 style, so it's not straightforward to find good example scripts.
The scriptwriter's documentation (http://www.playonlinux.com/en/documentation.html) is reasonably up-to-date, the scripts I maintain (most notably the GOG.com scripts) are up-to-date too, and so are the scripts updated or rewritten by Superplumus, so having a look at the scripts recently updated (first page of the scripts repository, http://www.playonlinux.com/en/supported_apps.html) should also be a good source of clean examples.

Regards,
Pierre.

Editado por: petch

alcorsepol Tuesday 9 July 2013 at 22:19
alcorsepolAnonymous

Hey Pierre!

Thanks a bunch for the detailed feedback :-)
I will read through everything and update the script as needed and then try again, thanks!
alcorsepol Saturday 13 July 2013 at 13:36
alcorsepolAnonymous

Ok so I updated the script now :)
But I'm having a small issue, that when the installation has finished and the icons have been created, it just stops at "Please wait" and hangs there for an eternity.
If I press cancel then the game can be started, but I need to get rid of that "Please wait" window.

Any ideas?

#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-13)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3
 
# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLECOMPLETE="Civilization IV: Complete"
TITLE="Civilization IV"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
AUTHOR="Jimmy Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"
 
# Let the user select a CDROM
POL_SetupWindow_cdrom
 
# Check if this CDROM is the Civilization IV CDROM
POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
 
# Set and install the correct Wind version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"
 
PROGRAMFILES="Program Files"
POL_LoadVar_PROGRAMFILES
 
# Install DirectX9
POL_Call POL_Install_d3dx9
 
# Run installer
POL_SetupWindow_menu "$(eval_gettext 'Which installation medium do you want to use?')" "Medium" "DVD~CDROM" "~"
wine start /unix "$CDROM/setup.exe"
if [ "$APP_ANSWER" == "CDROM" ]; then
POL_SetupWindow_message "$(eval_gettext 'When the installer asks you for the second CDROM, click Forward.')" "$TITLECOMPLETE"
fi
 
POL_SetupWindow_message "$(eval_gettext 'Click Forward when the installation is finished')" "$TITLECOMPLETE"

#Patch Civilization IV: Beyond the sword to 3.19
cd "$POL_USER_ROOT/tmp"
POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
POL_Wine_WaitBefore "$TITLECOMPLETE"
POL_Wine Civ4BeyondTheSwordPatch3.19.exe
POL_SetupWindow_detect_exit
 
# Download and install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
POL_Shortcut "Civilization4.exe" "$TITLE"
POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS"
POL_Shortcut "Civ4Warlords.exe" "$TITLEW"
 
#Done!
POL_SetupWindow_message "$(eval_gettext '$TITLECOMPLETE installed\\n\\nPlease note that Civilization IV and the Warlords expansion might crash on the first attempt.\\nBut don't worry, just try again if they do.')"
POL_SetupWindow_Close
exit 0

Editado por: alcorsepol

petch Saturday 13 July 2013 at 15:14
petch
Developer

Hi alcorsepol,

Maybe because of POL_SetupWindow_detect_exit? As I said it's deprecated, and maybe slightly broken now. Try to remove it, or replace it with POL_Wine_WaitExit "$TITLECOMPLETE".

I didn't see it the first time around, but a better alternative to your POL_SetupWindow_menu line 46 is to use POL_SetupWindow_InstallMethod "CD,DVD" that will do just the same thing (and then some: display small icons) and fill $INSTALL_METHOD with the user answer.

Thinking of it, there's something weird in the script now, you're asking the user to select a media, and only much later whether (s)he wants to install from a CD or from a DVD. It would be much more natural to swap some things around, like:
- game/script presentation
- installation method selection
- media/installer detection
- virtual drive creation
- virtual drive initial setup
- installer execution
- patch download
- patch execution
- more tweaks
- shortcuts creation
- installation ending

Beside that, you left the $PROGRAMFILES stuff that's no longer used later in the script, and the last POL_SetupWindow_message statement is lacking its 2nd argument ("$TITLECOMPLETE" probably).

Small improvement, but you couldn't guess since it's not in the documentation yet, POL_Shortcut can create entries in the system menus if a menu category (http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry) is provided as a 5th argument; So you can write

[code language=playonlinux]
POL_Shortcut "Civilization4.exe" "$TITLE" "" "" "Game;StrategyGame;"
[/code]
etc.

Getting there ;)
Let me know if some parts of this message are unclear.

Regards,
Pierre.

Editado por: petch

steve723 Sunday 14 July 2013 at 3:18
steve723Anonymous

Please add a Steam install option. The Steam version is already updated to the latest version. Thanks.
alcorsepol Sunday 14 July 2013 at 10:24
alcorsepolAnonymous

Please add a Steam install option. The Steam version is already updated to the latest version. Thanks.

Quote from steve723


When the basic part of the script is finished and tested, I promise to add a Steam option as well :-)

This is my first script for POL so I need some time ;D

Anyway, here's the updated script.
I removed the CD part now, since I remembered that the Complete edition only has a DVD, so there's no need for the CD option.

I'm still getting the "Please wait" at the end though.
Maybe someone else can try it out?
Maybe there's something wrong with my installation?

Am I still missing something? :P
Thanks again for the help btw petch!

#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-14)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3
 
# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLECOMPLETE="Civilization IV: Complete"
TITLE="Civilization IV"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
AUTHOR="Jimmy Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"
 
# Let the user select a DVD
POL_SetupWindow_cdrom
 
# Check if this CDROM is the Civilization IV DVD
POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
 
# Set and install the correct Wind version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"

# Install DirectX9
POL_Call POL_Install_d3dx9
 
# Run installer
POL_Wine start /unix "$CDROM/setup.exe"
POL_SetupWindow_message "$(eval_gettext 'Click Forward when the installation is finished')" "$TITLECOMPLETE"

#Patch Civilization IV: Beyond the sword to 3.19
cd "$POL_USER_ROOT/tmp"
POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
POL_Wine_WaitBefore "$TITLECOMPLETE"
POL_Wine Civ4BeyondTheSwordPatch3.19.exe
POL_Wine_WaitExit "$TITLECOMPLETE"
 
# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
POL_Shortcut "Civilization4.exe" "$TITLE" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "" "" "Game;StrategyGame;"
 
#Done!
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nPlease note that Civilization IV and the Warlords expansion might crash on the first attempt.\\nBut don't worry, just try again if they do.')" "$TITLECOMPLETE"
POL_SetupWindow_Close
exit 0

petch Sunday 14 July 2013 at 11:08
petch
Developer

No problem :)

I think your last issue comes from the apostrophe in "don't" that breaks Bash parsing of quotes.
I'm not sure what's the best fix for this.
Simplest fix is to drop the apostrophe, it's not that bad and best case the english translator may notice it and put back the apostrophe in the translation (what's in the script is only, after all, the "key" to find the translations).
You could also use some character that looks like an apostrophe but is not the single quote, like ’ (Unicode U+2019).
From a pure scripting quotation issue, I can think of two syntaxes to fix it:
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nPlease note that Civilization IV and the Warlords expansion might crash on the first attempt.\\nBut don'"'"'t worry, just try again if they do.')" "$TITLECOMPLETE"
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nPlease note that Civilization IV and the Warlords expansion might crash on the first attempt.\\nBut don'\\''t worry, just try again if they do.')" "$TITLECOMPLETE"

But I'm not sure it will interact correctly with gettext translation tools and mechanisms.

Editado por: petch

petch Sunday 14 July 2013 at 17:48
petch
Developer

From a discussion with "old timers" here, removing the apostrophe (dont instead of don't) is the preferred solution.
alcorsepol Sunday 14 July 2013 at 23:22
alcorsepolAnonymous

From a discussion with "old timers" here, removing the apostrophe (dont instead of don't) is the preferred solution.

Quote from petch


Yeah stupid mistake of me, but I didn't have any syntax highlightning in that editor so was hard to see. Thanks yet again!

The script now works and is ready for testing :)
I will add the steam support once this part of the script has been approved.

#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-14)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3
 
# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLECOMPLETE="Civilization IV: Complete"
TITLE="Civilization IV"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
AUTHOR="Jimmy Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"
 
# Let the user select a DVD
POL_SetupWindow_cdrom
 
# Check if this CDROM is the Civilization IV DVD
POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
 
# Set and install the correct Wind version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"

# Install DirectX9
POL_Call POL_Install_d3dx9
 
# Run installer
POL_Wine start /unix "$CDROM/setup.exe"
POL_SetupWindow_message "$(eval_gettext 'Click Next when the installation is finished')" "$TITLECOMPLETE"

#Patch Civilization IV: Beyond the sword to 3.19
cd "$POL_USER_ROOT/tmp"
POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
POL_Wine_WaitBefore "$TITLECOMPLETE"
POL_Wine Civ4BeyondTheSwordPatch3.19.exe
POL_Wine_WaitExit "$TITLECOMPLETE"
 
# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
POL_Shortcut "Civilization4.exe" "$TITLE" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "" "" "Game;StrategyGame;"
 
#Done!
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nThe game might crash on the first attempt, but no worries, just try one more time.')" "$TITLECOMPLETE"
POL_SetupWindow_Close
exit 0

Editado por: alcorsepol

petch Monday 15 July 2013 at 7:21
petch
Developer

Does replacing the POL_SetupWindow_message "Click next to continue" line 44 with a POL_Wine_WaitExit work? That would require one less action from the user...
Otherwise everything looks fine to me now.
alcorsepol Monday 15 July 2013 at 7:43
alcorsepolAnonymous

Does replacing the POL_SetupWindow_message "Click next to continue" line 44 with a POL_Wine_WaitExit work? That would require one less action from the user...
Otherwise everything looks fine to me now.

Quote from petch


Ah yeah you're right, that would probably work ^^
I'll give it a try this afternoon when I get back from work :-)
alcorsepol Tuesday 16 July 2013 at 1:03
alcorsepolAnonymous

Yeah that did the trick :-)

#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-16)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3
 
# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLECOMPLETE="Civilization IV: Complete"
TITLE="Civilization IV"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
AUTHOR="Jimmy Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"
 
# Let the user select a DVD
POL_SetupWindow_cdrom
 
# Check if this CDROM is the Civilization IV DVD
POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
 
# Set and install the correct Wind version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"

# Install DirectX9
POL_Call POL_Install_d3dx9
 
# Run installer
POL_Wine_WaitBefore "$TITLECOMPLETE"
POL_Wine start /unix "$CDROM/setup.exe"
POL_Wine_WaitExit "$TITLECOMPLETE"

#Patch Civilization IV: Beyond the sword to 3.19
cd "$POL_USER_ROOT/tmp"
POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
POL_Wine_WaitBefore "$TITLECOMPLETE"
POL_Wine Civ4BeyondTheSwordPatch3.19.exe
POL_Wine_WaitExit "$TITLECOMPLETE"
 
# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
POL_Shortcut "Civilization4.exe" "$TITLE" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "" "" "Game;StrategyGame;"
 
#Done!
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nThe game might crash on the first attempt, but no worries, just try one more time.')" "$TITLECOMPLETE"
POL_SetupWindow_Close
exit 0

alcorsepol Wednesday 17 July 2013 at 17:41
alcorsepolAnonymous

Just a quick update on this.
I have now tested the script a few extra times and everything seems to work just fine and dandy :-)

I bought the game on Steam a few minutes ago as well (sale \\,,/), so I will begin adding Steam support to the script tonight and see how that goes :-)

Over and out.
steve723 Wednesday 17 July 2013 at 18:39
steve723Anonymous

Just a quick update on this.
I have now tested the script a few extra times and everything seems to work just fine and dandy :-)

I bought the game on Steam a few minutes ago as well (sale \\,,/), so I will begin adding Steam support to the script tonight and see how that goes :-)

Over and out.

Quote from alcorsepol


:) (Steam Support). *Waits patiently.
steve723 Thursday 18 July 2013 at 21:41
steve723Anonymous

If you look at the script for the Elder Scrolls Skyrim installer then you might get an idea of how to edit this script.
alcorsepol Thursday 18 July 2013 at 21:51
alcorsepolAnonymous

Script ready for testing :-)


#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-18)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3, d3dx9
 
# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLECOMPLETE="Civilization IV: Complete"
TITLE="Civilization IV"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
TITLECOL="Civilization IV - Colonization"
AUTHOR="Jimmy Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
STEAM_ID_CIV="3900"
STEAM_ID_W="3990"
STEAM_ID_BTS="8800"
STEAM_ID_COL="16810"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"

POL_SetupWindow_InstallMethod "DVD,STEAM"

if [ "$INSTALL_METHOD" == "DVD" ]; then
    # Let the user select a DVD
    POL_SetupWindow_cdrom
 
    # Check if this DVD is the Civilization IV DVD
    POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
fi
 
# Set and install the correct Wine version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"

# Install DirectX9
POL_Call POL_Install_d3dx9

if [ "$INSTALL_METHOD" == "DVD" ]; then 
    # Run installer
    POL_Wine_WaitBefore "$TITLECOMPLETE"
    POL_Wine start /unix "$CDROM/setup.exe"
    POL_Wine_WaitExit "$TITLECOMPLETE"

    #Patch Civilization IV: Beyond the sword to 3.19
    cd "$POL_USER_ROOT/tmp"
    POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
    POL_Wine_WaitBefore "$TITLECOMPLETE"
    POL_Wine Civ4BeyondTheSwordPatch3.19.exe
    POL_Wine_WaitExit "$TITLECOMPLETE"
else
    POL_Call POL_Install_steam
    
    # Start steam, update it, and install the games
    cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Steam"
    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_CIV
    POL_SetupWindow_message "$(eval_gettext 'Steam is about to perform an update.\\nAfter Steam finishes updating and shows you to the login interface, login and then let $TITLE install.\\n\\nWhen the installation is finished, press next (Do not close Steam)')" "$TITLECOMPLETE"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_W
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLEW, press next when the installation is finished')" "$TITLECOMPLETE"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_BTS
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLEBTS, press next when the installation is finished')" "$TITLECOMPLETE"
    
    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_COL
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLECOL, please quit Steam properly when the installation is finished (make sure Steam is not still in the traybar) and then press next so that the installation script can continue.')" "$TITLECOMPLETE"
    POL_Wine_WaitExit "$TITLECOMPLETE"
fi
 
# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
POL_Shortcut "Civilization4.exe" "$TITLE" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "" "" "Game;StrategyGame;"
POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "" "" "Game;StrategyGame;"

if [ "$INSTALL_METHOD" == "STEAM" ]; then
    POL_Shortcut "Colonization.exe" "$TITLECOL" "" "" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "Steam - Civ IV" "" "" "Game;"
fi
 
#Done!
POL_SetupWindow_message "$(eval_gettext 'Installation finished\\n\\nThe game might crash on the first attempt, but no worries, just try one more time.')" "$TITLECOMPLETE"
POL_SetupWindow_Close
exit 0

Editado por: alcorsepol

steve723 Saturday 20 July 2013 at 9:45
steve723Anonymous

Your script got stuck on the part where is says 'Please wait while Civilization IV: Complete is installed...' I am installing the Steam version so I had to copy from here and paste into Kate. I saved it as a txt file then ran it from the tools menu of POL. Yes I checked first to see if it was in POL scripts but only the DVD version was there under testing. Maybe since I only have the basic version?

I made the short cuts manully, due to the script getting stuck and having to be cancled before completing which it never did snce it seemed to get stuck. I tried running the script and got an error message: Failed to find Steam. That dosn't make sense since when I went to make short cuts it showed a lot of icons for steam. I'll try some more in a while. I need to go to bed now.

Editado por: steve723

alcorsepol Saturday 20 July 2013 at 12:06
alcorsepolAnonymous

Ah so you don't have the complete edition?
Currently the script only supports the complete edition, but I think I will have to add support for installing the games individually as well.

Either that or I'll write separate scripts for all of them, maybe that's best?
Anyone have an opinion about that?
steve723 Saturday 20 July 2013 at 20:47
steve723Anonymous

Good luck Learning how to do these scripts. I am trying to learn them too. Right now I am on chapter six of the documentation trying to write a script to install Firefox. I should be able to figure that out soon. Maybe then I can write a script to install the new Firefall game. First I need to fix /boot partion as 'snowhog' on the Kubuntu forms pointed out that my /boot is full. I thought 681M, would be enough. Lol There is lots of unpartioned space on that drive though so I will just increase the partion size. Maybe after this game can be installed.

Editado por: steve723