Macro suggestions?

The place to post your WML questions and answers.

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.
Lord-High-Crabbe
Posts: 11
Joined: April 17th, 2026, 4:12 pm

Re: Macro suggestions?

Post by Lord-High-Crabbe »

Neither yet.

Thanks for the useful link
gnombat
Posts: 994
Joined: June 10th, 2010, 8:49 pm

Re: Macro suggestions?

Post by gnombat »

Whether you use a tool or not, I would recommend looking at a simple campaign like A Tale of Two Brothers to get an idea of how it works.

You will want to create a file which looks basically the same as bigmap.cfg but with your own journey locations.
User avatar
Spannerbag
Posts: 879
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Macro suggestions?

Post by Spannerbag »

Just to consufe you a bit more, if your campaign has branching paths (i.e. when a scenario ends more than one scenario can come next, the actual one launched depending on player actions) then if subsequent scenarios occur in different places they'll have different tracking maps.

In these cases additional logic is needed to conditionally select which tracking map elements to display if/when the two branches rejoin since the player can have arrived at their current tracking map location by at least 2 different routes.

The logic isn't difficult but is something to be aware of.

This is used in mainline The Rise of Wesnoth (TRoW) in scenario 5 where the player has successfully negotiated either;
  • Scenario 04a: The Swamp of Esten, or
  • Scenario 04b: The Midlands
Both these scenarios are followed by scenario 05: The Oldwood and correct track is selected by the macro {TROW_GI_TRACK {JOURNEY_05_NEW} }.
I'll leave working out the detail to you, :) , but both those macros are in utils/bigmap.cfg in the TRoW folder/directory tree.
Of course if your campaign has a single path (absolutely nothing wrong with that) then you don't need to know any of this. :D

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
BajMic
Posts: 161
Joined: January 24th, 2023, 1:22 am

Re: Macro suggestions?

Post by BajMic »

Macros are useful to keep the code shorter, particularly in the case of variables and conditionals.

Code: Select all

{VARIABLE gold 50}
is less tiresome than

Code: Select all

[set_variable]
		name=gold
		value=50
[/set_variable]
At some point you will naturally start to gravitate towards using and defining macros wherever you want.
Post Reply