El Foro

[script] StarCraft - Brood War (DDC)

Installer for the Digital Distribution Copy available from battle.net

Autor Respuestas
sn4re Friday 7 August 2009 at 21:05
sn4reAnonymous

NOTE! THIS SCRIPT IS CURRENTLY BROKEN! I WILL FIX IT WHEN I FIGURE OUT HOW! :D
Hi!

When you register your copy of StarCraft on Battle.net, then you can download the installer from there - so there's no need to mess around with CD's.

Since no installers on POL servers were using the DDC and required CD's I made this script for myself and since there's no point in letting it go to waste, I'm offering it to you.

Important!
This will NOT let you pirate the game, since it still asks you for your authentication key during installation. This can be found in Battle.net under your copy of StarCraft (and of course inside the CD case).

Icon: Will be extracted from the .exe and stored locally.
Short Description: Installer for the Digital Distribution Copy of Starcraft - Brood War available from Battle.net after registering your CD key there.
Script:
#!/bin/bash
# Date: (2009-08-07 20-36 GMT)
# Last revision: (2009-08-08 20-31 GMT)
# Distribution used to test: Ubuntu 9.04
# Wine version used: 1.0.1
# Licence: Free
# Author: sn4re
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}
 
GAME_NAME="StarCraft - Brood War (Digital Distribution Copy)"
GAME_PREFIX="Starcraft"
 
#the LNG_ is left over from the base script I used,
#which had french support
LNG_WAIT="Installing..."
LNG_FILE="Please select the $GAME_NAME installer"
 
POL_SetupWindow_Init
POL_SetupWindow_presentation "$GAME_NAME" "Blizzard Entertainment" "http://www.blizzard.com/" "sn4re" "$GAME_PREFIX"
 
select_prefix "$REPERTOIRE/wineprefix/$GAME_PREFIX"
POL_SetupWindow_prefixcreate
 
POL_SetupWindow_browse "$LNG_FILE" "$GAME_NAME" "$HOME"
FILE="$APP_ANSWER"

POL_SetupWindow_message_image "PLEASE NOTE:\\\\nThe shortcut in PlayOnLinux will only work\\\\nif you install the game to the default location\\\\n(C:\\\\$PROGRAMFILES\\\\StarCraft)" "$GAME_NAME" "/usr/share/playonlinux/themes/tango/warning.png"
 
POL_SetupWindow_wait_next_signal "$LNG_WAIT" "$GAME_NAME"
wine "$FILE"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$GAME_NAME installed!" "$GAME_NAME"

#get icon
convert "$HOME/.local/share/icons/6568_starcraft.0.xpm" -geometry 32X32 "$REPERTOIRE/icones/32/StarCraft.png"

POL_SetupWindow_make_shortcut "$GAME_PREFIX" "$PROGRAMFILES/StarCraft" "StarCraft.exe" "StarCraft.png" "StarCraft - Brood War"

POL_SetupWindow_Close
exit


Hope there's nothing wrong with it - I used it to install StarCraft myself (Ubuntu 9.04) and didn't see any problems. Keep in mind this is my first script for POL :D Hope it gets approved ;-)

EDIT: A HUGE shoutout to NSLW for help with this.

Editado por: sn4re

NSLW Friday 7 August 2009 at 21:19
NSLW

HI sn4re,

1) The beginning of every new script differs from that
#!/bin/bash
 
if [ "$PLAYONLINUX" = "" ]; then
exit 0
fi
source "$PLAYONLINUX/lib/sources"
cfg_check
For more info look here

2) Why do you cd to home?
cd $HOME

3) I would quote $FILE so it'll look like this
wine "$FILE"
Now it'll work if user has installation file in /home/user name/StartcraftSetup.exe

4) I would quote this too
$REPERTOIRE/wineprefix/$GAME_PREFIX/drive_c/Program\\ Files/StarCraft/StarCraft.exe

5) Use
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

to guess the name of Program Files in different languages.

6) Why do you use icoutils? Isn't there an icon for Starcraft in ~/.local/share/icons
sn4re Friday 7 August 2009 at 22:20
sn4reAnonymous

1) The beginning of every new script differs from that

#!/bin/bash
 
if [ "$PLAYONLINUX" = "" ]; then
exit 0
fi
source "$PLAYONLINUX/lib/sources"
cfg_check
For more info look here

Quote from NSLW
Fixed!

2) Why do you cd to home?

cd $HOME

Quote from NSLW
Must be leftover from earlier - didn't notice that there. Also fixed!

3) I would quote $FILE so it'll look like this

wine "$FILE"
Now it'll work if user has installation file in /home/user name/StartcraftSetup.exe

Quote from NSLW
Fixed!

4) I would quote this too
$REPERTOIRE/wineprefix/$GAME_PREFIX/drive_c/Program\\ Files/StarCraft/StarCraft.exe

Quote from NSLW
Removed it altogether!

5) Use

PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

to guess the name of Program Files in different languages.

Quote from NSLW
Fixed! (Is it obvious yet, that this is my first script? :D)

6) Why do you use icoutils? Isn't there an icon for Starcraft in ~/.local/share/icons

Quote from NSLW
Actually I didn't know that the icons are stored there :P
But how do I access them?
Do I copy it over to "$REPERTOIRE/icones" or use it where it is?
Maybe I did something wrong, but
POL_SetupWindow_make_shortcut "$GAME_PREFIX" "$PROGRAMFILES/StarCraft" "StarCraft.exe" "$HOME/.local/share/6568_starcraft.0.xpm" "StarCraft - Brood War"
didn't work!? Does it have the same name on all computers (I mean the 6568 part).

Thanks for all you help! Let's see if I can get this script fixed.

Offtopic: How do you write \\ n in the forums? When I write \\ n (without the space), it just puts a newline, also with \\\\ n.

Editado por: sn4re

NSLW Saturday 8 August 2009 at 18:51
NSLW

Actually I didn't know that the icons are stored there :P
But how do I access them?
Do I copy it over to "$REPERTOIRE/icones" or use it where it is?

Quote from sn4re


Copy it to $REPERTOIRE/icones/32/. If icon has other size than 32x32 then you can look into AOE III script how to convert its size.

Does it have the same name on all computers (I mean the 6568 part).

Quote from sn4re


I'm not 100% sure but I checked that on three different computers and the name was always the same.


Offtopic: How do you write \\ n in the forums? When I write \\ n (without the space), it just puts a newline, also with \\\\ n.

Quote from sn4re

I think it's not possible, if you want to know why then admin Tinou is the person you should ask.
sn4re Saturday 8 August 2009 at 21:27
sn4reAnonymous

Thanks for all your help - making the necessary changes now...
NSLW Sunday 9 August 2009 at 10:13
NSLW

Does the icon for Starcraft appear? If not then i would copy 6568_starcraft.0.xpm to $REPERTOIRE/icones/32/ under the name StarCraft - Brood War