El Foro

Besoin de conseils pour un script

Autor Respuestas
Iroquois Thursday 13 November 2008 at 20:04
IroquoisAnonymous

Bonjour,
j'essaye de faire un script pour un jeu mais il me reste une erreur à la fin.
En lançant playonlinux dans le terminal et le script avec le plugin script creator, le terminal me renvoie:
POL_SetupWindow_make_shorcut : commande introuvable

Le jeu est gratuit et fait dans les 700 mégas donc faut prévoir un peu de temps pour le download, c'est un jeu amateur dans la série des chevaliers de baphomet, un point & click jouable en anglais et alllemand (version française prévu mais rien de défini).

Vu la taille, j'ai ajouté au script le fait de pouvoir charger et sauvegarder le zip du jeu si on veut le réinstaller ou graver sans avoir à le retélécharger.
Donc voilà le script (j'ai pas tout fini dans les phrases de dialogue mais l'erreur de fonctionnement avec les raccourcis est ce qui est le plus genant).

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

cfg_check

if [ "$POL_LANG" == "fr" ]; then
BROKEN_QUESTION="Possédez vous l'archive du logiciel (si la réponse est non, elle sera téléchargée) ?"
BROKEN_SEL="Sélectionnez le fichier bs25setup,zip"
BROKEN_LOC="Localisation du fichier"
BROKEN_UNZ="Décompression de l'archive"
BROKEN_DOW="Téléchargement en cours"
BROKEN_DOX="Téléchargement du jeu"
BROKEN_INS="Installation de Broken Sword 2.5"
BROKEN_SAV="Voulez vous sauvegarder l'archive du jeu (elle sera stockée dans home/user/) ?"
BROKEN_COP="Copie de l'archive de Broken Sword 2.5"
BROKEN_INF="Broken Sword 2.5 a été installé avec succès"
BROKEN_ING="Installation terminée"
else
BROKEN_QUESTION=
BROKEN_SEL="Select the file bs25setup.zip"
BROKEN_LOC="Localize the file"
BROKEN_UNZ=
BROKEN_DOW="Downloading"
BROKEN_DOX="Downloading the game"
BROKEN_INS=
BROKEN_SAV="Would you like to save the xxxxxxx of the game (it will be stock in home/user/) ?"
BROKEN_COP=
BROKEN_INF="Broken Sword 2.5 has been installed successfully"
BROKEN_ING="Installation finished"
fi

##Présentation

cd $REPERTOIRE/tmp
POL_SetupWindow_Init "" ""
POL_SetupWindow_presentation "Broken Sword 2.5" "Mindfactory" "http://brokensword25.com/" "MatDiv" "BrokenSword2.5"

##Création du préfixe wine pour broken sword et répertoires temporaires

TEMP="$HOME/.PlayOnLinux/tmp/BrokenSword2.5"
chmod 777 $TEMP -R
rm $TEMP -R
mkdir -p $TEMP
select_prefixe "$REPERTOIRE/wineprefix/BrokenSword2.5/"
POL_SetupWindow_prefixcreate

#Choix entre télécharger l'archive ou non puis dézipage

POL_SetupWindow_question "$BROKEN_QUESTION"
GOT="$APP_ANSWER"
cd $TEMP
if [ "$APP_ANSWER" == "TRUE" ] ; then
POL_SetupWindow_browse "$BROKEN_SEL" "$BROKEN_LOC" "$HOME/bs25setup.zip"
POL_SetupWindow_wait_next_signal "$BROKEN_UNZ" "Broken Sword 2.5"
unzip -o "$APP_ANSWER"
POL_SetupWindow_detect_exit
else

#Choix aléatoire d'un serveur pour éviter de taper toujours sur le même

APP_ANSWER=$RANDOM
let "APP_ANSWER %=12"

