You are here

The forum

Silkroad Online

New version script

Author Replies
Ghostofkendo Sunday 18 May 2008 at 16:49
Ghostofkendo

Wine version: 0.9.61
Distribution: openSUSE i586
Distribution version: 10.3
Graphics card: NVIDIA GeForce 8600M GT (512 Mo)
Graphics card driver: 169.12
Comments:
- I just tested the game's beginning but everything worked.
- You have to enable and adapt the size of the Wine's virtual desktop if you want to change in-game resolution.
- I used the following new version of the script (original by Tinou) for the installation (installer download fixed and English translation):
#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check

#Game and script presentation
presentation "Silkroad Online" "Joymax" "http://www.silkroadonline.net/" "Tinou, modified by Ghostofkendo" "SilkroadOnline"

#Language variables for the script's translation
if [ "$POL_LANG" == "fr_FR.UTF-8" ]; then
LNG_DL_QUESTION="Cliquez sur "Oui" si vous possédez le fichier d'installation sur votre disque dur.
Sinon, pour le télécharger, choisissez "Non""
LNG_DL_HOWTO="Choisissez un miroir de téléchargement proche de chez vous parmi ceux proposés sur la page qui va être affichée"
LNG_DL_WAIT_END="Cliquez sur "Suivant" quand le téléchargement de l'installeur est fini puis indiquez où l'installeur a été stocké"
LNG_INSTALLER_QUESTION_1="Où se trouve l'archive contenant installeur ? (SilkroadOnline_GlobalOffi8.zip)"
LNG_INSTALLER_QUESTION_2="Où se trouve l'installeur ?"
LNG_EXTRACT_WAIT="Veuillez attendre la fin de l'extraction"
else
LNG_DL_QUESTION="Click on "Yes" if the installer is in your hard drive.
Else, click on "No" to download it"
LNG_DL_HOWTO="Choose a download mirror near from your location among those available on the page that will be displayed"
LNG_DL_WAIT_END="Click on "Next" when the installer's downloading is finished then indicate where the installer has been stored"
LNG_INSTALLER_QUESTION_1="Where is the archive containing the installer? (SilkroadOnline_GlobalOffi8.zip)"
LNG_INSTALLER_QUESTION_2="Where is the installer?"
LNG_EXTRACT_WAIT="Please wait for the extraction to finish"
fi

#Cleaning PlayOnLinux's temporary folder if needed then, depending on the user's choice, downloading the installer or asking for its storage directory
if [ -d "$HOME/.PlayOnLinux/tmp/SilkroadOnline/" ]
then
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R
fi
reponse=$(question "$LNG_DL_QUESTION" "" 1 7)
if [ "$reponse" != "0" ]
then
mkdir -p $HOME/.PlayOnLinux/tmp/SilkroadOnline
cd $HOME/.PlayOnLinux/tmp/SilkroadOnline
message "$LNG_DL_HOWTO" "" 2 7
browser http://www.gamershell.com/download_22442.shtml
message "$LNG_DL_WAIT_END"
ARCHIVE_PATH=$(select_file "$LNG_INSTALLER_QUESTION_1" "" 3 7 )
run_and_wait "$LNG_EXTRACT_WAIT" "unzip -o $ARCHIVE_PATH -d $REPERTOIRE/tmp/SilkroadOnline/" "" 4 7
INSTALLER_PATH=$REPERTOIRE/tmp/SilkroadOnline/SilkroadOnline_GlobalOffi8.exe
else
INSTALLER_PATH=$(select_file "$LNG_INSTALLER_QUESTION_2" "" 5 7 )
fi

#Prefix's creation
mkdir -p $HOME/.PlayOnLinux/wineprefix/SilkroadOnline/
select_prefix "$HOME/.PlayOnLinux/wineprefix/SilkroadOnline/"
polprefixcreate 6 7

#Setting Wine to the Windows 98 configuration and running the installation
Set_OS win98
wine $INSTALLER_PATH

#Simulate a reboot of Windows
simulate_reboot 7 7

#Removing the automatically created shortcuts and creating appropriate launchers
cd $DESKTOP && rm -f Silkroad.lnk Silkroad.desktop
creer_lanceur "SilkroadOnline" "Program Files/Silkroad/" "Silkroad.exe" "Silkroad Online" "Silkroad Online"

#Cleanning PlayOnLinux's temporary folder
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R

end_install

exit 0




Please test this new version.

