Forums

[Script] Villagers and Heroes

Auteur Réponses
Arcadien Vendredi 28 Mars 2014 à 1:53
ArcadienAnonymous

VIllagers and Heroes is a family-friendly indie MMORPG.  It is free to play and has a small but very friendly and helpful community.

The install throws an error if you leave "Launch the game" checked at the end of the install.  I added a message regarding this to the script, and although the error looks bad (closes the game and brings up a help article on the web), the install completes and the game runs fine from the produced shortcut.


[code language=playonlinux]
#!/bin/bash
# Date : (2014-03-27)
# Last revision : (2014-03-27)
# Wine version used : 1.7.12
# Distribution used to test : xubuntu 13.10
# Author : Arcadien (arc@arcadien.net)

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLE="Villagers and Heroes"
PREFIX="villagersandheroes"

POL_SetupWindow_Init

POL_SetupWindow_presentation "$TITLE" "Mad Otter Games" "www.villagersandheroes.com" "Arcadien (arc@arcadien.net)" "$PREFIX"

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "1.7.12"

POL_System_TmpCreate "$PREFIX"
cd "$POL_System_TmpDir"
POL_Download "http://affiliate.neonga.com/download.php?campaign_id=517&filter_id=111213"
mv "$POL_System_TmpDir/download.php?campaign_id=517&filter_id=111213" "$POL_System_TmpDir/VHSetup.exe"

POL_SetupWindow_message "The installer for $TITLE will now appear.\nDo not allow the installer to launch the game.\nUncheck the box to launch the game at the end of the installation.\n\nIf the game is launched from the installer, an error will occur.\nThis error can be safely ignored and the installation will complete successfully anyway." "Uncheck the Launch Game checkbox!"
POL_Wine start /unix "VHSetup.exe"
POL_Wine_WaitExit "$TITLE"



POL_Shortcut "VHLauncher.exe" "$TITLE"

POL_SetupWindow_Close
POL_System_TmpDelete
exit
[/code]

Screenshots:






Icons and Install Resources

48x48


22x22


left


top


Test and enjoy! :)

Edité par Arcadien

petch Samedi 29 Mars 2014 à 20:44
petch

Hi arcadien,

[code language=playonlinux]
POL_SetupWindow_message "The installer for $TITLE will now appear.\nDo not allow the installer to launch the game.\nUncheck the box to launch the game at the end of the installation.\n\nIf the game is launched from the installer, an error will occur.\nThis error can be safely ignored and the installation will complete successfully anyway." "Uncheck the Launch Game checkbox!"
POL_Wine start /unix "VHSetup.exe"
POL_Wine_WaitExit "$TITLE"
[/code]
All user-oriented messages should support localization, see http://www.playonmac.com/en/dev-documentation-10.html
By the way not launching programs from their installers is a general rule for installing programs using PlayOnLinux, and this is displayed once to the user, during the first installation, so this is somewhat redundant.

start /unix is also often not necessary, and it has drawbacks, so if the program installs without it, remove it. You may have to replace POL_Wine_WaitExit with POL_Wine_WaitBefore placed before the POL_Wine call, as it'll probably make the installer call blocking (start /unix makes program start asynchronous).

That's it, everything else looks fine ;)
Regards,
Pierre.
Arcadien Mercredi 2 Avril 2014 à 18:02
ArcadienAnonymous

Hi Petch,

Thanks for the guidance.  Here's the revised script:

#!/bin/bash
# Date : (2014-03-27)
# Last revision : (2014-03-27)
# Wine version used : 1.7.12
# Distribution used to test : xubuntu 13.10
# Author : Arcadien (arc@arcadien.net)

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLE="Villagers and Heroes"
PREFIX="villagersandheroes"

POL_SetupWindow_Init

POL_SetupWindow_presentation "$TITLE" "Mad Otter Games" "www.villagersandheroes.com" "Arcadien (arc@arcadien.net)" "$PREFIX"

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "1.7.12"

POL_System_TmpCreate "$PREFIX"
cd "$POL_System_TmpDir"
POL_Download "http://affiliate.neonga.com/download.php?campaign_id=517&filter_id=111213"
mv "$POL_System_TmpDir/download.php?campaign_id=517&filter_id=111213" "$POL_System_TmpDir/VHSetup.exe"

POL_Wine_WaitBefore "$TITLE"
POL_Wine "VHSetup.exe"

POL_Shortcut "VHLauncher.exe" "$TITLE"

POL_SetupWindow_message "$(eval_gettext '$TITLE has been successfully installed.')" "$TITLE"

POL_SetupWindow_Close
POL_System_TmpDelete
exit

petch Mercredi 2 Avril 2014 à 22:12
petch

POL_SetupWindow_message "$(eval_gettext '$TITLE has been successfully installed.')" "$TITLE"

This is now considered bad style, because the message is displayed even if the installation failed; And then it will be followed by a failure warning and a suggestion to send an automated bug report... So better just not put any message.

Other than that the script looks like, with that line removed you can submit it for inclusion in the official repository if you want :)

Edité par petch

Arcadien Jeudi 3 Avril 2014 à 0:55
ArcadienAnonymous

I've removed the line and requested signature for the script.

When it asked if I wanted to validate the script, I said Yes and it returned a page with "access denied", but it still went to "waiting for signature" state.

If the "$TITLE has been successfully installed." line is bad style, the script-writing guidebook should not use it as an example.

Thank you, I'm excited about publishing my first POL script! :)
petch Jeudi 3 Avril 2014 à 3:02
petch


Agreed, this only became bad style after the addition of integrated debugger support (talking of which, I forgot about POL_Debug_Init, oh well I added it to the script right after POL_SetupWindow_Init, no parameter, it just has to be there), but the documentation didn't get updated since then...
Certainly some things could be resynced with the new features...

Anyway, your script is now validated!
Arcadien Jeudi 3 Avril 2014 à 5:35
ArcadienAnonymous

Thank you!