Macro suggestions?
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: 12
- Joined: April 17th, 2026, 4:12 pm
Macro suggestions?
Hello,
Can anyone suggest some uses for macros? Have already got character, deaths and starting gold macros too. Was wondering if anyone knows some other macros that would be useful to know.
Thanks,
Can anyone suggest some uses for macros? Have already got character, deaths and starting gold macros too. Was wondering if anyone knows some other macros that would be useful to know.
Thanks,
- ChaosRider
- Posts: 1468
- Joined: April 15th, 2012, 1:15 pm
Re: Macro suggestions?
Did you try to ask Chat GPT
? Ofcourse here you will get answer too but why not to try both options. The third option is to ask on Wesnoth discord.
Creator of WOTG (+6500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
-
Lord-High-Crabbe
- Posts: 12
- Joined: April 17th, 2026, 4:12 pm
Re: Macro suggestions?
Thank you,
I will do, I asked here because it is best to get it from two sources as you said.
I will do, I asked here because it is best to get it from two sources as you said.
Re: Macro suggestions?
Macros are most useful for weapon specials and abilities.
- ChaosRider
- Posts: 1468
- Joined: April 15th, 2012, 1:15 pm
Re: Macro suggestions?
I propose you to:
1. Look on the wiki of the Wesnoth.
2. Check game core files to see macros like abilities, weapon specials and other things.
3. Ask question on the site: https://chatgpt.com/
Question to ask:
"Give me list of all macros used in default/mainline/game core of the Battle for Wesnoth v1.18."
1. Look on the wiki of the Wesnoth.
2. Check game core files to see macros like abilities, weapon specials and other things.
3. Ask question on the site: https://chatgpt.com/
Question to ask:
"Give me list of all macros used in default/mainline/game core of the Battle for Wesnoth v1.18."
Creator of WOTG (+6500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
Re: Macro suggestions?
Stop encouraging use of AI for situation that doesnt benefit from it. That is really bad question, and if you really want it just go to http://www.wesnoth.org/macro-reference.html
- Spannerbag
- Posts: 879
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Macro suggestions?
Apologies for the long post - I do tend to waffle on - but hope it helps. 
In both cases the answer is "when it makes sense to use them".
I don't think you're doing this but it doesn't make sense to design a macro then find a use for it, the process is the other way round: macros (and hammers) are tools that can be useful in some situations.
I assume you're familiar with the preprocessor that "unpacks" macros.
Broadly speaking macros are shorthand for chunks of code that are required in multiple locations (possibly with parameters).
This has multiple benefits such as reducing errors (macros are usually far easier to replicate than chunks of code) and only needing to maintain the code chunk in one place if it needs changing or to fix errors.
Another consideration is that macros do not reduce the total amount of WML (although it can look like that) since the macros are replaced by WML code before any WML is processed by the game engine.
One way to reduce code bloat is to reduce repetition of logic not by macros (code insertion if you like) but via events if possible.
IMHO using LLMs to do your intellectual heavy lifting only works if you already have sufficient knowledge/experience to critically evaluate the responses you receive.
Example: using a calculator is fine if you understand the underlying maths to judge if the responses are reasonable.
If you ask for the value of √10 and the calculator replies with 3.1622776601683793319988935444327, is that right?
Well, √9=3 and 10 > 9 so √10 should be a bit over 3 so the calculator's value is probably right.
Congratulations if you got this far and hope I've not left you more consufed!
Cheers!
-- Spannerbag
To me your question is a bit "back-to-front" in that it's like asking "Can anyone suggest some uses for hammers?".Lord-High-Crabbe wrote: May 4th, 2026, 11:42 am Hello,
Can anyone suggest some uses for macros? Have already got character, deaths and starting gold macros too. Was wondering if anyone knows some other macros that would be useful to know.
Thanks,
In both cases the answer is "when it makes sense to use them".
I don't think you're doing this but it doesn't make sense to design a macro then find a use for it, the process is the other way round: macros (and hammers) are tools that can be useful in some situations.
I assume you're familiar with the preprocessor that "unpacks" macros.
Broadly speaking macros are shorthand for chunks of code that are required in multiple locations (possibly with parameters).
This has multiple benefits such as reducing errors (macros are usually far easier to replicate than chunks of code) and only needing to maintain the code chunk in one place if it needs changing or to fix errors.
Another consideration is that macros do not reduce the total amount of WML (although it can look like that) since the macros are replaced by WML code before any WML is processed by the game engine.
One way to reduce code bloat is to reduce repetition of logic not by macros (code insertion if you like) but via events if possible.
IMHO using LLMs to do your intellectual heavy lifting only works if you already have sufficient knowledge/experience to critically evaluate the responses you receive.
Example: using a calculator is fine if you understand the underlying maths to judge if the responses are reasonable.
If you ask for the value of √10 and the calculator replies with 3.1622776601683793319988935444327, is that right?
Well, √9=3 and 10 > 9 so √10 should be a bit over 3 so the calculator's value is probably right.
Congratulations if you got this far and hope I've not left you more consufed!
Cheers!
-- Spannerbag
- beetlenaut
- Developer
- Posts: 2888
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Macro suggestions?
Here is how you use macros: If you find yourself copying and pasting code (even if you plan to make a couple changes), you should try to make it into a macro instead.
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
-
Lord-High-Crabbe
- Posts: 12
- Joined: April 17th, 2026, 4:12 pm
Re: Macro suggestions?
Thank you for the insightful answers. 
I just recently started to attempt to code a campaign, as I felt my WML skills where becoming at least passable to do so, but will probably be asking for help along the way.
I just recently started to attempt to code a campaign, as I felt my WML skills where becoming at least passable to do so, but will probably be asking for help along the way.
- Spannerbag
- Posts: 879
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Macro suggestions?
No problem, we all have to learn: ask away!
If you haven't already seen it, https://wiki.wesnoth.org/Create provides a useful overview and starting points for campaign building.
For me it's more reference than tutorial: I preferred looking at code and asking questions.
Just to give a wider context, whilst you can create quality content with WML & preprocessor, it's worth knowing of coding options which can be useful in some circumstances, namely Wesnoth Formula Language (WFL) and lua - but I really wouldn't burden yourself with them until you actually need them for some reason.
You can also create your own artwork (unit sprites, portraits, items, terrain etc.) as detailed in graphics.
This is a huge subject area and I have great respect for those able to craft the images used in BfW.
Me? Couldn't draw a decent stick man!
Hope I've not scared you off!
Cheers,
-- Spannerbag
-
Lord-High-Crabbe
- Posts: 12
- Joined: April 17th, 2026, 4:12 pm
Re: Macro suggestions?
Funny you should mention lua. Used it a bit for another game but I'm not that good.
If your open to answering questions:Do you have any knowledge on using bigmaps, and by that I mean the average campaign map. I looked at code for it but I can't seem to understand what is going on. I'm assuming it has core macros involved but I don't know how it works exactly, I don't know if it's simpler then it looks but for some reason I can't figure it out.
If your open to answering questions:Do you have any knowledge on using bigmaps, and by that I mean the average campaign map. I looked at code for it but I can't seem to understand what is going on. I'm assuming it has core macros involved but I don't know how it works exactly, I don't know if it's simpler then it looks but for some reason I can't figure it out.
- ChaosRider
- Posts: 1468
- Joined: April 15th, 2012, 1:15 pm
Re: Macro suggestions?
What is "bigmaps"? Can you describe it by size in numbers? In map editor you can make map to 200x200 with 9 sides in. What is big map for you?Lord-High-Crabbe wrote: May 6th, 2026, 2:42 pm Funny you should mention lua. Used it a bit for another game but I'm not that good.
If your open to answering questions:Do you have any knowledge on using bigmaps, and by that I mean the average campaign map. I looked at code for it but I can't seem to understand what is going on. I'm assuming it has core macros involved but I don't know how it works exactly, I don't know if it's simpler then it looks but for some reason I can't figure it out.![]()
Can you post here a code which you dont understand?
Besides of these 2 things, first you make a map (in map editor), later scenario which use this map and then you make a code lines which will do some actions during using this scenario and map. Thats how I see it. Ofcourse there are others here and they can have own ways of doing maps, scenarios and other lines of code used in game.
Creator of WOTG (+6500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
-
Lord-High-Crabbe
- Posts: 12
- Joined: April 17th, 2026, 4:12 pm
Re: Macro suggestions?
Sorry for explaining badly, what I mean is the map that displays in the background of the [story] tag if that makes sense. 
Re: Macro suggestions?
Are you using a tool for this, or are you creating it manually?Lord-High-Crabbe wrote: May 6th, 2026, 3:30 pm Sorry for explaining badly, what I mean is the map that displays in the background of the [story] tag if that makes sense.![]()
There are some tools listed here:
https://wiki.wesnoth.org/Authoring_tools
It is not strictly necessary to use a tool for this, but doing it without a tool will be very tedious for a long campaign. For a short campaign it might be feasible to do it manually.