Goodbye and good game.

P. S. And HERE is the icon for the launcher.

Edited by Salvatos

chain2k Monday 19 May 2008 at 8:50
chain2kAnonymous

Wine's version: 0.9.61
Distribution: ubutnu i386
Distribution's version: 8.04 (Hardy)
Graphic card: GeForce4 420 Go 32M/AGP/SSE2
Graphic card's driver: 169.12
Comments:

Hi,
i've checked script, it works)
but pare of things:
1. so as we can't register game-account in game, we have to do it from windows, because registration page need only IE to work properly. Think you have to add attetion message for this case

2. You didn't define what file type user have to choose if he answer 'yes' at
reponse=$(question "$LNG_DL_QUESTION" "" 1 7)
and for sure I picked .zip file and receive not working launcher on finish.
So I think you have to tell user what file type to choose (.exe or .zip) or, if you don't trust his choice, you can automatically check this. I've made some changes (added function for that case, function can call itself if user made a mistake).
That is my variant.

#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check

#Game and script presentation
presentation "Silkroad Online" "Joymax" "http://www.silkroadonline.net/" "Tinou, modified by Ghostofkendo" "SilkroadOnline"

#Language variables for the script's translation
if [ "$POL_LANG" == "fr_FR.UTF-8" ]; then
LNG_DL_QUESTION="Cliquez sur "Oui" si vous possédez le fichier d'installation sur votre disque dur.
Sinon, pour le télécharger, choisissez "Non""
LNG_DL_HOWTO="Choisissez un miroir de téléchargement proche de chez vous parmi ceux proposés sur la page qui va être affichée"
LNG_DL_WAIT_END="Cliquez sur "Suivant" quand le téléchargement de l'installeur est fini puis indiquez où l'installeur a été stocké"
LNG_INSTALLER_QUESTION_1="Où se trouve l'archive contenant installeur ? (SilkroadOnline_GlobalOffi8.zip)"
LNG_INSTALLER_QUESTION_2="Où se trouve l'installeur ?"
LNG_EXTRACT_WAIT="Veuillez attendre la fin de l'extraction"
else
LNG_DL_QUESTION="Click on "Yes" if the installer is in your hard drive.
Else, click on "No" to download it"
LNG_DL_HOWTO="Choose a download mirror near from your location among those available on the page that will be displayed"
LNG_DL_WAIT_END="Click on "Next" when the installer's downloading is finished then indicate where the installer has been stored"
LNG_INSTALLER_QUESTION_1="Where is the archive containing the installer? (SilkroadOnline_GlobalOffi8.zip)"
LNG_INSTALLER_QUESTION_2="Where is the installer?"
LNG_EXTRACT_WAIT="Please wait for the extraction to finish"
fi

#define function to check file and unpuck it if needed
check_installer()
{
INSTALLER_PATH=$(select_file "$LNG_INSTALLER_QUESTION_2" "" 5 7 )
#first checking for .exe file, if not - for .zip file, if not call function from the beginning,
#if .zip ok - extract file and change INSTALLER_PATH
#if .exe ok - cd installation directory
          if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.exe" ]
               then
                    if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.zip" ]
                         then
                              error "You have to choose the proper file" "" 0 0 1 "" ""
                              check_installer
                         else
                              mkdir -p $REPERTOIRE/tmp/SilkroadOnline
                              cd $(dirname "$INSTALLER_PATH")
                              run_and_wait "$LNG_EXTRACT_WAIT" "unzip -o $INSTALLER_PATH -d $REPERTOIRE/tmp/SilkroadOnline/" "" 4 7
                              INSTALLER_PATH="$REPERTOIRE/tmp/SilkroadOnline/SilkroadOnline_GlobalOffi8.exe"
                    fi
               else
                    cd $(dirname "$INSTALLER_PATH")
          fi
}

#Cleaning PlayOnLinux's temporary folder if needed then, depending on the user's choice, downloading the installer or asking for its storage directory
if [ -d "$HOME/.PlayOnLinux/tmp/SilkroadOnline/" ]
then
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R
fi
reponse=$(question "$LNG_DL_QUESTION" "" 1 7)
if [ "$reponse" != "0" ]
then
message "$LNG_DL_HOWTO" "" 2 7
browser http://www.gamershell.com/download_22442.shtml
message "$LNG_DL_WAIT_END"
fi
#call function to check file and unpuck it if needed
check_installer

