Silence's WML Questions

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.
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Help with WML

Post by Silence »

Anonymissimus wrote:
Silence wrote:I narrowed the problem code down to this section
Did you use this method for it ?
I tried it. I removed all the extra heroes, text, and events. The result is basically the bare bones of my scenario + this (below). The reason I felt the above code was causing the problem was because the error would appear whenever I tried to add it in.

Code: Select all

    [event]
        name=last breath
        [filter]
            id=Rus'Kuk
        [/filter]

        [message]
            speaker=Rus'Kuk
            message= _ "Hmph! Our raiders have done our part. Forces, retreat!"
        [/message]

        [kill]
            x,y=$x1,$y1
            animate=no
        [/kill]
	  [move_unit_fake]
            type=Horseman
            side=1
            x=7,7,6
            y=29,28,25
        [/move_unit_fake]
	  {NAMED_NOTRAIT_UNIT 1 (Horseman) 6 28 (Messenger) (_"Messenger") }

        [message]
            speaker=Messenger
            message= _ "Sir! Sir! I have a distress message for any nearby alied commanders with the Loyalists!"
        [/message]

        [endlevel]
          result=victory
        [/endlevel]
[/event]
The error's still there, with slightly different text.
ERROR DETAILS:
Missing closing tag for tag objective at ~add-ons/Rise_of_the_Blade/scenarios/01_Rise.cfg:30 included from ~add-ons/Rise_of_the_Blade/_main.cfg:45.value " at ~add-ons/Rise_of_the_Blade/_main.cfg::46
Here's the bare bones code w/the event, if it helps.
Code:
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Help with WML

Post by blueknight1758 »

The error message is saying that line 35 of ~add-ons/Rise_of_the_Blade/scenarios/01_Rise.cfg their isprobable an [objectives] tag that you haven't closed, [/objectives]
Disclaimer: I'm not great at WML I just have had similar errors and fixed it this way.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Help with WML

Post by Crendgrim »

Code: Select all

[event]
    name=prestart
    [objectives]
      side=1
      [objective]
        description= _ "Defeat Enemy Leader"
        condition=win
      [/objective]
      [objective]
        description= _ "Turns run out"
        condition=lose
      [/objective]
      [objective]
        description= _ "Shaden dies"
        condition=lose
    [/objectives]
  [/event]
In this case, it's the last [objective] tag you didn't close.


Crend
UMC Story Images — Story images for your campaign!
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Help with WML

Post by Silence »

blueknight1758 wrote:The error message is saying that line 35 of ~add-ons/Rise_of_the_Blade/scenarios/01_Rise.cfg their isprobable an [objectives] tag that you haven't closed, [/objectives]
Disclaimer: I'm not great at WML I just have had similar errors and fixed it this way.
In this case, it's the last [objective] tag you didn't close.


Crend
Thanks, I fixed that.

I started adding in working pieces of code piece by piece, and the error now shows up as
ERROR DETAILS:
Missing closing tag for tag side at ~add-ons/Rise_of_the_Blade/scenarios/01_Rise.cfg:65 included from ~add-ons/Rise_of_the_Blade/_main.cfg:45.value " at core/macros/utils.cfg:27 included from core/_main.cfg:6 included from _main.cfg:5 included from ~add-ons/Rise_of_the_Blade/scenarios/01_Rise::99included from ~add-ons/Rise_of_the_Blade/_main.cfg:45
Assuming I'm understanding that correctly, line 65 has an unclosed [side] tag.

Code: Select all

  [side]
    side=1
    controller=human
    team_name= _ "Your Forces"

    type=Human Commander
    id=Shaden
    name= _ "Shaden"
    canrecruit=yes
        [unit]
            x,y=22,11
            type=Elvish Ranger
            id=Hyriel
            gender=female
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
            name= _ "Hyriel"
            {IS_HERO}
        [/unit]
        [unit]
            x,y=23,11
            type=Elvish Vanquisher
            id=Kaen
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_QUICK}
            [/modifications]
            name= _ "Kaen"
            {IS_HERO}
        [/unit]
    recruit=Elvish Fighter,Elvish Archer,Elvish Scout,Horseman,Mage,Elvish Shaman

    {GOLD 100 50 0}
    {INCOME 10 5 0}
  [/side]
  [side]
    side=2
    controller=ai
    team_name= _ "Enemy Forces"

    type=Orcish Warrior
    id=Rus'Kuk
    name= _ "Rus'Kuk"
    canrecruit=yes

    recruit=Goblin Rouser,Orcish Archer

    {GOLD 75 95 100}
    {INCOME 3 5 10}
  [/side]
  [side]
        side=3
        no_leader=yes
        team_name=creature
        user_team_name=_"Monsters"
        [ai]
            aggression=1.0
            caution=-4.0
            grouping=yes
            village_value=0
        [/ai]
  [/side] 
What I'm confused about is how does an unclosed side tag exist when there are three pairs of [side][/side] tags for three sides?

EDIT : I got a similar error after adding the last piece of code I originally dropped for debugging, the Error says there is an unclosed unit tag at line 87. The units there are:

Code: Select all

        [unit]
            x,y=22,11
            type=Elvish Ranger
            id=Hyriel
            gender=female
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
            name= _ "Hyriel"
            {IS_HERO}
        [/unit]
        [unit]
            x,y=23,11
            type=Elvish Vanquisher
            id=Kaen
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_QUICK}
            [/modifications]
            name= _ "Kaen"
            {IS_HERO}
        [/unit]
The errors both involve mention of an unclosed tag when both given and nearby tags are already closed. What does this mean?
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Help with WML

