Macro question [theoretical]: gathering useful macros in a standalone file?

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.
Post Reply
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

Macro question [theoretical]: gathering useful macros in a standalone file?

Post by shevegen »

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. :)
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Macro question [theoretical]: gathering useful macros in a standalone file?

Post by Pentarctagon »

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
User avatar
Ravana
Forum Moderator
Posts: 2950
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Macro question [theoretical]: gathering useful macros in a standalone file?

Post by Ravana »

It is normal to have macros in separate folder away from rest of your wml. In _main.cfg include that folder first.
User avatar
Atreides
Posts: 1059
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?

Post by Atreides »

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.
Post Reply