Request to update message command description

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

Request to update message command description

Post by sergey »

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
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Request to update message command description

Post by josteph »

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

Please consider signing up for a wiki account :)
User avatar
sergey
Posts: 475
Joined: January 9th, 2015, 9:25 pm

Re: Request to update message command description

Post by sergey »

Thanks josteph. I've updated the wiki with the UPD 2 item.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Request to update message command description

Post by josteph »

Thank you!
Post Reply