The forum

Zoo Tycoon 2: Zookeeper Collection

Script

Author Replies
horsemanoffaith Monday 11 February 2013 at 6:00
horsemanoffaithAnonymous

Here's my script for Zoo Tycoon 2: Zookeeper Collection. Let me know what you think!


#!/bin/bash
# Date : (2013-02-10 20-55)
# Last revision : (2013-02-10 20-55)
# Wine version used : 1.4.1
# Distribution used to test : Ubuntu 12.04.1 LTS 64-bit
# Author : horsemanoffaith
# Depend :
  
[ "$PLAYONLINUX" = "" ] && exit
source "$PLAYONLINUX/lib/sources"
  
TITLE="Zoo Tycoon 2: Zookeeper Collection"
PREFIX="ZT2ZC"
WORKING_WINE_VERSION="1.4.1"

  
POL_SetupWindow_Init
POL_RequiredVersion "4.0.18"
POL_Debug_Init
  
POL_SetupWindow_presentation "$TITLE" "Microsoft Games" "http://www.microsoft.com" "horsemanoffaith" "$PREFIX"
  
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
  
POL_System_TmpCreate "$PREFIX"

POL_Call POL_Install_MFC42

POL_SetupWindow_InstallMethod "CD"  
   
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "program\\ files/microsoft\\ games/zoo\\ tycoon\\ 2/x150_000.z2f"
POL_SetupWindow_wait "$(eval_gettext 'Transferring files from Disc 1')" "$TITLE"
cp -R "$CDROM"/* "$POL_System_TmpDir"
chmod -R 777 "$POL_System_TmpDir"

POL_SetupWindow_message "$(eval_gettext 'Please insert "$TITLE" disc 2')" "$TITLE"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "program\\ files/microsoft\\ games/zoo\\ tycoon\\ 2/x151_000.z2f"
POL_SetupWindow_wait "$(eval_gettext 'Transferring files from Disc 2')" "$TITLE"
cp -R "$CDROM"/* "$POL_System_TmpDir"
chmod -R 777 "$POL_System_TmpDir"
  
POL_SetupWindow_message "$(eval_gettext 'When the initial installation window appears, please select MORE OPTIONS, then uncheck the RUN "$TITLE" AFTER INSTALLATION option. If you don't, the install will fail!')" "$TITLE"
cd "$POL_System_TmpDir"
rm "00002.tmp"
touch "00002.tmp"
POL_Wine "setup.exe"

POL_System_TmpDelete

POL_Shortcut "ZT.exe" "$TITLE"
  
POL_SetupWindow_Close
exit
petch Monday 11 February 2013 at 8:46
petch

Hi horsemanoffaith,

[code language=playonlinux]
POL_RequiredVersion "4.0.18"
[/code]
Personally when I use POL_RequiredVersion I add a comment above telling why I put it in the script (what new command, or bugfix, etc. made me enforce a minimum version on the client used). I just added such comment to the Nox script by the way.

[code language=playonlinux]
POL_Call POL_Install_MFC42
[/code]
Beware of the case, I think MFC should be lowercase here. Does it work?

[code language=playonlinux]
POL_SetupWindow_InstallMethod "CD"  [/code]
You're leaving the user only one choice, and are not using his/her answer in $INSTALL_METHOD, so this statement can be removed. See http://www.playonmac.com/en/dev-documentation-7.html for details.

[code language=playonlinux]
POL_SetupWindow_wait "$(eval_gettext 'Transferring files from Disc 1')" "$TITLE"
cp -R "$CDROM"/* "$POL_System_TmpDir"
chmod -R 777 "$POL_System_TmpDir"
[/code]
You probably want POL_System_CopyDirectory here, like for Nox

Edited by petch

horsemanoffaith Tuesday 12 February 2013 at 9:35
horsemanoffaithAnonymous

Personally when I use POL_RequiredVersion I add a comment above telling why I put it in the script (what new command, or bugfix, etc. made me enforce a minimum version on the client used). I just added such comment to the Nox script by the way.

Quote


Okay, thanks for letting me know. The reason why I did this was because I going to use the POL_System_CopyDirectory command. I'll fill in why I didn't when I get to that.


Beware of the case, I think MFC should be lowercase here. Does it work?

Quote

Yep. Works just fine.

You're leaving the user only one choice, and are not using his/her answer in $INSTALL_METHOD, so this statement can be removed. See http://www.playonmac.com/en/dev-documentation-7.html for details.

Quote

Okay, I'll remove it!

You probably want POL_System_CopyDirectory here, like for Nox

Quote

I tried POL_System_CopyDirectory, and every time I did, the installer crashed. I think I might know now why the crashing was happening (I didn't have the chmod command in the original script), but I am not 100% sure if that is the reason. I will re-write the script using POL_System_CopyDirectory and see if I can make it work. If it does, I will re-post the corrected script. If it doesn't, perhaps you could give me some insight into why the crashing is occuring.


petch Tuesday 12 February 2013 at 12:08
petch

Okay, thanks for letting me know. The reason why I did this was because I going to use the POL_System_CopyDirectory command. I'll fill in why I didn't when I get to that.

Quote from horsemanoffaith

Yup, I guessed that much about POL_System_CopyDirectory, but it took me some time, and can only get worse as time goes on ;)
It's not required to put that comment obviously, it's just a good practice in my opinion, for others to quickly understand why you added the constraint, and for everyone to question the constaint (say, if you no longer use POL_System_CopyDirectory, it could help spot that the 4.0.18 version constraint may have become unnecessary).

Yep. Works just fine.

Quote from horsemanoffaith

Just checked and it seems you're right. I guess the service used to fetch scripts is case insensitive, good to know.

I tried POL_System_CopyDirectory, and every time I did, the installer crashed. I think I might know now why the crashing was happening (I didn't have the chmod command in the original script)

Quote from horsemanoffaith

Looking at POL_System_CopyDirectory implementation, it does not copy file rights, so the chmod should be unnecessary to remove the read-only attribute inherited from the read-only source media. But contrary to the cp command, POL_System_CopyDirectory expects its arguments to be directories (existing directories even), so did you remove the star from "$CDROM"/* ?
horsemanoffaith Sunday 17 February 2013 at 1:39
horsemanoffaithAnonymous

Looking at POL_System_CopyDirectory implementation, it does not copy file rights, so the chmod should be unnecessary to remove the read-only attribute inherited from the read-only source media. But contrary to the cp command, POL_System_CopyDirectory expects its arguments to be directories (existing directories even), so did you remove the star from "$CDROM"/* ?

Quote

I tried several different things, but I could not get POL_System_CopyDirectory to work without crashing at the end of copying the first disc. My guess is it has something to do with the copy protection on the disc. I know that the file 00002.tmp will not copy when you try to do a copy of the disc to your hard drive. Unless you can point me in another direction to get POL_System_CopyDirectory working correctly, I will just use the cp command. I can get the game installed and running this way. Here's the finished script:

#!/bin/bash
# Date : (2013-02-16 16-38)
# Last revision : (2013-02-16 16-38)
# Wine version used : 1.4.1
# Distribution used to test : Ubuntu 12.04.1 LTS 64-bit
# Author : horsemanoffaith
# Depend :
  
[ "$PLAYONLINUX" = "" ] && exit
source "$PLAYONLINUX/lib/sources"
  
TITLE="Zoo Tycoon 2: Zookeeper Collection"
PREFIX="ZT2ZC"
WORKING_WINE_VERSION="1.4.1"

  
POL_SetupWindow_Init
POL_Debug_Init
  
POL_SetupWindow_presentation "$TITLE" "Microsoft Games" "http://www.microsoft.com" "horsemanoffaith" "$PREFIX"
  
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
  
POL_System_TmpCreate "$PREFIX"

POL_Call POL_Install_MFC42  
   
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "program\\ files/microsoft\\ games/zoo\\ tycoon\\ 2/x150_000.z2f"
POL_SetupWindow_wait "$(eval_gettext 'Transferring files from Disc 1')" "$TITLE"
cp -r "$CDROM"/* "$POL_System_TmpDir"
chmod -R 777 "$POL_System_TmpDir"


POL_SetupWindow_message "$(eval_gettext 'Please insert "$TITLE" disc 2')" "$TITLE"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "program\\ files/microsoft\\ games/zoo\\ tycoon\\ 2/x151_000.z2f"
POL_SetupWindow_wait "$(eval_gettext 'Transferring files from Disc 2')" "$TITLE"
cp -R "$CDROM"/* "$POL_System_TmpDir" 
chmod -R 777 "$POL_System_TmpDir"
  
POL_SetupWindow_message "$(eval_gettext 'Please select MORE OPTIONS, then uncheck the RUN "$TITLE" AFTER INSTALLATION option. If you do not, the install will fail!')" "$TITLE"
cd "$POL_System_TmpDir"
rm "00002.tmp"
touch "00002.tmp"
POL_Wine "setup.exe"

POL_System_TmpDelete

POL_Shortcut "ZT.exe" "$TITLE"
  
POL_SetupWindow_Close
exit

Edited by horsemanoffaith

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmcayonlinux.com