[interface] Allow [option] to specify the [message]'s image

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderators: Forum Moderators, Developers

Forum rules
Before posting a new idea, you must read the following:

[interface] Allow [option] to specify the [message]'s image

Postby WhiteWolf » March 30th, 2017, 2:45 pm

Hello,

I've had this idea for a while, and I can't find a way to do it in wml yet. If it can be done somehow in Lua, please tell me how :D
The point would be to allow an object tag within a message to change the main image displayed with [message]. I'm not thinking of the little image inside the option, which is set with MENU_IMG_TXT or with the new DescriptionWML, but the large main image, usually for portraits.

Example:


Since the image key is taken, it could have a syntax like message_image=...
The key would not be mandatory, if omitted, the image specified in [message] is shown.
Code: Select all

[message]
speaker = someone
image = default.png
message = _ "something"
[option]
message = "Option 1"
message_image = image_for_option_1.png
[command]
[/command]
[/option]

[option]
message = "Option 2"
message_image = image_for_option_2.png
[command]
[/command]
[/option]

[option]
message = "Option 3"
# Option 3 has no image, so default.png is shown when this is option highlighted
[command]
[/command]
[/option]




The main advantage would be embellishments, and it could prove useful for mainline campaigns, where characters already have several portraits for their moods and expressions. When a choice is offered, the portrait could be fine-tuned to the option, like angry choice - mad profile, reasonable choice - some moderate profile.

Any ways to do this in Lua, or is not too much work to implement it to WML?
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now published!
User avatar
WhiteWolf
Forum Regular
 
Posts: 336
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [interface] Allow [option] to specify the [message]'s im

Postby Heindal » March 30th, 2017, 8:57 pm

You can do this with a macro, so you can do it in "wml" without using lua.

Code: Select all
#define MACRONAME messagetext1 picture1 messagetext2 picture2 messagetext3 picture3

#place an if clause of something else here

                            [message]
                                image={picture1}
                                speaker=narrator
                                message= _ "{messagetext1}"
                            [/message]

#end the if clause


#place an if clause of something else here

                            [message]
                                image={picture2}
                                speaker=narrator
                                message= _ "{messagetext2}"
                            [/message]
#end the if clause

#place an if clause of something else here
                            [message]
                                image={picture3}
                                speaker=narrator
                                message= _ "{messagetext3}"
                            [/message]
#end the if clause

#enddef



Edit: you do it even more charming by just giving specific variables a value, without a macro


Code: Select all
#if clause when selected an option
                    [set_variable]
                        name=textvariable
                        value="The text for the option!"
                    [/set_variable]

                    [set_variable]
                        name=picturevariable
                        value=picturepath
                    [/set_variable]

#end if clause when selected an option

                            [message]
                                image=$picturepath
                                speaker=narrator
                                message= _ "$textvariable"
                            [/message]
Last edited by Heindal on March 30th, 2017, 9:01 pm, edited 1 time in total.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses
User avatar
Heindal
 
Posts: 807
Joined: August 11th, 2011, 9:25 pm
Location: Germany

Re: [interface] Allow [option] to specify the [message]'s im

Postby zookeeper » March 30th, 2017, 9:00 pm

Heindal wrote:You can do this with a macro, so you can do it in "wml" without using lua.

No, that's not what he wants. He wants the image to change depending on which option is currently selected, but not yet chosen.
User avatar
zookeeper
WML Wizard
 
Posts: 9617
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [interface] Allow [option] to specify the [message]'s im

Postby Heindal » March 30th, 2017, 9:02 pm

Ah ok got it. That's lua indeed.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses
User avatar
Heindal
 
Posts: 807
Joined: August 11th, 2011, 9:25 pm
Location: Germany

Re: [interface] Allow [option] to specify the [message]'s im

Postby gfgtdf » March 30th, 2017, 11:38 pm

yes it can be done with lua, not with [message] but with creating your own custom dialogs with callbacks with the wesnoth.show_dialog function.

I personally think that wesnoth.show_dialog is one of the most advanced lua features wesnoth has. It might have changed quite a bit since i started creating wesnoth addons but when i started writing my first addons (i think it was wesnoth 1.11.2), in particular 'scenario with robots', i found it quite hard to use, secially since it was rather undocumented and had a high chance to crash wensoth when invalid parameters were given.

Also in order to not get OOS you have to know how to use wensoth.sync_choice().
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 912
Joined: February 10th, 2013, 2:25 pm

Re: [interface] Allow [option] to specify the [message]'s im

Postby WhiteWolf » March 31st, 2017, 8:03 pm

Unfortunately, I do not know anything about Lua, only that it exists. But I'm willing to learn, so I might try to do this as my first lua code...
It'd still be nice to have it accessible in WML :)
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now published!
User avatar
WhiteWolf
Forum Regular
 
Posts: 336
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [interface] Allow [option] to specify the [message]'s im

Postby zookeeper » March 31st, 2017, 9:01 pm

gfgtdf wrote:yes it can be done with lua, not with [message] but with creating your own custom dialogs with callbacks with the wesnoth.show_dialog function.

Wouldn't that be ridiculously complicated (in relation to the functionality it accomplishes)?
User avatar
zookeeper
WML Wizard
 
Posts: 9617
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [interface] Allow [option] to specify the [message]'s im

Postby gfgtdf » March 31st, 2017, 9:22 pm

zookeeper wrote:
gfgtdf wrote:yes it can be done with lua, not with [message] but with creating your own custom dialogs with callbacks with the wesnoth.show_dialog function.

Wouldn't that be ridiculously complicated (in relation to the functionality it accomplishes)?


well for someone who has no expeirince with wesnoth lua dialogs, sure.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 912
Joined: February 10th, 2013, 2:25 pm

Re: [interface] Allow [option] to specify the [message]'s im

Postby Celtic_Minstrel » May 2nd, 2017, 11:02 pm

This sounds like an interesting idea, and would not be too difficult to implement into the engine...
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
User avatar
Celtic_Minstrel
Developer
 
Posts: 770
Joined: August 3rd, 2012, 11:26 pm

Re: [interface] Allow [option] to specify the [message]'s im

Postby WhiteWolf » May 8th, 2017, 10:15 pm

Well, I for one would like to see it become a feature some day :)
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now published!
User avatar
WhiteWolf
Forum Regular
 
Posts: 336
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary


Return to Ideas

Who is online

Users browsing this forum: No registered users and 2 guests