[endlevel] tags - I don't understand them

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.
lotsofphil
Posts: 128
Joined: March 27th, 2009, 4:45 pm

[endlevel] tags - I don't understand them

Post by lotsofphil »

I was playing NR Scenario 5, The Pursuit. In it you can't kill the lich unless you do it with one of your white mages. If you kill him with something else, the lich reappears somewhere and then the mages have a dialog explaining that only they can kill the lich. The problem, and this is what I don't understand, is that the reappearing and dialog happen even when the mages kill the lich (and you win the scenario).

Code: Select all

[event]
        name=die
        first_time_only=no
        [filter]
            id=Malifor
        [/filter]

        # And finally, overriding the white mages and calling scenario end
        # White Mage, Mage of Light.
        [if]
            [variable]
                name=second_unit.id
                equals=Father Morvin
            [/variable]
            [or]
                [variable]
                    name=second_unit.id
                    equals=Sister Thera
                [/variable]
            [/or]
            [then]
                ...

                [endlevel]
                    result=victory
                    bonus=yes
                [/endlevel]
            [/then]
        [/if]
...
##in here is where the reappearing and such happens
[/event]
So, does endlevel end the level right away? Why does code after [endlevel] still execute?

I was trying to fix this behavior and couldn't figure it out. I am wondering if endlevel does something I don't understand. This opinion is bolstered by a bug in the next scenario, also to do with [endlevel]: https://gna.org/bugs/index.php?14220
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: [endlevel] tags - I don't understand them

Post by SkyOne »

Well, it seems you had better post what version of Wesnoth you are playing for the developers, and your operation system also.
The location of the [endlevel] tag seems right to me.
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
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: [endlevel] tags - I don't understand them

Post by Iris »

Operating system, you mean? Although I don't believe it is as relevant as the game engine version in this case.

[endlevel] should normally trigger any name=victory events in order. There seem to be some bugs around this and/or event handling in 1.7.x. :-/
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: [endlevel] tags - I don't understand them

Post by melinath »

Are you trying to learn how to use endlevel tags or report a bug? The former would be appropriate for this forum. It seems like you mean the second, though, which would be better served in the northern rebirth thread in scenario and campaigns.

Small clarification: endlevel tags end the level immediately, but before it ends, all events with name=(result) get fired/triggered/run.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: [endlevel] tags - I don't understand them

Post by SkyOne »

shadowmaster wrote:Operating system, you mean?
Oops! and yes.
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
lotsofphil
Posts: 128
Joined: March 27th, 2009, 4:45 pm

Re: [endlevel] tags - I don't understand them

Post by lotsofphil »

Wesnoth 1.7.3. OS is Windows XP.

The only victory event in the scenario is:

Code: Select all

    [event]
        name=victory
        {CLEAR_VARIABLE back_door_opened}
        {CLEAR_VARIABLE main_door_opened}
        {CLEAR_VARIABLE spider_door_opened}
        {CLEAR_VARIABLE confronted_malifor}
        {CLEAR_VARIABLE treasury_alerted}
        {CLEAR_VARIABLE chamber_of_death}
    [/event]
Sorry my previous post was unclear. Let me try and clarify:
1) Scenario 6 is not working for me. That is the subject of the bug.
2) I am trying to fix the dialogs in Scenario 5. That is what this post is supposed to cover. References to #1 are because I think they might have the same root cause, the [endlevel] tags.

Thanks.

