Forums

[Script] [i]Close Combat III: Cross of Iron[/i]

Auteur Réponses
mark7 Samedi 18 Avril 2015 à 19:04
mark7Anonymous

- Real-time tactics video game

- Will crash if run with other than an 800x600 desktop at start (the install script already takes care of this), but in-game the resolution may be increased.

#!/bin/bash
# Date : (2015-04-11 10-32)
# Last revision : (2015-04-11 10-32)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie (Testing)
# Author : Mark Schreiber mark7@alumni.cmu.edu
# Script licence : GPL v.3
# Program licence : Retail
# Depend :

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="Close Combat III: Cross of Iron"
PREFIX="CloseCombatCrossOfIron"

POL_SetupWindow_Init

POL_SetupWindow_browse "Please select the installer executable:" "$TITLE" ""

POL_SetupWindow_wait "Please wait" "$TITLE"

POL_Wine_SelectPrefix "$PREFIX"

POL_Wine_PrefixCreate

POL_Wine start /unix "$APP_ANSWER"

POL_Wine_WaitExit "$TITLE"

POL_System_TmpCreate "$PREFIX"

# Wine currently can't play CC3:CoI videos.  The game will terminate
# if it tries.  Disable videos.
pushd "$POL_System_TmpDir"

cat >"$POL_System_TmpDir/cc3settings.reg" <<'EOF'
[HKEY_LOCAL_MACHINE\Software\CSO\Close Combat\3.50]
"PlayVideos"=hex:00,00,00,00
EOF

POL_Wine regedit "cc3settings.reg"

rm cc3settings.reg

popd

# CC3:CoI currently crashes at at launch at any other resolutions.
Set_Desktop "On" "800" "600"

POL_System_TmpDelete

POL_Shortcut 'CC3.exe' "$TITLE"
POL_Shortcut_Document "$TITLE" "$PREFIX/Matrix Games/Close Combat III/Manuals/MANUAL.PDF"

POL_SetupWindow_Close
exit

 

Edité par mark7

Ronin DUSETTE Samedi 18 Avril 2015 à 19:39
Ronin DUSETTE

A couple of things:

I would strongly recommend delcaring and using a WINEVERSION. There is really no reason not to, and it will make sure that the game works on as many systems as possible. Check out some other scripts and you will see. It takes only a couple of minutes to add it in and test. I cringe when I see scripts without that. hahaha. :)

Also, exit should be followed by a like:

exit 0

You also need to add eval_gettext for translation purposes to user-facing messages. Check out the Wiki's scripting documentation for more information:

http://wiki.playonlinux.com/index.php/Scripting_-_Chapter_10:_Script_Translation


Please:
Post debug logs & full computer specs in first post
No private messages for general help, use the forums
Read the wiki, Report broken scripts
petch Samedi 18 Avril 2015 à 20:05
petch

Hi,

In addition to what Ronin said,

- Your script lacks POL_Debug_Init to activate embedded debugger support;

- Before POL_SetupWindow_browse it's recommended to use cd "$HOME" or just cd for short, to set the default browsing directory; That's just an extra safety, because sometimes you can be surprized by the default directory...

- POL_SetupWindow_wait "Please wait" "$TITLE" is probably useless, because POL_Wine_PrefixCreate, which is the next statement taking some time, will already display a waiting message and override yours;

- POL_Wine start /unix "$APP_ANSWER" avoid start /unix if you can. See the lengthy explanation in the Wiki;

- POL_Shortcut_Document "$TITLE" "$PREFIX/Matrix Games/Close Combat III/Manuals/MANUAL.PDF"

I doubt this path is correct, if the game installs below "Matrix Games", the parent directory should be "drive_c", not "$PREFIX". In any case, while the POL_Shortcut_Document semantics should be better defined in future versions of PlayOnLinux, for the time being I suggest using absolute paths to remove any ambiguity, so most likely "$WINEPREFIX/drive_c/Matrix Games/..."

Regards,

Pierre

mark7 Dimanche 19 Avril 2015 à 13:15
mark7Anonymous

- Real-time tactics video game

- Will crash if run with other than an 800x600 desktop at start (the install script already takes care of this), but in-game the resolution may be increased.
 

