The forum

[Script] Baldurs Gate - Enhanced Edition

Author Replies
uliroth92 Saturday 5 March 2016 at 11:55
uliroth92Anonymous

Intro

Hi there guys, I tried to write a script for Baldurs Gate Enhanced Edition. This is the famous old RPG from 1998, and it there was an enhanced edition released in 2012, so I thought there is the need to write a script. I used GNU_Raziel's script for Baldurs Gate as a Basis, and changed some things here and there, so I am wondering if I should mention this in the script.

Another thing is, that it is currently using the pictures from Baldurs Gate ("Standard Edition"), should I change this? if so, how?

#!/bin/bash
# Date : (2016-03-05)
# Wine version used : 1.8
# Distribution used to test : Debian testing
# Author : uliroth92
# Licence : Retail
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="Baldur's Gate Enhanced Edition"
PREFIX="BaldursGate1EE"
EDITOR="BioWare"
GAME_URL="http://www.bioware.com/games/baldurs_gate/"
AUTHOR="uliroth92"
WORKING_WINE_VERSION="1.8"
GAME_VMS="128"
 
#starting script
POL_GetSetupImages "http://files.playonlinux.com/resources/setups/BG1/top.jpg" "http://files.playonlinux.com/resources/setups/BG1/left.jpg" "$TITLE"
POL_SetupWindow_Init

# Starting debugging API
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"

# Setting prefix path
POL_Wine_SelectPrefix "$PREFIX"

# Downloading wine if necessary and creating prefix
POL_System_SetArch "x86"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"

POL_SetupWindow_InstallMethod "DVD,LOCAL"

if [ "$INSTALL_METHOD" == "DVD" ]; then
        # Asking for CDROM and checking if it's correct one
        POL_SetupWindow_message "$(eval_gettext 'Please insert the game media into your disk drive')" "$TITLE"
        POL_SetupWindow_cdrom
        POL_SetupWindow_check_cdrom "icon.ico"
        POL_Wine start /unix "$CDROM/setup.exe"
        POL_Wine_WaitExit "$TITLE"
else
        # Asking then installing DDV of the game
        cd "$HOME" || exit
        POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run:')" "$TITLE"
        SETUP_EXE="$APP_ANSWER"
        POL_Wine start /unix "$SETUP_EXE"
        POL_Wine_WaitExit "$TITLE"
fi

#Memory Size of Graphic Card
POL_SetupWindow_VMS $GAME_VMS

# Cleaning temp
if [ -e "$WINEPREFIX/drive_c/windows/temp/" ]; then
        rm -rf "$WINEPREFIX/drive_c/windows/temp/"*
        chmod -R 777 "$POL_USER_ROOT/tmp/"
        rm -rf "$POL_USER_ROOT/tmp/"*
fi

POL_Shortcut "Baldur.exe" "$TITLE" "$TITLE.jpg" ""

POL_SetupWindow_Close
exit

Screenshots


 

Icons/Other Pictures

top.jpg


left.jpg

Baldur's Gate - Enhanced Edition-22x22.jpg

Baldur's Gate - Enhanced Edition-48x48.jpg

 

Edited by uliroth92

MTres19 Friday 20 May 2016 at 3:52
MTres19Anonymous

About attribution: yes, that's probably a good idea. I think just putting it in the comments at the top is fine.

About the pictures: I wouldn't worry about it.

There are a few things I would like to point out about the script:

1. You probably don't need to tell the user to insert their disk. POL_SetupWindow_cdrom allows for refreshing the list, so if they didn't before they can than.

2. If possible, you should avoid start /unix and POL_Wine_WaitExit. They can cause problems. If it works okay, use just plain POL_Wine and use POL_Wine_WaitBefore before it.

3.

cd "$HOME" || exit

Is it fair to punish people for not having $HOME set? :/ You could use $POL_USER_ROOT/.., or just not bother cding at all---I'm not sure if it makes any difference to POL_SetupWindow_browse.

4. I'm not sure why the script would do so, but it's not a good idea to clear the PlayOnLinux tmp directory. Since the script doesn't use it, I'm not sure why it would need to clear it.

5. You don't have to give an icon to POL_Shortcut. It can extract one from the EXE.

6. It's a good idea to use exit 0 instead of just exit. That makes sure the operating system doesn't throw any errors.

 

That should about cover it. The script seems otherwise perfectly fine.

Regards,

-

Edited by MTres19

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