Post by Crendgrim »

Error messages aren't always exactly correct. Look at the objectives error message above, it also stated a wrong unclosed tag (objectives instead of objective).
However, I cannot see such a mistake in what you posted here, so I think it will be somewhere else in your scenario.

By the way, team_name should not get translation marks. Instead, use user_team_name for the displayed value (as you did it with side 3).


Crend
UMC Story Images — Story images for your campaign!
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Help with WML

Post by Silence »

Crendgrim wrote:Error messages aren't always exactly correct. Look at the objectives error message above, it also stated a wrong unclosed tag (objectives instead of objective).
However, I cannot see such a mistake in what you posted here, so I think it will be somewhere else in your scenario.

By the way, team_name should not get translation marks. Instead, use user_team_name for the displayed value (as you did it with side 3).
Added that, thanks again.

I've looked over the scenario several times, and I honestly can't find what's wrong.
It's probably something obvious that I don't know, so here's the scenario code:
Spoiler:
I really appreciate the help so far.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Help with WML

Post by Crendgrim »

1. You have a doubled event opener:

Code: Select all

    [event]
        name=last breath
        [filter]
            id="Rus'Kuk"
        [/filter]

    [event]
        name=last breath
        [filter]
            id="Rus'Kuk"
        [/filter]
2. You didn't close the last messsage=_"..." attribute:

Code: Select all

        [message]
            speaker=Kaen
            message= _ "Why so much focus on this town? No, Hyriel, there are better areas that could be used as bases by the Orcs. Nevertheless, we must make haste before the town is lost.
        [/message]
I can only suggest to use a WML editor with syntax highlighting; the latter you would have seen very fast then. ;)


Crend
UMC Story Images — Story images for your campaign!
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Help with WML

Post by Ceres »

Silence wrote:

Code: Select all

  [+event]
        [music]
            name={MUSIC}
            append=yes
        [/music]
    [/event]
What's that doing there? It's the definition of EXTRA_SCENARIO_MUSIC, but without #define. You don't need to define it anyway, it's a core macro.
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Help with WML

Post by Silence »

Ceres wrote: What's that doing there? It's the definition of EXTRA_SCENARIO_MUSIC, but without #define. You don't need to define it anyway, it's a core macro.
Oops, I removed that.
Crend wrote: 1. You have a doubled event opener:
2. You didn't close the last messsage=_"..." attribute:
I can only suggest to use a WML editor with syntax highlighting; the latter you would have seen very fast then. :wink:
Yeah, I just downloaded a syntax highlighter for Notepad++, it's a lot easier to see everything now with the highlights.

The scenario works again, thanks for the help everyone! :D
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Silence's WML Problems/Questions

Post by Silence »

As I seem to be encountering more weird errors that I can't identify as I develop my campaign further, I've decided to turn this in my WML Problem/Question thread.

Error:
Image

Scenario:
---large block of code removed-----

What might also have been cause to the problem is that I tried copying a faction from a UME over to my scenario folder and adding an event using that UME's units in this scenario, but I got a giant error mess and removed that data temporarily until the scenario could work again. As usual, the error message is no help either since it's pointing a code that seems to have no errors. (Side tags starting at 102 should be completed and the starting villages macro at 120 should also be okay.)
Last edited by Silence on October 14th, 2011, 9:55 pm, edited 1 time in total.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Silence's WML Problems/Questions

Post by Ceres »

Your STARTING_VILLAGES_AREA macro gives villages to side 25. No idea if that's related to the error though.
User avatar
Pentarctagon
Project Manager
Posts: 5730
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Silence's WML Problems/Questions

Post by Pentarctagon »

If you can't figure out what the error is, you should follow this guide first. Even if you still can't find the problem, it makes it so anyone else doesn't have to read through the entire scenario.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Silence's WML Problems/Questions

Post by Silence »

Ceres wrote:Your STARTING_VILLAGES_AREA macro gives villages to side 25. No idea if that's related to the error though.
Fixed, thanks.
Pentarctagon wrote:If you can't figure out what the error is, you should follow this guide first. Even if you still can't find the problem, it makes it so anyone else doesn't have to read through the entire scenario.
I tried it. This seems to be the code that is causing the problem:

Code: Select all

    [event]
    name=turn 1
        [message]
            id=Shaden
            message= _ "We've made it!"
        [/message]
        [message]
            id=Hyriel
            message= _ "And just in time, too."
        [/message]
		{NAMED_NOTRAIT_UNIT 3 Orcish Slayer 25 11 (Yora) (_"Yora")}
		{GENERIC_UNIT 3 Orcish Grunt 24 10}
		{GENERIC_UNIT 3 Orcish Grunt 26 10}
        [message]
            id=Yora
            message= _ "They're discovered our plan to attack the city from behind! Quick, stop the reinforcements!"
        [/message]
    [/event]
User avatar
Alarantalara
Art Contributor
Posts: 789
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Silence's WML Problems/Questions

Post by Alarantalara »

Most obvious thing I see there is that "Orcish Grunt" is two arguments to the macro. You'll need to enclose your unit types in parentheses or otherwise mark them as a single unit.
User avatar
Silence
Posts: 40
Joined: September 3rd, 2011, 1:13 am

Re: Silence's WML Problems/Questions

Post by Silence »

Alarantalara wrote:Most obvious thing I see there is that "Orcish Grunt" is two arguments to the macro. You'll need to enclose your unit types in parentheses or otherwise mark them as a single unit.
That appears to have been the problem as my campaign now works again.

My next question : How do you add an attack to an existing unit (say a ranged attack to a Horseman) when the unit is being placed?
Post Reply