POL_SetupWindow_message "$APP_ANSWER" "$APP_ANSWER"
if [ "$APP_ANSWER" == "0" ] ; then
APP_ANSWER="http://bf.jjus.de/bs25-setup.zip"
elif [ "$APP_ANSWER" == "1" ] ; then
APP_ANSWER="http://ftp2.exp.de/ftp2/68f0e9246a1044f3b065d152ad276439/491a3898/Games/Baphomets_Fluch_25/bs25-setup.zip"
elif [ "$APP_ANSWER" == "2" ] ; then
APP_ANSWER="http://ftp3.exp.de/ftp3/58a8fe8cc47a1be1805632672058403d/491a390c/Games/Baphomets_Fluch_25/bs25-setup.zip"
elif [ "$APP_ANSWER" == "3" ] ; then
APP_ANSWER="http://ftp5.exp.de/ftp5/0b77d4d1253928a4068af6b95623e3bf/491a3983/Games/Baphomets_Fluch_25/bs25-setup.zip"
elif [ "$APP_ANSWER" == "4" ] ; then
APP_ANSWER="http://ftp6.exp.de/ftp6/e84276f30a3c06b993a4ea9406f1632e/491a39bf/Games/Baphomets_Fluch_25/bs25-setup.zip"
elif [ "$APP_ANSWER" == "5" ] ; then
APP_ANSWER="ftp://ftp.4players.de/pub/pc/baphomets_fluch_4/bs25_setup.zip"
elif [ "$APP_ANSWER" == "6" ] ; then
APP_ANSWER="http://www.filecase.org/~dajoe/bs25-setup.zip"
elif [ "$APP_ANSWER" == "7" ] ; then
APP_ANSWER="http://server.c-otto.de/baphometsfluch/bs25setup.zip"
elif [ "$APP_ANSWER" == "8" ] ; then
APP_ANSWER="http://bf25.digital-extremes.com/bs25setup.zip"
elif [ "$APP_ANSWER" == "9" ] ; then
APP_ANSWER="http://www.adventurespiele.net/Downloads/Demos/bs25setup.zip"
elif [ "$APP_ANSWER" == "10" ] ; then
APP_ANSWER="http://www.wl-paintball.be/BS25/bs25setup.zip"
elif [ "$APP_ANSWER" == "11" ] ; then
APP_ANSWER="http://www.gamefox-downloads.de/gamefox/spiele/bs25-setup.zip"
fi

POL_SetupWindow_download "$BROKEN_DOW" "$BROKEN_DOX" "$APP_ANSWER"
POL_SetupWindow_wait_next_signal "$BROKEN_UNZ" "Broken Sword 2.5"
unzip -o "bs25setup.zip"
POL_SetupWindow_detect_exit
fi

#Installation de Broken Sword
POL_SetupWindow_wait_next_signal "$BROKEN_INS" "Broken Sword 2.5"
wine "bs25-setup.exe"
POL_SetupWindow_detect_exit

#Vérification si l'archive a été download ou non
if [ "$GOT" == "FALSE" ] ; then

#Sauvegarde de l'archive ou non
POL_SetupWindow_question "$BROKEN_SAV"
if [ "$APP_ANSWER" == "TRUE" ] ; then

#Copie

POL_SetupWindow_wait_next_signal "$BROKEN_COP" "Broken Sword 2.5"
mv bs25setup.zip $HOME
POL_SetupWindow_detect_exit
fi
fi

#Création des lanceurs
POL_SetupWindow_make_shortcut "BrokenSword2.5" "Program Files/Broken Sword 2.5" "bsengine.exe" "" "BrokenSword 2.5"

chmod 777 $TEMP -R
rm $TEMP -R
cd $WINEPREFIX/drive_c/windows/temp/
rm -rf *

#Configuration de Wine
Set_OS "winxp"
Set_Managed "Off"

POL_SetupWindow_message "$BROKEN_INF" "$BROKEN_ING"
POL_SetupWindow_Close

exit

Editado por: Iroquois

Quentin PÂRIS Thursday 13 November 2008 at 21:11
Quentin PÂRISAnonymous

Essais avec POL_SetupWindow_make_shortcut

(Short = Court)

Editado por: Tinou

Iroquois Thursday 13 November 2008 at 21:43
IroquoisAnonymous

Ah d'accord, y a une coquille dans la doc chapitre 7 en fait, et vu que sous google en recherchant POL_SetupWindow_make_shorcut sitelayonlinux.com , je tombais sur d'autres scripts, j'avais pas cherché par là.
Merci, problème résolu du coup

J'ai modifié le scripts, tout à l'air de bien fonctionner, il est prêt à être testé; et n'hésitez pas si y a des remarques ou des choses à améliorer.
Aymeric P. Friday 14 November 2008 at 19:35
Aymeric P.

Salut, pour le téléchargement aléatoire termine plutôt par un else qu'un elif.
Sinon mieux utilise un case.

Et sinon je peux aussi te fournir une fonction qui génère un nombre aléatoire dans un intervalle défini ;)

Former member.
Quentin PÂRIS Friday 14 November 2008 at 21:03
Quentin PÂRISAnonymous

Moi j'aurais pas fait ça.

J'aurais mit la liste des adresse dans un fichier avec un

cat < EOF > urls.txt

et choisis une ligne au hasard