#Prefix's creation
mkdir -p $HOME/.PlayOnLinux/wineprefix/SilkroadOnline/
select_prefix "$HOME/.PlayOnLinux/wineprefix/SilkroadOnline/"
polprefixcreate 6 7

#Setting Wine to the Windows 98 configuration and running the installation
Set_OS win98
wine $INSTALLER_PATH

#Simulate a reboot of Windows
simulate_reboot 7 7

#Removing the automatically created shortcuts and creating appropriate launchers
cd $DESKTOP && rm -f Silkroad.lnk Silkroad.desktop
creer_lanceur "SilkroadOnline" "Program Files/Silkroad/" "Silkroad.exe" "Silkroad Online" "Silkroad Online"

#Cleanning PlayOnLinux's temporary folder
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R

end_install

exit 0


I tested all cases - it works.
I didn't add Language file for error here.

tnx
bye

Edited by chain2k

Ghostofkendo Monday 19 May 2008 at 12:55
Ghostofkendo

Hi chain2k,

First of all, thank you very much for testing the script and proposing improvements like you did. I'm very pleased.

so as we can't register game-account in game, we have to do it from windows, because registration page need only IE to work properly. Think you have to add attetion message for this case

Quote from chain2k
Yes, you are right, we must warn users that account registering have to be done on the website (I thought about it yesterday but it was about 1:00 a.m and I needed to sleep ). But you are wrong when you say that we have to do it from windows. We can do it under Linux using either Firefox and the User Agent Switcher add-on or using IEs4Linux.

About your modifications, it is a good idea and I just have one thing to say: In check_installer, why do you go to the installer's directory if the user indicate a .exe file? I think it's quite useless, don't you?

So here is the new version I propose, based on your one chain2k:
#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check

#Game and script presentation
presentation "Silkroad Online" "Joymax" "http://www.silkroadonline.net/" "Tinou, modified by Ghostofkendo and chain2k" "SilkroadOnline"