#!/bin/bash
# Date : (2015-04-11 10-32)
# Last revision : (2015-04-11 10-32)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie (Testing)
# Author : Mark Schreiber mark7@alumni.cmu.edu
# Script licence : GPL v.3
# Program licence : Retail
# Depend :

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="Close Combat III: Cross of Iron"
PREFIX="CloseCombatCrossOfIron"
WINEVERSION="1.6.2"

POL_SetupWindow_Init
POL_Debug_Init

pushd "$HOME"

POL_SetupWindow_browse "$(eval_gettext "Please select the installer executable:")" "$TITLE" ""

popd

POL_Wine_SelectPrefix "$PREFIX"

POL_Wine_PrefixCreate

POL_Wine "$APP_ANSWER"

POL_Wine_WaitExit "$TITLE"

POL_System_TmpCreate "$PREFIX"

# Wine currently can't play CC3:CoI videos.  The game will terminate
# if it tries.  Disable videos.
pushd "$POL_System_TmpDir"

cat >"$POL_System_TmpDir/cc3settings.reg" <<'EOF'
[HKEY_LOCAL_MACHINE\Software\CSO\Close Combat\3.50]
"PlayVideos"=hex:00,00,00,00
EOF

POL_Wine regedit "cc3settings.reg"

rm cc3settings.reg

popd

# CC3:CoI currently crashes at at launch at any other resolutions.
Set_Desktop "On" "800" "600"

POL_System_TmpDelete

POL_Shortcut 'CC3.exe' "$TITLE"
POL_Shortcut_Document "$TITLE" "$WINEPREFIX/drive_c/Matrix Games/Close Combat Cross of Iron/Close Combat III/Manuals/MANUAL.PDF"

POL_SetupWindow_Close
exit 0

 

petch Dimanche 19 Avril 2015 à 14:00
petch

POL_SetupWindow_browse "$(eval_gettext "Please select the installer executable:")" "$TITLE" ""

Please use the standardized translation key in this case:

POL_SetupWindow_message "$(eval_gettext 'Please select the setup file to run.')" "$TITLE"

 

WINEVERSION="1.6.2"
...
POL_Wine_PrefixCreate

If you want to enforce the use of a specific version of Wine, you must pass the version to POL_Wine_PrefixCreate:

POL_Wine_PrefixCreate "$WINEVERSION"

That's all for me, with those changes I think your script can be added to the repository :)

mark7 Dimanche 19 Avril 2015 à 19:50
mark7Anonymous

- Real-time tactics video game

- Will crash if run with other than an 800x600 desktop at start (the install script already takes care of this), but in-game the resolution may be increased.

#!/bin/bash
# Date : (2015-04-11 10-32)
# Last revision : (2015-04-11 10-32)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie (Testing)
# Author : Mark Schreiber mark7@alumni.cmu.edu
# Script licence : GPL v.3
# Program licence : Retail
# Depend :

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="Close Combat III: Cross of Iron"
PREFIX="CloseCombatCrossOfIron"
WINEVERSION="1.6.2"

POL_SetupWindow_Init
POL_Debug_Init

pushd "$HOME"

POL_SetupWindow_browse "$(eval_gettext "Please select the setup file to run.")" "$TITLE" ""

popd

POL_Wine_SelectPrefix "$PREFIX"

POL_Wine_PrefixCreate "$WINEVERSION"

POL_Wine "$APP_ANSWER"

POL_Wine_WaitExit "$TITLE"

POL_System_TmpCreate "$PREFIX"

# Wine currently can't play CC3:CoI videos.  The game will terminate
# if it tries.  Disable videos.
pushd "$POL_System_TmpDir"

cat >"$POL_System_TmpDir/cc3settings.reg" <<'EOF'
[HKEY_LOCAL_MACHINE\Software\CSO\Close Combat\3.50]
"PlayVideos"=hex:00,00,00,00
EOF

POL_Wine regedit "cc3settings.reg"

rm cc3settings.reg

popd

# CC3:CoI currently crashes at at launch at any other resolutions.
Set_Desktop "On" "800" "600"

POL_System_TmpDelete

POL_Shortcut 'CC3.exe' "$TITLE"
POL_Shortcut_Document "$TITLE" "$WINEPREFIX/drive_c/Matrix Games/Close Combat Cross of Iron/Close Combat III/Manuals/MANUAL.PDF"

POL_SetupWindow_Close
exit 0