Important v1.8 Syntax Changes (also applies to 1.7.8+)

The place to post your WML questions and answers.

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.
Post Reply
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Sapient »

When new features are added to WML, the Developers usually try to maintain backwards compatibility. However, sometimes it is simply too burdensome or undesirable to do so. This thread lists all the changes that you need to be aware of when porting 1.6 content to 1.8 (or the 1.7.8+ release candidates).

Note: the wmllint utility can help you make these types of changes automatically.

Code: Select all

 * Unit renames:
   * Drake Gladiator -> Drake Thrasher
   * Drake Slasher -> Drake Arbiter

Code: Select all

 * WML engine:
   * removed redundant unit.value (use unit.cost instead)

Note: wmllint does not support this conversion, so if you relied on unit.value to determine the recruit cost, you will need to manually fix it to unit.cost instead.
However, the biggest change that breaks compatability is Pango Markup. In the 1.8 branch these formatting codes: tilde (~), at symbol (@), pound symbol (#), asterisk (*), and backquote (`) and <R,G,B,> are being discarded in favor of Pango markup. (Formerly, they could be put as the first character on a line of text to add special formatting.)

Read more about it on the wiki.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Anonymissimus »

unit_var.status.stoned->unit_var.status.petrified
{WEAPON_SPECIAL_STONE}->{WEAPON_SPECIAL_PETRIFY}
{SPECIAL_NOTES_STONE}->{SPECIAL_NOTES_PETRIFY}
[event]name=stone->[event]name=petrified
[stones]->[petrifies]
stoned.ogg->petrified.ogg

preprocessor symbol (not to be confused with pango stuff...):
@->~

not strictly speaking a wml syntax change but should really be here:
campaigns->add-ons
for the folder name in the user directory (and thus for all according paths used in wml preprocessor calls)

EDIT
AFAIK, starting with about 1.7.12, units created with
[side][unit]
will need a
placement=leader
key to keep the old behavior, while units created at the position of other units (e.g. dying units) with the intention to replace the existing unit, may need a (works since 1.7.13)
placement=map_overwrite
key.
Last edited by Anonymissimus on February 1st, 2010, 3:19 pm, edited 1 time in total.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Ken_Oh »

This one is important:

As of 1.7.12 (AFAIK been kind of afk lately), you cannot create your own variables and containers to use in a unit's base container. For example, a variable $unit.foo will be destroyed when unstoring a unit, as will $unit.foo.bar. However, you can create 'expected' variables and containers, like an extra [attack] container in a unit.

Coders should instead store utility variables inside the [variables] container of the unit.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Gambit »

Can we get an example of the pango markup? I read the wiki and their site but I'm not sure how to combine it with [message].
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Ken_Oh »

It's pretty simple and intuitive once you get the syntax correct.

Code: Select all

message="<span foreground='red'>This text is red. <small>This text is smaller and red <small>and this text is even smaller yet still red</small></small>.

This text is still red yet with the regular size. Unlike the old colors and sizes, markup can last past one line</span>

This is outside of the span tags, so this text is normal. There some things that need the span tags to work, while other effects can be had with <b>convenience tags</b>."
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Gambit »

So it's like HTML except with no nesting. Neat. Looks like most the attributes are named like CSS.
Thank you for the explanation.
This is the coolest thing since FAI.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Sapient »

After 1.7.12, no longer may multiple units be spawned with the same "id=" attribute.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
Bob_The_Mighty
Posts: 870
Joined: July 13th, 2006, 1:15 pm

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Bob_The_Mighty »

Are the 1.9 WML changes documented anywhere? Could a new sticky be started here?
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by bigkahuna »

I'll start a thread in the forum if it helps any.

EDIT: Nevermind, I'll send a PM. I don't want to anger the Powers That Be.
Check out my campaign Sweet Revenge!
Join the new R2D forum!
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Important v1.8 Syntax Changes (also applies to 1.7.8+)

Post by Gambit »

Here it is. I mostly stole from bigkahuna's list.
Post Reply