Very basic problems with very basic events

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
Faer
Posts: 3
Joined: March 1st, 2006, 8:01 pm

Very basic problems with very basic events

Post by Faer »

Hello everybody

I've read a couple of topic, and i will probably seems quite basic, near all this complex and specific questions.

I try to test some very simple [event] and ... it doen't work at all !!! My test with start and prestart event are OK (so, my [message] too) but all the event based on turns are not OK at all.

exemples :
--------------------------------------------
[event]
name=new turn
turn_number=3
[message]
description=Character Name
message= _ "Event New Turn : working !!!"
[/message]
[/event]


[event]
name=side turn
side_number=2
[message]
description=Character Name
message= _ "Event Side Turn 2 : working !!!"
[/message]
[/event]

[event]
name=side turn
side_number=2
[message]
description=Character Name
message= _ "Event Side Turn 2 : working !!!"
[/message]
[/event]

[event]
name=turn 3
[message]
description=Character Name
message= _ "Event Turn X (here, 3) : working !!!"
[/message]
[/event]
--------------------------------------------

The rest of the map is necessarly correct, as the test is OK with the start [event].

Could somebody tell me where is my error ??

Thanks by advance.
Faer
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Re: Very basic problems with very basic events

Post by scott »

Faer wrote:[event]
name=turn 3
[message]
description=Character Name
message= _ "Event Turn X (here, 3) : working !!!"
[/message]
[/event]
This is the only correct event. The other events are not correct and won't work.

As for this particular event, I don't know why it's not working. Replace the description key with "speaker=narrator" and see if it works then. If there's a problem with the message speaker (like you misspelled his name), then the message won't be shown. Using "speaker=narrator" will avoid that problem.

The easiest way to figure out how to set up a new turn or side turn event is by looking at someone else's code. Otherwise we can show you here.
Hope springs eternal.
Wesnoth acronym guide.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

the wiki wrote:side turn this event triggers when any player ends their turn. When a player ends their turn, before any events of this type trigger, the value of the WML variable side_number is set to the number of the side of the player about to take their turn.
This means that in order to get something to happen when side 3 (for example) begins his turn, you must do it like this:

Code: Select all

[event]
    name=side turn
    first_time_only=no # This might be unnecessary.

    [if]
        [variable]
            name=side_number
            equals=3
        [/variable]
 
        [then]
            [message]
                speaker=narrator
                message= _ "Event side turn 3 working!"
            [/message]
        [then]
    [/if]
[/event]
It works the basically the same with name=new turn. Just test for the variable turn_number instead of side_number in the [if]. But you could just use name=turn 3 as the event type to achieve the same effect without needing to use those [if]'s (just like you did in your last one).
Faer
Posts: 3
Joined: March 1st, 2006, 8:01 pm

Re: Very basic problems with very basic events

Post by Faer »

scott wrote:As for this particular event, I don't know why it's not working. Replace the description key with "speaker=narrator" and see if it works then. If there's a problem with the message speaker (like you misspelled his name), then the message won't be shown.
I will try, but i don't think so. The used name is the same as the only event whitch work, and it's a copy/paste ... so, no misspelling. But i will try.
zookeeper wrote:

Code: Select all

[event]
    name=side turn
    first_time_only=no # This might be unnecessary.

    [if]
        [variable]
            name=side_number
            equals=3
        [/variable]
 
        [then]
            [message]
                speaker=narrator
                message= _ "Event side turn 3 working!"
            [/message]
        [then]
    [/if]
[/event]
I've tried this code : a soon as Wesnoth is charging, i've got an error message. Seems that my Wesnoth version dont' like it ... :(

I put my code here, in case of it would be usefull.
Attachments
2p_Affrontement.cfg
(2.46 KiB) Downloaded 367 times
Last edited by Faer on March 1st, 2006, 11:34 pm, edited 1 time in total.
Faer
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Post by Dacyn »

it's because the second [then] should be [/then]...
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Dacyn wrote:it's because the second [then] should be [/then]...
Oops. :D Quite true.
Faer
Posts: 3
Joined: March 1st, 2006, 8:01 pm

Post by Faer »

Ok, it works with this correction. I 'll try to use the same syntax for all other event. thanks a lot !!!

For "[event] name=turn 3", event with speaker=narrator, there still a bug at the end of the 2nd turn.
Faer
Post Reply