Important v1.10 Syntax Changes (also applies to 1.9+)

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Gambit » March 16th, 2011, 3:53 pm

This thread will serve as a list of important WML changes as we move from 1.8 to 1.10. Thanks to bigkahuna for keeping track of them so far. He has a more comprehensive list (that includes new tags and behaviors) here.

This list is only for changes that break old code.
  • Divisions are now floating point
  • [recall] will no longer automatically call the event name=recall. You need to use fire_event=yes
  • [unstore_unit] also requires fire_event=yes in order to fire the name=advance event
  • The following macros have been deprecated: FLOATING_TEXT, CAPTURE_FILTERED_VILLAGES, SET_OBJECTIVES, VICTORY_CONDITION, DEFEAT_CONDITION, ON_EVENT, ON_PRESTART, ON_START, ON_SIDETURN, ON_TURN, ON_VICTORY, ON_DEFEAT, ALLOW_UNDO, ON_TILE_ONCE, SIDE_PLAYER, SIDE_COMPUTER, AMLA_TOUGH, ITM_BOOK1, ITM_TREE1, RECALL_OR_CREATE_UNIT, RECALL_OR_CREATE, ITM_GLOWING_BRAZIER, and REDRAW.
  • [removeitem] is now [remove_item]
  • [set_variable]'s random= key has been deprecated
  • The 'healable' unit status is now 'unhealable'
  • "colour" has been changed to "color" everywhere.
  • The NEUTRAL_SIDE macro has been removed
  • [teleport]'s ignore_passability= has become check_passability= and it defaults to yes.
  • [unpetrify] no longer requires a [filter] tag. It can contain a standard unit filter at the top level.
  • PICKUPPABLE_ITEM now has TAKE_IT_STRING and LEAVE_IT_STRING arguments between the TEXT and CANNOT_TAKE arguments.

User avatar
Elvish_Hunter
Developer
Posts: 1379
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Elvish_Hunter » March 17th, 2011, 8:17 am

On 1.9.4+svn there is another change that breaks old code:
changelog wrote:* Added TAKE_IT_STRING and LEAVE_IT_STRING arguments to PICKUPPABLE_ITEM
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author), Wesnoth Lua Pack
1.12: Children of Dragons
Still active until the end of the year

User avatar
Espreon
Developer
Posts: 630
Joined: June 9th, 2007, 4:08 am

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Espreon » March 27th, 2011, 8:51 pm

Elvish_Hunter wrote:On 1.9.4+svn there is another change that breaks old code:
Added to the list.

If anyone's curious why I made that change, it was to allow content makers to provide unique strings with context providers, which would allow the possibility of accurate translatability. Universal "Take it" and "Leave it" strings don't work for all languages, for some languages have different forms of their equivalents for it; the form used would depend on the object the word refers to. When I mean "context provider", I mean the stuff that goes before a caret in a string. Examples of strings with context providers include: "storm trident^Take it" and "storm trident^Leave it".

User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by SkyOne » April 1st, 2011, 11:28 am

So the number of the arguments in the macros has been changed (+2) on 1.9.5 (since 1.9.4).
I just notice it for the other UMC creators (and maintainers) in the case of having the campaign unworkable.

Code: Select all

#define OBJ_POTION_HOLY X Y ID
    {PICKUPPABLE_ITEM {ID} {X} {Y} side=1 items/holy-water.png
    _"Sprinkling this water on melee weapons grants them the <i>arcane</i> damage type until the end of the current scenario. Should $unit.name use it?"
    _"holy water^Take it"   <---NEW!!
    _"holy water^Leave it"  <---NEW!!
    _"I am not suited to the use of this item! Let another take it." (
        [object]
            name= _ "Holy Water"
            image=items/holy-water.png
            duration=level
            description= _ "This water will make melee weapons have the <i>arcane</i> damage type until the end of the current scenario."
            [effect]
                apply_to=attack
                range=melee
                set_type=arcane
            [/effect]
        [/object]
        [sound]
            name={SOUND_LIST:HOLY}
        [/sound]
    )}
#enddef
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server

Anonymissimus
Inactive Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Anonymissimus » May 17th, 2011, 5:44 pm

tag [heal_unit]:
amount= defaults now to "full" instead of "0"
Tag does now by default restore statuses too.
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
Alarantalara
Art Contributor
Posts: 782
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Alarantalara » June 19th, 2011, 2:06 am

