[interface] Allow [option] to specify the [message]'s image
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
[interface] Allow [option] to specify the [message]'s image
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
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.
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.
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?
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
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:
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?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: [interface] Allow [option] to specify the [message]'s im
You can do this with a macro, so you can do it in "wml" without using lua.
Edit: you do it even more charming by just giving specific variables a value, without a macro
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, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Re: [interface] Allow [option] to specify the [message]'s im
No, that's not what he wants. He wants the image to change depending on which option is currently selected, but not yet chosen.Heindal wrote:You can do this with a macro, so you can do it in "wml" without using lua.
Re: [interface] Allow [option] to specify the [message]'s im
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, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Re: [interface] Allow [option] to specify the [message]'s im
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().
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.
Re: [interface] Allow [option] to specify the [message]'s im
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
It'd still be nice to have it accessible in WML
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: [interface] Allow [option] to specify the [message]'s im
Wouldn't that be ridiculously complicated (in relation to the functionality it accomplishes)?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.
Re: [interface] Allow [option] to specify the [message]'s im
well for someone who has no expeirince with wesnoth lua dialogs, sure.zookeeper wrote:Wouldn't that be ridiculously complicated (in relation to the functionality it accomplishes)?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.
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.
- Celtic_Minstrel
- Developer
- Posts: 2209
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [interface] Allow [option] to specify the [message]'s im
This sounds like an interesting idea, and would not be too difficult to implement into the engine...
Re: [interface] Allow [option] to specify the [message]'s im
Well, I for one would like to see it become a feature some day
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny