Create menu in mod
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.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Create menu in mod
Hi ! I want to create menu box in game. How to make a return to the previous menu ?
Below I'll give you the code of what I want
How call dialog message "you are in menu" ?
Below I'll give you the code of what I want
Code: Select all
[message]
speaker=narrator
caption="tutle"
message="You are in menu"
[option]
message=" "Return to the game"
[/option]
[option]
message="choose1"
[/option]
[option]
message="choose2"
[/option]
[option]
message="choose3"
[command]
[message]
[option]
message="return previous menu"
[/option]
[option]
[command]
[message]
message="choose3.1"
[/command]
[/option]
[/message]
[/command]
[/option]
[/message]
[/command]
[/option]
Last edited by Ravana on April 3rd, 2018, 5:49 pm, edited 1 time in total.
Reason: Use [code] without [spoiler]
Reason: Use [code] without [spoiler]
Re: Create menu in mod
Loop or fire_event might be easiest to use.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
How it can help me ? I dont use unit or attack. its only text dialog NO id NO name
https://wiki.wesnoth.org/InternalAction ... e_event.5D
(Version 1.13.6 and later only)
I dont know how it loop. put menu in menu in menu in menu......
https://wiki.wesnoth.org/InternalAction ... e_event.5D
(Version 1.13.6 and later only)
I dont know how it loop. put menu in menu in menu in menu......
Re: Create menu in mod
For loop examples most of addons with shop should work, with fire_event I have done it as https://github.com/ProditorMagnus/Agele ... #L168-L175 https://github.com/ProditorMagnus/Agele ... nu.cfg#L76
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
How it work ? If use [event] i dont see my menu and how it can work if [fire_event] support name and id only for version 1.13.6 and later ? nonsense and untruth. Maby this ageless mod (menu) work only 1.11 version or brake ?
Re: Create menu in mod
"Optional" is devfeature not name. You can try that menu out, though with 1.13 it is quite difficult since it changed how deselecting unit works.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
In version 1.12 it is impossible to make a return to the previous menu as it is easier ? Not overwriting everything. How can I add ID or NAME to tag [option], [command], ? Tag [command] can call previous [option] ?
Then developers need to add in the new version ID and NAME (class,variable) for all tags. As in the php javascript and other
Then developers need to add in the new version ID and NAME (class,variable) for all tags. As in the php javascript and other
- ForestDragon
- Posts: 1770
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Create menu in mod
menu loops can be made like this (to get the desired results, you might want to put [while]/[do] loops into eachother):
Code: Select all
[set_variable]
name=shoppingdone
value=no
[/set_variable]
[while]
[variable]
name=shoppingdone
equals=no
[/variable]
[do]
[message]
speaker=narrator
message= _ "menu text"
[option]
message= _ "exit menu (or enter previous sub-menu)"
[command]
[set_variable]
name=shoppingdone
value=yes
[/set_variable]
[/command]
[/option]
[option]
message= {MENU_IMG_TXT "attacks/bow-short.png" _"menu option (looped)"}
[command]
#insert menu content
[/command]
[/option]
[/message]
[/do]
[/while]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: Create menu in mod
And this would be how to do it with fire_event :
Code: Select all
#define SHOPMENU NUM
[fire_event]
name=shopmenu {NUM}
[/fire_event]
#enddef
[event]
name=shopmenu 1
first_time_only=no
[message]
speaker=narrator
message= _ "Welcome to the Shop! This is a Menu!"
[option]
message= _ "exit menu"
[command]
[/command]
[/option]
[option]
message= {MENU_IMG_TXT "attacks/bow-short.png" _"menu option (and keep shopping)"}
[command]
# TO DO: do something here
{SHOPMENU 1}
# then keep shopping!
[/command]
[/option]
[/message]
[/event]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
ForestDragon
Yes its work ! But to make this functional for subcategories in categories i cant.
Sapient.
Its goodly but no events for triggering tag [event] for this reason it will never work. If i use this construction me need put [event] in [event] i think its slow down game.
Yes its work ! But to make this functional for subcategories in categories i cant.
Sapient.
Its goodly but no events for triggering tag [event] for this reason it will never work. If i use this construction me need put [event] in [event] i think its slow down game.
Re: Create menu in mod
Don't worry about efficiency concerns... this is menu display code, not heavy computation. It's quite simple to make another menu, "shopmenu 2", using a separate event, then to call that from the first menu. Why don't you try it? If you have trouble then I'd be glad to help.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
Ok. And how i can call this [event] name=menu ?
- ForestDragon
- Posts: 1770
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Create menu in mod
by putting a [fire_event] into [command]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
I can bind hotkeys ? if i use [event] in menu . For fast access separate (individual) menu
- ForestDragon
- Posts: 1770
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Create menu in mod
it can be done by putting something like this into the [set_menu_item]:LordAndrew wrote: ↑April 11th, 2018, 12:02 pm I can bind hotkeys ? if i use [event] in menu . For fast access separate (individual) menu
Code: Select all
[default_hotkey]
key=r
[/default_hotkey]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic