File includes being wierd
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.
- Pentarctagon
- Project Manager
- Posts: 5526
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
File includes being wierd
I have a modification defined as:
which includes two files with all my macros and two [set_menu_item]'s to be displayed.
Inside unsynced_menu.cfg I have a [set_menu_item] with a message containing a bunch of file includes each of which is an [option] to be displayed:
The problem I have is: Every file include above can find the macros included in the [modification] except for:
For only that file I need to include the macro files a second time at the top of addons.cfg, otherwise Wesnoth can't find the macros used in that file.
So my question is: Why?
Code: Select all
[modification]
id=MUSIC_MOD
name="Music Mod"
type=hybrid
require_modification=yes
addon_min_version=3.8.0
{~add-ons/Music/macros/music_noncontextual_macros.cfg}
{~add-ons/Music/macros/music_contextual_macros.cfg}
{~add-ons/Music/macros/unsynced_menu.cfg}
{~add-ons/Music/macros/synced_menu.cfg}
[/modification]
Inside unsynced_menu.cfg I have a [set_menu_item] with a message containing a bunch of file includes each of which is an [option] to be displayed:
Code: Select all
[event]
name=turn 1
# wesnoth is not muted
{VARIABLE MusicSession.muted "no"}
# music player menu
[set_menu_item]
id=0_unsynced_menu
description="Wesnoth Music Player"
image="fireball.png"
# don't synchronize the menu or the commands
synced=no
# uses hotkey 0
use_hotkey="yes"
[default_hotkey]
key="0"
[/default_hotkey]
[command]
# if stuff needs to be initialized
[if]
{EQ MusicSession.need_to_refresh 1}
[then]
{VARIABLE MusicSession.need_to_refresh 0}
{~add-ons/Music/macros/refresh.cfg}
[/then]
[/if]
{WHILE_EQ MusicTemp.play_music 1}
# include the sub-menus defined in other files
[message]
speaker=narrator
image="portraits/$MusicPersist.message_image"
message="What would you like to do?
$MusicSession.current_playlist_name"
{~add-ons/Music/macros/exit.cfg}
{~add-ons/Music/macros/mute.cfg}
{~add-ons/Music/macros/info.cfg}
{~add-ons/Music/macros/mainline.cfg}
{~add-ons/Music/macros/addons.cfg}
{~add-ons/Music/macros/create_playlist.cfg}
{~add-ons/Music/macros/play_playlist.cfg}
{~add-ons/Music/macros/type_song.cfg}
{~add-ons/Music/macros/type_song_history.cfg}
[option]
message={MENU_IMG_TXT "ball-green.png" "Modifications"}
[command]
{WHILE_EQ MusicTemp.repeating 1}
[message]
speaker=narrator
image="portraits/$MusicPersist.message_image"
message="What would you like to change?"
{OPTION_NOTHING MusicTemp.repeating}
{~add-ons/Music/macros/modify_playlists.cfg}
{~add-ons/Music/macros/modify_loading.cfg}
{~add-ons/Music/macros/data_management.cfg}
{~add-ons/Music/macros/ui.cfg}
[/message]
{END_WHILE}
[/command]
[/option]
[/message]
{END_WHILE}
[/command]
[/set_menu_item]
[/event]
Code: Select all
{~add-ons/Music/macros/addons.cfg}
So my question is: Why?
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: File includes being wierd
I don't have any ideas, really. Mind attaching the whole thing?
- Pentarctagon
- Project Manager
- Posts: 5526
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: File includes being wierd
Sure.
- Attachments
-
- Music.zip
- (59.51 KiB) Downloaded 98 times
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: File includes being wierd
Well, seems like _main.cfg does {~add-ons/Music/macros}, causing it to read the files in alphabetical order and to barf on addons.cfg which is the first one.