As of 1.9.7, many of the macros listed in the first post, including AMLA_TOUGH and REDRAW, are removed, not just deprecated.

Anonymissimus
Inactive Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Anonymissimus » August 21st, 2011, 8:47 pm

Some tags do no longer support default side=1 but affect all sides by default:
"remove_shroud"*, "place_shroud"*, "gold"*, "modify_side"*, "modify_ai"*, "allow_recruit", "disallow_recruit", "set_recruit", "store_gold"
The * marked ones support a [filter_side] subtag which gets priority over inline side= if present.

[remove_item] does no longer support default x,y=$x1,$y1 but defaults to "all locations" instead. A wmllint patch is available: http://gna.org/bugs/?18522
(It can't be apllied since it would issue false positives.)

[illuminated_time] from http://wiki.wesnoth.org/TimeWML has been removed from the core schedules. The tag did nothing any more since version 1.1.3 already. But you need to remove the tag from any custom time wml you may have since it now causes a lua error otherwise.

[capture_village] does no longer automatically fire the [event]name=capture. You need to use [capture_village]fire_event=yes in case you relied on this.
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

SlowThinker
Posts: 876
Joined: November 28th, 2008, 6:18 pm

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by SlowThinker » January 2nd, 2012, 5:18 pm

Gambit wrote:The following macros have been deprecated: FLOATING_TEXT, CAPTURE_FILTERED_VILLAGES, SET_OBJECTIVES ...
Also the macro CONDITION (a simple shortcut for the [variable] tag) stopped to work.
(The macro worked with 1.8 because it was defined in \data\multiplayer\scenarios\ANL_utils\ .)

In the debug mode [store_side] puts both keys color= and colour= in the variable, then warns that 'colour' is deprecated... It is not a bug but intentional.
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums

SlowThinker
Posts: 876
Joined: November 28th, 2008, 6:18 pm

suggestions concerning the 1st post

Post by SlowThinker » January 6th, 2012, 4:37 am

suggestions concerning the 1st post
I think the 1st post here should be as much perfect as possible, so that secondary measures (like the "colour" spam in the debug mode) are not needed.
I PMed already to Gambit about my problems with 'divide', but then I read the 1st post more carefully and this is a summary of my suggestions:
  • the affected 1.8 strings should be bold, so that a WML user knows what to search for in his code. Examples:
    • divide in [set_variable] is floating point now
    • [set_variable]'s random= key has been deprecated
    • [teleport]'s ignore_passability= has become check_passability= and it defaults to yes.
  • the other code-breaking changes mentioned in this thread should be summarized too
  • Not all divisions became floating: $(5/2) stays integer
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums

Anonymissimus
Inactive Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Anonymissimus » January 6th, 2012, 5:22 pm

SlowThinker wrote:Not all divisions became floating: $(5/2) stays integer
That's not WML, it's formula language, and it calls different code within the engine, so it doesn't surprise me. The affected code is set_variable's divide=.

EDIT
and the newest compatibility-breaking change:
If you were adding the core ability ABILITY_TELEPORT by using an [object], you now have to use an [object]delayed_variable_substitution=yes key in this same [object] (since the new definition of ABILITY_TELEPORT is using variables while the old one didn't).
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

Kernigh
Posts: 107
Joined: February 13th, 2007, 10:21 pm
Location: United States
Contact:

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by Kernigh » January 22nd, 2012, 6:29 pm

SlowThinker wrote:Also the macro CONDITION (a simple shortcut for the [variable] tag) stopped to work.
(The macro worked with 1.8 because it was defined in \data\multiplayer\scenarios\ANL_utils\ .)
The CONDITION macro has been removed. Wesnoth 1.10 has a new macro, VARIABLE_CONDITIONAL. It acts the same.

[set_variable]'s format= has been removed. You need to use [set_variable]'s value=, which acts the same. Change every {VARIABLE_OP xx format yy} to {VARIABLE xx yy}.

SlowThinker
Posts: 876
Joined: November 28th, 2008, 6:18 pm

Re: Important v1.10 Syntax Changes (also applies to 1.9+)

Post by SlowThinker » March 19th, 2012, 1:36 am

the "micro-syntax" is different:
  • non-quoted values may discard spaces,
    and so next sentence is not true anymore.
    wiki wrote:a quoted value is a value surrounded by quotes. Note for single-line values this is completely unnecessary
  • '+' adds spaces
More here: http://forums.wesnoth.org/viewtopic.php?f=21&t=36361
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums

Post Reply