edit for melinath's post:
I filed a bug for the bug part (#2). I am trying to learn about the endlevel tags in this post. If the endlevel tags end the scenario immediately, why are the dialogs showing up?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [endlevel] tags - I don't understand them

Post by zookeeper »

They don't end the scenario immediately in 1.7.x. That's the cause. The scenario needs to be fixed accordingly.
lotsofphil
Posts: 128
Joined: March 27th, 2009, 4:45 pm

Re: [endlevel] tags - I don't understand them

Post by lotsofphil »

zookeeper wrote:They don't end the scenario immediately in 1.7.x. That's the cause. The scenario needs to be fixed accordingly.
Ahhh, excellent. Thank you very much. I'll try and fix it (again, I tried for quite a while last night unsuccessfully).

edit: Can someone point me to where the WML is parsed in the source?
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: [endlevel] tags - I don't understand them

Post by Exasperation »

The fix should be fairly simple.

Code: Select all

[event]
        name=die
        first_time_only=no
        [filter]
            id=Malifor
        [/filter]

        # And finally, overriding the white mages and calling scenario end
        # White Mage, Mage of Light.
        [if]
            [variable]
                name=second_unit.id
                equals=Father Morvin
            [/variable]
            [or]
                [variable]
                    name=second_unit.id
                    equals=Sister Thera
                [/variable]
            [/or]
            [then]
                ...

                [endlevel]
                    result=victory
                    bonus=yes
                [/endlevel]
            [/then]
            [else]
                ...
                ##in here is where the reappearing and such happens
            [/else]
        [/if]
[/event]
lotsofphil
Posts: 128
Joined: March 27th, 2009, 4:45 pm

Re: [endlevel] tags - I don't understand them

Post by lotsofphil »

Thanks Exasperation. I think I tried that and it didn't work. I may have made a mistake somewhere (although adding [else] and [/else] seems within my abilities...)
lotsofphil
Posts: 128
Joined: March 27th, 2009, 4:45 pm

Re: [endlevel] tags - I don't understand them

Post by lotsofphil »

Putting [else] tags around the non-scenario-over code didn't work. Hopefully when I upgrade to 1.7.4 it will work.
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: [endlevel] tags - I don't understand them

Post by Exasperation »

Putting [else] tags around it and moving it inside the [if] tags, right? If that really isn't working (although it should work), you could split the event up like so:

Code: Select all

[event]
        name=die
        [filter]
            id=Malifor
        [/filter]
        [filter_second]
            id=Father Morvin
            [or]
                id=Sister Thera
            [/or]
        [/filter_second]
        ...

        [endlevel]
            result=victory
            bonus=yes
        [/endlevel]
[/event]
[event]
        name=die
        first_time_only=no
        [filter]
            id=Malifor
        [/filter]
        [filter_second]
            [not]
                id=Father Morvin
            [/not]
            [not]
                id=Sister Thera
            [/not]
        [/filter_second]

    ...
    ##in here is where the reappearing and such happens
[/event]
lotsofphil
Posts: 128
Joined: March 27th, 2009, 4:45 pm

Re: [endlevel] tags - I don't understand them

Post by lotsofphil »

Well, I can't get this to work. Exasperation, neither of your methods work (even though both look like they should). I'll post something in the NR threads and hope someone else can figure it out (or that I have an epiphany).

For the record, changing the .cfg file in install_dir/data/campaigns/NR/scenarios is the right place, correct?

Thanks to everyone for trying to educate me/help out.
User avatar
solsword
Code Contributor
Posts: 291
Joined: January 12th, 2009, 10:21 pm
Location: Santa Cruz, CA
Contact:

Re: [endlevel] tags - I don't understand them

Post by solsword »

zookeeper wrote:They don't end the scenario immediately in 1.7.x. That's the cause. The scenario needs to be fixed accordingly.
Well... that's news to me (which isn't surprising since I haven't been working on WML since 1.5.x). Could someone point me at some documentation of how [endlevel] works nowadays? I didn't see anything in the changelog about it, and the Wiki doesn't mention any new behavior as far as I can tell (besides the extra flags for customization).

I'm having a problem with [endlevel] tags in a "cutscene" scenario where all of the sides have "controller=null" set. I've got an [event] with "name=start" that triggers several custom events that do things like show dialogue, move units around, and swap maps, producing the cutscene. Finally, I've got an [endlevel] tag with the following properties:

result=victory
carryover_report=yes
bonus=no
linger_mode=no

I've tried messing with them, but nothing seems to help (even removing all of the keys except "result=victory"). The behavior that I'm seeing is as follows:

After the final cutscene fades to black, my pre-endlevel [message] fires and says "Here!". When I click, the weirdness sets in. I've got another [message] tag right after the [endlevel], and it proceeds to say "Here!?!", something that I wouldn't expect to happen. Next, the map begins to cycle quickly through day and night. Back when the turns were set to -1, this resulted in Wesnoth locking up, requiring a kill command from the console. By setting turns to something like 15, however, the day and night cycle just continues that many turns (15 turns takes maybe a second?) and then I get a "Game Over" dialogue (which oddly enough allows me to "continue the campaign").

By setting linger_mode to 'yes', I can get the victory dialogue to appear, but only after the 15 empty turns have gone by.

In other scenarios in that campaign, [endlevel] behavior seems normal to me: no waiting out all of the turns in the map, etc. I strongly suspect that this is a bug, and I'd be happy to file a bug report, but I don't want to do that without at least looking at the new specification for the [endlevel] tag--maybe this behavior is exactly what to expect from my combination of WML tags.

One other thing that I tried was changing the name=start for the event that triggered the endlevel to various other things, like "side turn" (I also made some of the sides human/ai controlled to get "side turn" to fire), but none of those worked. Some combinations of controller settings were impossible because they caused immediate loss due to lack of a leader.

Note: I'm running Battle for Wesnoth v1.7.5+svn (38532)
I was unable to test on 1.6.4 because of some unrelated issues with the campaign.
Attachments
3-A_Sign_of_the_Times.cfg
The scenario file that produces the strange behavior.
(25.63 KiB) Downloaded 333 times
The Knights of the Silver Spire campaign.

http://www.cs.hmc.edu/~pmawhorter - my website.

Teamcolors for everyone! PM me for a teamcolored version of your sprite, or you can do it yourself. If you just happen to like magenta, no hard feelings?
User avatar
doofus-01
Art Director
Posts: 4122
Joined: January 6th, 2008, 9:27 pm
Location: USA

Re: [endlevel] tags - I don't understand them

Post by doofus-01 »

I'll look at this when I get home, but I'm posting now to say that I had a similar thing happen to me in a 1.3.x scenario, and I think it had something to do with unstoring the wrong leader or something like that (it was a while ago so my memory is hazy). If that's the case, you may need to post the previous scenario as well.

EDIT: I didn't have a chance to test if this is a problem, but I see you have all sides controller=null and I'm not sure you can do that.
Post Reply