Request to update message command description

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
sergey
Posts: 98
Joined: January 9th, 2015, 9:25 pm

Request to update message command description

Post by sergey » March 12th, 2019, 10:01 am

I was trying to use message option variable functionaliy and found out that variable key must be placed directly under the message tag. But on the wiki it is placed under the option tag. See https://wiki.wesnoth.org/InterfaceActio ... message.5D Please update the wiki.

Incorrect:

Code: Select all

    [message]
      speaker=narrator
      message=_"Select unit"
      [option]
        message=_"Orcish Warrior"
        variable=unit_index
      [/option]
      [option]
        message=_"Orcish Slayer"
        variable=unit_index   
      [/option]
    [/message]
Correct:

Code: Select all

    [message]
      speaker=narrator
      message=_"Select unit"
      variable=unit_index      
      [option]
        message=_"Orcish Warrior"        
      [/option]
      [option]
        message=_"Orcish Slayer"
      [/option]
    [/message]
UPD. wiki says "either the index or the value of the chosen option will be stored in the specified variable". I expected the option index to start from 0, but it starts from 1.

UPD 2. Pitfall - option index corresponds to only visible options. I.e. index of the first visible option is 1, even if there are several hidden options before it (because of [show_if)].

UPD 3. If option image is omitted, then option value key is ignored #3980

User avatar
josteph
Developer
Posts: 336
Joined: August 19th, 2017, 6:58 pm

Re: Request to update message command description

Post by josteph » March 13th, 2019, 6:26 pm

Thanks. Most of this has been done by gfgtdf and me. Only remaining is UPD 2.

Please consider signing up for a wiki account :)
Fund my work on wesnoth, including but not limited to my add-ons: Invisible Enemies | Random Recruits

sergey
Posts: 98
Joined: January 9th, 2015, 9:25 pm

Re: Request to update message command description

Post by sergey » March 14th, 2019, 1:36 pm

Thanks josteph. I've updated the wiki with the UPD 2 item.

User avatar
josteph
Developer
Posts: 336
Joined: August 19th, 2017, 6:58 pm

Re: Request to update message command description

Post by josteph » March 16th, 2019, 2:57 am

Thank you!
Fund my work on wesnoth, including but not limited to my add-ons: Invisible Enemies | Random Recruits

Post Reply