#Language variables for the script's translation
if [ "$POL_LANG" == "fr_FR.UTF-8" ]; then
LNG_DL_QUESTION="Cliquez sur "Oui" si vous possédez le fichier d'installation sur votre disque dur.
Sinon, pour le télécharger, choisissez "Non""
LNG_DL_HOWTO="Choisissez un miroir de téléchargement proche de chez vous parmi ceux proposés sur la page qui va être affichée"
LNG_DL_WAIT_END="Cliquez sur "Suivant" quand le téléchargement de l'installeur est fini puis indiquez où l'installeur a été stocké"
LNG_INSTALLER_QUESTION="Où se trouve l'installeur ?"
LNG_INSTALLER_ERROR="Vous devez choisir le bon fichier"
LNG_EXTRACT_WAIT="Veuillez attendre la fin de l'extraction"
LNG_ACCOUNT_REGISTER="Pour créer un compte Silkroad, vous devez obligatoirement passer par le site (http://www.silkroadonline.net) qui accepte uniquement Internet Explorer.
Mais vous pouvez quand même acceder à ce site sous Linux :
- Soit utiliser l'extension firefox nommée User Agent Switcher (https://addons.mozilla.org/fr/firefox/addon/59)
Une fois installée, allez dans outils > User Agent Switcher et selectionnez Internet Explorer 7.
- Soit installer et utiliser IEs4Linux (disponible dans le menu Installer de PlayOnLinux)"
else
LNG_DL_QUESTION="Click on "Yes" if the installer is in your hard drive.
Else, click on "No" to download it"
LNG_DL_HOWTO="Choose a download mirror near from your location among those available on the page that will be displayed"
LNG_DL_WAIT_END="Click on "Next" when the installer's downloading is finished then indicate where the installer has been stored"
LNG_INSTALLER_QUESTION="Where is the installer?"
LNG_INSTALLER_ERROR="You have to choose the proper file"
LNG_EXTRACT_WAIT="Please wait for the extraction to finish"
LNG_ACCOUNT_REGISTER="To register a Silkroad account, you have to do it on the website (http://www.silkroadonline.net) which accepts only Internet Explorer.
Despite, you can access this website under Linux:
- Either use the firefox add-on named User Agent Switcher (https://addons.mozilla.org/en-US/firefox/addon/59)
Once installed, go to Tools > User Agent Switcher and select Internet Explorer 7
- Or install and use IEs4Linux (available in PlayOnLinux's Install menu)"
fi

#define a function which check a file and unpack it if needed
check_installer()
{
INSTALLER_PATH=$(select_file "$LNG_INSTALLER_QUESTION" "" 5 7 )
#first checking for .exe file, if not - for .zip file, if not call the function from the beginning,
#if .zip ok - extract file and change INSTALLER_PATH
#if .exe ok - cd installation directory
if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.exe" ]
then
if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.zip" ]
then
error "$LNG_INSTALLER_ERROR" "" 0 0 1 "" ""
check_installer
else
mkdir -p $REPERTOIRE/tmp/SilkroadOnline
cd $(dirname "$INSTALLER_PATH")
run_and_wait "$LNG_EXTRACT_WAIT" "unzip -o $INSTALLER_PATH -d $REPERTOIRE/tmp/SilkroadOnline/" "" 4 7
INSTALLER_PATH="$REPERTOIRE/tmp/SilkroadOnline/SilkroadOnline_GlobalOffi8.exe"
fi
fi
}

#Cleaning PlayOnLinux's temporary folder if needed then, depending on the user's choice, downloading the installer or asking for its storage directory
if [ -d "$HOME/.PlayOnLinux/tmp/SilkroadOnline/" ]
then
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R
fi
reponse=$(question "$LNG_DL_QUESTION" "" 1 7)
if [ "$reponse" != "0" ]
then
message "$LNG_DL_HOWTO" "" 2 7
browser http://www.gamershell.com/download_22442.shtml
message "$LNG_DL_WAIT_END"
fi
#call the function which check a file and unpack it if needed
check_installer

#Prefix's creation
mkdir -p $HOME/.PlayOnLinux/wineprefix/SilkroadOnline/
select_prefix "$HOME/.PlayOnLinux/wineprefix/SilkroadOnline/"
polprefixcreate 6 7

#Setting Wine to the Windows 98 configuration and running the installation
Set_OS win98
wine $INSTALLER_PATH

#Simulate a reboot of Windows
simulate_reboot 7 7

#Removing the automatically created shortcuts and creating appropriate launchers
cd $DESKTOP && rm -f Silkroad.lnk Silkroad.desktop
creer_lanceur "SilkroadOnline" "Program Files/Silkroad/" "Silkroad.exe" "Silkroad Online" "Silkroad Online"

#Cleanning PlayOnLinux's temporary folder
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R

#Warn the user about the account registering and explains how to do it
warning "$LNG_ACCOUNT_REGISTER"

end_install

exit 0


What's new:
- added the warning message about account registration you suggested
- added the language variable for the error in check_installer (and the French translation of it)
- renamed LNG_INSTALLER_QUESTION_2 into LNG_INSTALLER_QUESTION and removed LNG_INSTALLER_QUESTION_1 (became useless with check_installer)
- fixed some English mistakes in the comments (it's "unpack" and not "unpuck" )

Thank you again chain2k, now we are close to the perfect script

Edited by Ghostofkendo

chain2k Monday 19 May 2008 at 15:00
chain2kAnonymous

Hi,
You are right about registration, i've tried it with ies4linux but that was so slow and buggy that i've thought it just not work porperly
and thanks for user-agent, I didn't know about it, very nice tool) and work properly with register.

about
cd $(dirname "$INSTALLER_PATH")
in check_install - you are right, that's useless. it will properly work without it

check_installer()
{
INSTALLER_PATH=$(select_file "$LNG_INSTALLER_QUESTION" "" 5 7 )
#first checking for .exe file, if not - for .zip file, if not call the function from the beginning,
#if .zip ok - extract file and change INSTALLER_PATH
#if .exe ok - cd installation directory
     if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.exe" ]
          then
               if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.zip" ]
                    then
                         error "$LNG_INSTALLER_ERROR" "" 0 0 1 "" ""
                         check_installer
                    else
                         mkdir -p $REPERTOIRE/tmp/SilkroadOnline
                         cd $(dirname "$INSTALLER_PATH")
                         run_and_wait "$LNG_EXTRACT_WAIT" "unzip -o $INSTALLER_PATH -d $REPERTOIRE/tmp/SilkroadOnline/" "" 4 7
                         INSTALLER_PATH="$REPERTOIRE/tmp/SilkroadOnline/SilkroadOnline_GlobalOffi8.exe"
                    fi
          fi
}


and sorry for unpUck) that was just funny misprint

Edited by chain2k

Ghostofkendo Monday 19 May 2008 at 15:07
Ghostofkendo

about cd $(dirname "$INSTALLER_PATH")

in check_install - you are right, that's useless. it will properly work without it

Quote from "chain2k"


Okay, since you agree with me, I edited the last version of the script to remove this part (I didn't wanted to modify your beautiful function without your opinion )

No problem for the "unpuck"

Bye
Ghostofkendo Tuesday 20 May 2008 at 2:14
Ghostofkendo

Hi again,

I propose here a dirty and temporary version of the script for the new version of Silkroad Online's client (Legend III client). Indeed, script we made yesterday (chain2k and me) was for the Legend II client and frenrihr, a community member, just informs me that the new version is available (since today, 20th of May 2008). That's it for the explainations

.#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check

#Game and script presentation
presentation "Silkroad Online" "Joymax" "http://www.silkroadonline.net/" "Tinou, modified by Ghostofkendo and chain2k" "SilkroadOnline"

#Language variables for the script's translation
if [ "$POL_LANG" == "fr_FR.UTF-8" ]; then
LNG_DL_QUESTION="Cliquez sur "Oui" si vous possédez le fichier d'installation sur votre disque dur.
Sinon, pour le télécharger, choisissez "Non""
LNG_DL_HOWTO="Cliquez sur "Download Now" sur la page qui va être affichée"
LNG_DL_WAIT_END="Cliquez sur "Suivant" quand le téléchargement de l'installeur est fini puis indiquez où l'installeur a été stocké"
LNG_INSTALLER_QUESTION="Où se trouve l'installeur ?"
LNG_INSTALLER_ERROR="Vous devez choisir le bon fichier"
LNG_EXTRACT_WAIT="Veuillez attendre la fin de l'extraction"
LNG_ACCOUNT_REGISTER="Pour créer un compte Silkroad, vous devez obligatoirement passer par le site (http://www.silkroadonline.net) qui accepte uniquement Internet Explorer.
Mais vous pouvez quand même acceder à ce site sous Linux :
- Soit utiliser l'extension firefox nommée User Agent Switcher (https://addons.mozilla.org/fr/firefox/addon/59)
Une fois installée, allez dans outils > User Agent Switcher et selectionnez Internet Explorer 7.
- Soit installer et utiliser IEs4Linux (disponible dans le menu Installer de PlayOnLinux)"
else
LNG_DL_QUESTION="Click on "Yes" if the installer is in your hard drive.
Else, click on "No" to download it"
LNG_DL_HOWTO="Click on "Download Now" on the page that will be displayed"
LNG_DL_WAIT_END="Click on "Next" when the installer's downloading is finished then indicate where the installer has been stored"
LNG_INSTALLER_QUESTION="Where is the installer?"
LNG_INSTALLER_ERROR="You have to choose the proper file"
LNG_EXTRACT_WAIT="Please wait for the extraction to finish"
LNG_ACCOUNT_REGISTER="To register a Silkroad account, you have to do it on the website (http://www.silkroadonline.net) which accepts only Internet Explorer.
Despite, you can access this website under Linux:
- Either use the firefox add-on named User Agent Switcher (https://addons.mozilla.org/en-US/firefox/addon/59)
Once installed, go to Tools > User Agent Switcher and select Internet Explorer 7
- Or install and use IEs4Linux (available in PlayOnLinux's Install menu)"
fi

#define a function which check a file and unpack it if needed
check_installer()
{
INSTALLER_PATH=$(select_file "$LNG_INSTALLER_QUESTION" "" 5 7 )
#first checking for .exe file, if not - for .zip file, if not call the function from the beginning,
#if .zip ok - extract file and change INSTALLER_PATH
#if .exe ok - cd installation directory
if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi0.exe" ]
then
if [ "$INSTALLER_PATH" != "$(dirname "$INSTALLER_PATH")/SilkroadOnline_GlobalOffi8.zip" ]
then
error "$LNG_INSTALLER_ERROR" "" 0 0 1 "" ""
check_installer
else
mkdir -p $REPERTOIRE/tmp/SilkroadOnline
cd $(dirname "$INSTALLER_PATH")
run_and_wait "$LNG_EXTRACT_WAIT" "unzip -o $INSTALLER_PATH -d $REPERTOIRE/tmp/SilkroadOnline/" "" 4 7
INSTALLER_PATH="$REPERTOIRE/tmp/SilkroadOnline/SilkroadOnline_GlobalOffi8.exe"
fi
fi
}

#Cleaning PlayOnLinux's temporary folder if needed then, depending on the user's choice, downloading the installer or asking for its storage directory
if [ -d "$HOME/.PlayOnLinux/tmp/SilkroadOnline/" ]
then
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R
fi
reponse=$(question "$LNG_DL_QUESTION" "" 1 7)
if [ "$reponse" != "0" ]
then
message "$LNG_DL_HOWTO" "" 2 7
browser http://files.filefront.com/SilkroadOnline+GlobalOffi0exe/;10162567;/fileinfo.html
message "$LNG_DL_WAIT_END"
fi
#call the function which check a file and unpack it if needed
check_installer

#Prefix's creation
mkdir -p $HOME/.PlayOnLinux/wineprefix/SilkroadOnline/
select_prefix "$HOME/.PlayOnLinux/wineprefix/SilkroadOnline/"
polprefixcreate 6 7

#Setting Wine to the Windows 98 configuration and running the installation
Set_OS win98
wine $INSTALLER_PATH

#Simulate a reboot of Windows
simulate_reboot 7 7

#Removing the automatically created shortcuts and creating appropriate launchers
cd $DESKTOP && rm -f Silkroad.lnk Silkroad.desktop
creer_lanceur "SilkroadOnline" "Program Files/Silkroad/" "Silkroad.exe" "Silkroad Online" "Silkroad Online"

#Cleanning PlayOnLinux's temporary folder
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R

#Warn the user about the account registering and explains how to do it
warning "$LNG_ACCOUNT_REGISTER"

end_install

exit 0
So this temporary version shoud work with the new client if it didn't change too much. I just modified the page displayed to download the client, the file name to be checked by check_installer and some messages displayed.

Bye, see you soon for a better version of the script. (I can't do it now, I have to sleep )
chain2k Tuesday 20 May 2008 at 21:42
chain2kAnonymous

Hi again,
it seems that we r only who test it

So, no bad news about new version, all works like a charm. I think creators did'nt change someting general in code, looks like only net part of the client really changed. And no one can play with old client.
You know that here
http://files.filefront.com/SilkroadOnline+GlobalOffi0exe/;10162567;/fileinfo.html
is still the old client, only site that has updated client for now is fileplanet.com (updated 20.05.2008), and I've changed download link.
Another question is installer and my poor function When I checked the mirrors for new client, I noted that all installers have the same name at the beginning and different endings, because of version change. And I decided to dive in to the bash and string variables). For now I think that the best game is POL+bash

That is new version, you can check my idea in comments. (tested new client with it):

#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check

#Game and script presentation
presentation "Silkroad Online" "Joymax" "http://www.silkroadonline.net/" "Tinou, modified by Ghostofkendo and chain2k" "SilkroadOnline"

#Language variables for the script's translation
if [ "$POL_LANG" == "fr_FR.UTF-8" ]; then
LNG_DL_QUESTION="Cliquez sur "Oui" si vous possédez le fichier d'installation sur votre disque dur.
Sinon, pour le télécharger, choisissez "Non""
LNG_DL_HOWTO="Cliquez sur "Download Now" sur la page qui va être affichée"
LNG_DL_WAIT_END="Cliquez sur "Suivant" quand le téléchargement de l'installeur est fini puis indiquez où l'installeur a été stocké"
LNG_INSTALLER_QUESTION="Où se trouve l'installeur ?"
LNG_INSTALLER_ERROR="Vous devez choisir le bon fichier"
LNG_EXTRACT_WAIT="Veuillez attendre la fin de l'extraction"
LNG_ACCOUNT_REGISTER="Pour créer un compte Silkroad, vous devez obligatoirement passer par le site (http://www.silkroadonline.net) qui accepte uniquement Internet Explorer.
Mais vous pouvez quand même acceder à ce site sous Linux :
- Soit utiliser l'extension firefox nommée User Agent Switcher (https://addons.mozilla.org/fr/firefox/addon/59)
Une fois installée, allez dans outils > User Agent Switcher et selectionnez Internet Explorer 7.
- Soit installer et utiliser IEs4Linux (disponible dans le menu Installer de PlayOnLinux)"
else
LNG_DL_QUESTION="Click on "Yes" if the installer is in your hard drive.
Else, click on "No" to download it"
LNG_DL_HOWTO="Click on "Download This File Now" on the page that will be displayed"
LNG_DL_WAIT_END="Click on "Next" when the installer's downloading is finished then indicate where the installer has been stored"
LNG_INSTALLER_QUESTION="Where is the installer?"
LNG_INSTALLER_ERROR="You have to choose the proper file"
LNG_EXTRACT_WAIT="Please wait for the extraction to finish"
LNG_ACCOUNT_REGISTER="To register a Silkroad account, you have to do it on the website (http://www.silkroadonline.net) which accepts only Internet Explorer.
Despite, you can access this website under Linux:
- Either use the firefox add-on named User Agent Switcher (https://addons.mozilla.org/en-US/firefox/addon/59)
Once installed, go to Tools > User Agent Switcher and select Internet Explorer 7
- Or install and use IEs4Linux (available in PlayOnLinux's Install menu)"
fi

#define a function which check a file and unpack it if needed
check_installer()
{
INSTALLER_PATH=$(select_file "$LNG_INSTALLER_QUESTION" "" 3 7 )
#define variable for filename for easy script reading
FILE_NAME=$(basename "$INSTALLER_PATH")
#define variables that check picked filename for beginning string and for extension
GAME_NAME=$(expr "$FILE_NAME" : '\(SilkroadOnline\)')
EXE_NAME=$(expr "$FILE_NAME" : '.*\(.exe\)')
ZIP_NAME=$(expr "$FILE_NAME" : '.*\(.zip\)')
#first checking for .exe file, if not - for .zip file, if not - call the function from the beginning,
#if .zip ok - extract file and change INSTALLER_PATH
#if .exe ok - cd installation directory
if [ "$GAME_NAME$EXE_NAME" != "SilkroadOnline.exe" ]
     then
          if [ "$GAME_NAME$ZIP_NAME" != "SilkroadOnline.zip" ]
               then
                    error "$LNG_INSTALLER_ERROR" "" 0 0 1 "" ""
                    check_installer
               else
                    mkdir -p $REPERTOIRE/tmp/SilkroadOnline
                    cd $(dirname "$INSTALLER_PATH")
                    run_and_wait "$LNG_EXTRACT_WAIT" "unzip -o $INSTALLER_PATH -d $REPERTOIRE/tmp/SilkroadOnline/" "" 4 7
                    #so as we don't really know filename we will check temp directory for extracted .exe
                    INSTALLER_PATH="$REPERTOIRE/tmp/SilkroadOnline/$(ls | grep .exe)"
          fi
fi
}

#Cleaning PlayOnLinux's temporary folder if needed then, depending on the user's choice, downloading the installer or asking for its storage directory
if [ -d "$HOME/.PlayOnLinux/tmp/SilkroadOnline/" ]
then
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R
fi
reponse=$(question "$LNG_DL_QUESTION" "" 1 7)
if [ "$reponse" != "0" ]
then
message "$LNG_DL_HOWTO" "" 2 7
browser http://www.fileplanet.com/158696/150000/fileinfo/SilkRoad-Online-Client
message "$LNG_DL_WAIT_END"
fi
#call the function which check a file and unpack it if needed
check_installer

#Prefix's creation
mkdir -p $HOME/.PlayOnLinux/wineprefix/SilkroadOnline/
select_prefix "$HOME/.PlayOnLinux/wineprefix/SilkroadOnline/"
polprefixcreate 5 7

#Setting Wine to the Windows 98 configuration and running the installation
Set_OS win98
wine $INSTALLER_PATH

#Simulate a reboot of Windows
simulate_reboot 6 7

#Removing the automatically created shortcuts and creating appropriate launchers
cd $DESKTOP && rm -f Silkroad.lnk Silkroad.desktop
creer_lanceur "SilkroadOnline" "Program Files/Silkroad/" "Silkroad.exe" "Silkroad Online" "Silkroad Online"

#Cleanning PlayOnLinux's temporary folder
rm $HOME/.PlayOnLinux/tmp/SilkroadOnline/ -R

#Warn the user about the account registering and explains how to do it
warning "$LNG_ACCOUNT_REGISTER" "" 7 7 0

end_install

exit 0


There is very incovenient to read here but I think you now how to make it clear.

P.S.
Also I've changed some steps. And think that in last warning you can give to user a choice to launch browser with mozilla addon and finish or just finish script, and last 'end_install' will be unnecessary.

bye

Edited by chain2k

You are here: Index > > Silkroad Online

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 dmca-notice@playonlinux.com