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
Re: Create menu in mod
Not work ! All that comes after [event] not work No event to enable the [event] I already wrote about this above. Its forever not work with InterfaceActionsWML. I will wait for the new version maby in new version will be more functional.
If i use Lua and other tags how can i include my cfg files in other cgf files ? of course that would work and executed scripts and tags
For example
If i use Lua and other tags how can i include my cfg files in other cgf files ? of course that would work and executed scripts and tags
For example
Code: Select all
[tag]
[include]
/home/wesnoth/my.cfg
[/include]
[/tag]
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Create menu in mod
What's the actual WML you're currently using?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
For 1.12 version
maybe someone needs a menu framework I think that because of the tag [command] not give use your [event] menu and event name=menu its not work. And [event]name=menu is not an occasion for triggering.
my menu.
I think in new version developers need create some this
or I hope Llua will work at 100% in new version
maybe someone needs a menu framework I think that because of the tag [command] not give use your [event] menu and event name=menu its not work. And [event]name=menu is not an occasion for triggering.
my menu.
Code: Select all
[event]
id=my_id
name=prestart
[command]
[message]
[option]
message="return the game"
[/option]
[option]
message="swords"
[command]
[message]
caption="swords menu"
[option]
message="back to game"
[/option]
[option]
message="elvish sword"
[command]
##some wml code or not##
[/command]
[/option]
[option]
message="goblin sword"
[command]
##some wml code or not##
[/command]
[/option]
[/message]
[/command]
[/option]
[/message]
[/command]
[/event]
Code: Select all
[option_1]
message="menu1"
[/option_1]
[option_2]
message="menu2"
[call]
[option_1]
[/option_1]
[/call]
[/option_2]
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Create menu in mod
Use {curly braces} to include files or folders in .cfg files. For example,
Code: Select all
[+units]
{campaigns/Secrets_of_the_Ancients/units}
[/units]
You can use [set_menu_item] and [clear_menu_item] in [command].LordAndrew wrote: ↑April 25th, 2018, 4:08 am I think that because of the tag [command] not give use your [event] menu
But you can fire an event in a menu [command] as ForestDragon explained.LordAndrew wrote: ↑April 25th, 2018, 4:08 am And [event]name=menu is not an occasion for triggering.
I'm sorry if I didn't understand your problem.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Create menu in mod
Yeah, I don't really understand the problem. Your code you've posted works as far as I can tell - the [message] appears and has its options.
Also, indenting helps(and the outer [command] is unnecessary):
Also, indenting helps(and the outer [command] is unnecessary):
Code: Select all
[event]
id=my_id
name=prestart
[command]
[message]
[option]
message="return the game"
[/option]
[option]
message="swords"
[command]
[message]
caption="swords menu"
[option]
message="back to game"
[/option]
[option]
message="elvish sword"
[command]
[/command]
[/option]
[option]
message="goblin sword"
[command]
[/command]
[/option]
[/message]
[/command]
[/option]
[/message]
[/command]
[/event]
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
I want button "back to previous menu" i have three levels of the menu nested inside each other and at each level need a button. All your suggested options do not work. The variant that suggested ForestDragon works only with a simple menu. 1-2 level nested .
It's easier to make a full GUI use lua in 1.14 Than trying to build a spaceship with a screwdriver
It's easier to make a full GUI use lua in 1.14 Than trying to build a spaceship with a screwdriver
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Create menu in mod
Then you need to use a [while] loop around each [message], with an [option] that sets a variable to break the current loop.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Create menu in mod
With eventbased solution you can use stack to save event names, which allows you jump back to previous event.
Similar example of that idea https://github.com/ProditorMagnus/Oroci ... #L190-L206 saves current state when going deeper, removing last state when going back.
Similar example of that idea https://github.com/ProditorMagnus/Oroci ... #L190-L206 saves current state when going deeper, removing last state when going back.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
Yes it works. Thanks! I did not immediately notice that this code can be applied to a separate piece of code. I try applied to all menuPentarctagon wrote: ↑April 25th, 2018, 12:48 pm Then you need to use a [while] loop around each [message], with an [option] that sets a variable to break the current loop.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Create menu in mod
1.13 and later ? I would really like to program under 1.14 I noticed a lot of interesting things there but do not have time to sit and waitRavana wrote: ↑April 25th, 2018, 2:12 pm With eventbased solution you can use stack to save event names, which allows you jump back to previous event.
Similar example of that idea https://github.com/ProditorMagnus/Oroci ... #L190-L206 saves current state when going deeper, removing last state when going back.
Re: Create menu in mod
Ridiculous. It's beyond simple to add an option for going back to the previous menu and fire the relevant event. If you're still stuck then just tell me your menu structure and I will post some skeleton code for menu navigation.LordAndrew wrote: ↑April 25th, 2018, 12:32 pm I want button "back to previous menu" i have three levels of the menu nested inside each other and at each level need a button. All your suggested options do not work.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."