Macro question [theoretical]: gathering useful macros in a standalone file?
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.
Macro question [theoretical]: gathering useful macros in a standalone file?
Hey there.
I am reading through some threads; one of regeneration based on hp percentage rather than e. g. +4 or +8 hp.
The code may look like this or so:
#define ABILITY_REGENERACION_MENOR
[regenerate]
value="(hitpoints * 0.05)"
id=regeneracion_menor
name= _ "regeneracion menor"
description=_"
La unidad se regenera 5% del HP por turno."
affect_self=yes
poison=slowed
[/regenerate]
#enddef
Now ... if such macros work then I can easily use ruby to autogenerate it as-is.
But what I am also wondering ... is it possible to put all the macros for the whole
campaign into a single file, and then just reference / tap to that file for all these
special abilities?
The reason why I am asking ... I could probably autogenerate all these macros
for all abilities, update this as-is and refer to it within different scenarios, rather
than carry these on a per-scenario basis.
Anyway - right now this is just a noobie question. I haven't even finished thinking
what abilities I may need, so I am just randomly poking at things right now,
possibly WAY off any sensible paths to follow.
I am reading through some threads; one of regeneration based on hp percentage rather than e. g. +4 or +8 hp.
The code may look like this or so:
#define ABILITY_REGENERACION_MENOR
[regenerate]
value="(hitpoints * 0.05)"
id=regeneracion_menor
name= _ "regeneracion menor"
description=_"
La unidad se regenera 5% del HP por turno."
affect_self=yes
poison=slowed
[/regenerate]
#enddef
Now ... if such macros work then I can easily use ruby to autogenerate it as-is.
But what I am also wondering ... is it possible to put all the macros for the whole
campaign into a single file, and then just reference / tap to that file for all these
special abilities?
The reason why I am asking ... I could probably autogenerate all these macros
for all abilities, update this as-is and refer to it within different scenarios, rather
than carry these on a per-scenario basis.
Anyway - right now this is just a noobie question. I haven't even finished thinking
what abilities I may need, so I am just randomly poking at things right now,
possibly WAY off any sensible paths to follow.
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Macro question [theoretical]: gathering useful macros in a standalone file?
You could.
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: Macro question [theoretical]: gathering useful macros in a standalone file?
It is normal to have macros in separate folder away from rest of your wml. In _main.cfg include that folder first.
- Atreides
- Posts: 1075
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off
Re: Macro question [theoretical]: gathering useful macros in a standalone file?
One could using the new resource tag make a separate addon with just those utils/macros in it and then load it in any other addon that needed them? A sort of universal macro resource.