0.8.9+ New format for campaign difficulty descriptions

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

0.8.9+ New format for campaign difficulty descriptions

Post by silene »

The column separator is no longer the comma. See http://www.wesnoth.org/forum/viewtopic.php?t=3069 for additional information.
It has a consequence on campaign descriptions. It was quite common to have this kind of code before:

Code: Select all

       difficulty_descriptions="&human-spearman.png," + _"Spearman" + "," + _"(easiest)" +
               ";*&human-swordman.png," + _"Swordsman" +
               ";&human-royalguard.png," + _"Royal Guard" + "," + _"(hardest)"
It no longer works. Users won't be able to select the difficulty when a new version of Wesnoth is released. The correct way of doing it will now use macros to hide some special characters.

Code: Select all

       difficulty_descriptions={MENU_IMG_TXT2 human-spearman.png _"Spearman" _"(easiest)"} +
               ";*" + {MENU_IMG_TXT human-swordman.png _"Swordsman"} +
               ";" + {MENU_IMG_TXT2 human-royalguard.png (_"Royal Guard") _"(hardest)"}
Please think about it when Wesnoth 0.8.9 (or 0.9, or whatever) is released.
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Is this macro new as of 0.8.9?
Is _"text" the same as _[space]"text"?
Hope springs eternal.
Wesnoth acronym guide.
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

I'm confused by your example. Is MENU_IMG_TXT or MENU_IMG_TXT2 the name of the macro we should be using? You seem to be using them interchangably.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Post by silene »

scott wrote:Is this macro new as of 0.8.9?
Yes.
scott wrote:Is _"text" the same as _[space]"text"?
I can't answer for sure, I don't know how the WML is really parsed, there may be some oddities with spacing in macro parameters. _"text" is probably the same as (_[space]"text").
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Post by silene »

quartex wrote:I'm confused by your example. Is MENU_IMG_TXT or MENU_IMG_TXT2 the name of the macro we should be using? You seem to be using them interchangably.
Not at all. MENU_IMG_TXT takes one image filename and one string. MENU_IMG_TXT2 takes one image filename and two strings. And so on. They are macros to hide the complexity of the syntax of the menu items.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

has this been updated for all official campaigns or do designers of said campaigns do it themselves?
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

And, do campaign writers break their campaigns for the new version or all old versions?

This came up with 0.8.3, but I started making mine during/after 0.8.3. What did everybody else do?
Hope springs eternal.
Wesnoth acronym guide.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Post by silene »

turin wrote:has this been updated for all official campaigns or do designers of said campaigns do it themselves?
It has.
scott wrote:And, do campaign writers break their campaigns for the new version or all old versions?
I'm not sure to understand the question. I would say it's up to you whether you decide to support the old versions of Wesnoth or the next version of Wesnoth. The change does not prevent old games to be played, it only prevents new campaigns to start if they have multiple difficulty levels.
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

silene wrote: it only prevents new campaigns to start if they have multiple difficulty levels.
Doesn't that sound broken to you? Anyway, I'll probably split the difference and wait a while but not too long.
Hope springs eternal.
Wesnoth acronym guide.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Post by silene »

scott wrote:
silene wrote: it only prevents new campaigns to start if they have multiple difficulty levels.
Doesn't that sound broken to you? Anyway, I'll probably split the difference and wait a while but not too long.
Sorry, I still don't understand what you mean. Yes it is broken, it was the whole point of this post: to warn campaign designers that the comma is no longer a special character. So if you are using commas in campaign difficulty descriptions as special characters, the next release of Wesnoth won't be able to display the campaign difficulty selection box, hence preventing the user to start the campaign.
Invisible Philosopher
Posts: 873
Joined: July 4th, 2004, 9:14 pm
Location: My imagination
Contact:

Post by Invisible Philosopher »

If you want it to work in 0.8.8, you can put this before your campaign tag:

Code: Select all

#work in 0.8.8:
#ifdef MENU_IMG_TXT
#else
#define MENU_IMG_TXT IMG TXT
"&"+{IMG}+","+{TXT}#enddef
#endif
#ifdef MENU_IMG_TXT2
#else
#define MENU_IMG_TXT2 IMG TXT1 TXT2
"&"+{IMG}+","+{TXT1}+","+{TXT2}#enddef
#endif
However it won't work in versions before 0.8.8 because they didn't have string concatenation.
Play a Silver Mage in the Wesvoid campaign.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Post by silene »

Nice trick, thanks! This solution didn't occur to me (if it had been a normal programming language like C I would have thought about it, but I'm at loss with WML).
MadMax
Posts: 1792
Joined: June 6th, 2004, 3:29 pm
Location: Weldyn, Wesnoth

Post by MadMax »

Add this to game.cfg, and you can use ifdef to determine version.

Code: Select all

#define 0_8_8
#enddef
You will need to change the version with every release for it to work right.
"ILLEGITIMIS NON CARBORUNDUM"

Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Dwarvish Bard
Posts: 95
Joined: March 3rd, 2005, 7:40 am
Location: Austin, Texas
Contact:

Speaking of which... how do you make custom images visible?

Post by Dwarvish Bard »

silene wrote:

Code: Select all

       difficulty_descriptions={MENU_IMG_TXT2 human-spearman.png _"Spearman" _"(easiest)"} +
               ";*" + {MENU_IMG_TXT human-swordman.png _"Swordsman"} +
               ";" + {MENU_IMG_TXT2 human-royalguard.png (_"Royal Guard") _"(hardest)"}
If you want to use custom images here, what do you have to do to make them visible? It looks like various campaigns just stick them in their images/ directory, but when I do that they don't show up at run time.

BTW, I've tried deleting everything in my cache directory before starting, to no effect.
Invisible Philosopher
Posts: 873
Joined: July 4th, 2004, 9:14 pm
Location: My imagination
Contact:

Post by Invisible Philosopher »

[binary_path]

Use http://wesnoth.slack.it/?ReferenceWML and/or look at other campaigns that do it.

And don't post semi-irrelevant comments in sticky threads like this.
Play a Silver Mage in the Wesvoid campaign.
Post Reply