Warning the user about missing dependencies
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Warning the user about missing dependencies
Is there some WML that will warn the user that they're missing a dependency, such as an Era or a music library? Ideally the warning would issue very clear instructions that the user needs to download the missing dependency. What happens instead, is users see an error, don't know what the problem is, and think the campaign is broken. If we're lucky, they show up in the campaign's feedback forum, we say "Do you have Era of Magic installed?" and they say, "Oh shoot! I'm dumb billy goat!" Problem solved. I hate to think how many don't show up in the forums.
To Lands Unknown, an Arabesque adventure of stunning background art, mobile summoning, and strong storytelling.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Warning the user about missing dependencies
For campaign dependant on an era isn't there some require_era key ? Then the BfW engine should know about the dependency and ideally display an informative error message if it isn't fulfilled. (IIRC there is such a warning - when downloading the addon.)
Other than that - you can use the #ifhave preprocessor directive to check for existance of addons. You could do #ifhave ~add-ons/Some_Era/_main.cfg in your first (dummy, not loading units from that era ?) scenario, and if the era isn't there - message "please get era xy since it's required" + [endlevel]result=defeat. But ideally this should be done by the BfW engine. (Isn't there a warning when starting the campaign too ?)
Btw, in TEG and TSoG the #ifhave directive is used to use the UMC music addon, but only if it is present (so it's not required!).
EDIT
The #ifhave directive is BfW 1.9 only.
Other than that - you can use the #ifhave preprocessor directive to check for existance of addons. You could do #ifhave ~add-ons/Some_Era/_main.cfg in your first (dummy, not loading units from that era ?) scenario, and if the era isn't there - message "please get era xy since it's required" + [endlevel]result=defeat. But ideally this should be done by the BfW engine. (Isn't there a warning when starting the campaign too ?)
Btw, in TEG and TSoG the #ifhave directive is used to use the UMC music addon, but only if it is present (so it's not required!).
EDIT
The #ifhave directive is BfW 1.9 only.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: Warning the user about missing dependencies
Also note that, for a multiplayer game, the #ifhave directive works only for the host, not for the other clients.Anonymissimus wrote:Btw, in TEG and TSoG the #ifhave directive is used to use the UMC music addon, but only if it is present (so it's not required!).
Re: Warning the user about missing dependencies
That’d be the .dependencies attribute that may be specified in the publishing info file, _server.pbl. Users can still choose to ignore the dependency resolution warning when downloading the dependant add-on though.Anonymissimus wrote:(IIRC there is such a warning - when downloading the addon.)
For that matter, I merged a patch from FAAB at the start of the 1.9.x development cycle that makes the confirmation dialog significantly more prominent and potentially more helpful.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Re: Warning the user about missing dependencies
I am thinking that the dependencies should be available to the campaign when it runs, not just when it is downloaded from the add-on server. For instance, one might install the campaign manually. I'm actually not sure what's in the _server.pbl for the "To Lands Unknown" campaign because we don't have it under source control at present. The lead developer has it, he only just got back from exams, and he hasn't gone up the Mercurial learning curve yet. I know that once I've downloaded the campaign, I don't have a _server.pbl file or any dependency information anywhere derived from it.
To Lands Unknown, an Arabesque adventure of stunning background art, mobile summoning, and strong storytelling.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Warning the user about missing dependencies
What does "works only for the host" mean ?silene wrote:Also note that, for a multiplayer game, the #ifhave directive works only for the host, not for the other clients.Anonymissimus wrote:Btw, in TEG and TSoG the #ifhave directive is used to use the UMC music addon, but only if it is present (so it's not required!).
Does it mean that the result of the #ifhave evaluation on the host is transferred to the other clients, idependently from whether these actually have or not have the particular file, so that the use case from above (using UMC music only if it's there) would result in stderr message about missing music file and silence on the other clients in the case that only the host has the queried file (whos BfW instance would play the music fine I guess) ?
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: Warning the user about missing dependencies
All you need to do is #define some empty macro in the era, then have an #ifdef statment at the beginning of the campaign that directs the player to some dummy scenario with a warning in the introduction if that macro is not defined. This is already done in some eras (Archaic and Myths, I think), last I checked it worked fine.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: Warning the user about missing dependencies
More precisely, only the host preprocesses the scenario; it is then sent to all the other clients through the server. So only the host is actually testing #ifhave. There is no difference between starting a game and loading one from a savegame: only the host reads the WML data of the scenario.Anonymissimus wrote:Does it mean that the result of the #ifhave evaluation on the host is transferred to the other clients, idependently from whether these actually have or not have the particular file, so that the use case from above (using UMC music only if it's there) would result in stderr message about missing music file and silence on the other clients in the case that only the host has the queried file (whos BfW instance would play the music fine I guess) ?
If the addon had a dummy or innocuous Lua file, you could try to load it instead and see whether it succeeds.
No. See above. It only works for the host.doofus-01 wrote:All you need to do is #define some empty macro in the era, then have an #ifdef statment at the beginning of the campaign that directs the player to some dummy scenario with a warning in the introduction if that macro is not defined.
Re: Warning the user about missing dependencies
Which is good enough for SP campaigns (which is what bvanevery is talking about, as far as I know).silene wrote: It only works for the host.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Warning the user about missing dependencies
Doofus' suggestion is a workaround for 1.8. In 1.9 #ifhave is better - simpler and needs no cooperation with the dependency author (or no need to be the same person...). Neither are usable in MP.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign