Redefining Mainline Definitions

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.

Redefining Mainline Definitions

Postby The_Gnat » January 11th, 2017, 3:21 am

Hello (again ;) )

I am now wondering if their is a way to redefine mainline definitions for all mainline units? For example if i would like every unit's {AMLA_DEFAULT} to be changed when my add-on is installed how would this be done? Similarly if i want to modify the {WEAPON_SPECIAL_MAGICAL} definition, is their a way to override the current definitions when my add-on is installed, or override the definitions if a modification is choosen?

Thank you very much for answering all my questions! :D
User avatar
The_Gnat
 
Posts: 1096
Joined: October 10th, 2016, 3:06 am

Re: Redefining Mainline Definitions

Postby Ravana » January 11th, 2017, 3:34 am

The_Gnat wrote:or override the definitions if a modification is choosen?

Runtime cannot affect preprocessing.
User avatar
Ravana
Moderator
 
Posts: 1407
Joined: January 29th, 2012, 12:49 am
Location: Estonia

Re: Redefining Mainline Definitions

Postby The_Gnat » January 11th, 2017, 4:05 am

Ravana wrote:
The_Gnat wrote:or override the definitions if a modification is choosen?

Runtime cannot affect preprocessing.


Thank you, yes i realize that. Is their, however, a way to override the definitions on startup if a add-on is installed.
User avatar
The_Gnat
 
Posts: 1096
Joined: October 10th, 2016, 3:06 am

Re: Redefining Mainline Definitions

Postby Kwandulin » January 11th, 2017, 4:09 am

User avatar
Kwandulin
Art Contributor
 
Posts: 251
Joined: March 30th, 2014, 7:35 am
Location: Germany

Re: Redefining Mainline Definitions

Postby The_Gnat » January 11th, 2017, 5:13 am

Thanks for responding, yes i did not really expect to be able to override processor commands like these but was hoping ^_^

If anyone has any suggestions of hack ways to do this they would be appreciated!
User avatar
The_Gnat
 
Posts: 1096
Joined: October 10th, 2016, 3:06 am

Re: Redefining Mainline Definitions

Postby Lord-Knightmare » January 11th, 2017, 9:22 am

I think someone already did something like that in their UMC. Forgot the name though...

Code: Select all
#ifdef AMLA_DEFAULT
#undef AMLA_DEFAULT
#endif

# Your new one
#define AMLA_DEFAULT

# Insert whatever code you want here in [advancement] tags

#enddef


EDIT: this is my 1000th post
User avatar
Lord-Knightmare
Forum Regular
 
Posts: 1074
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.

Re: Redefining Mainline Definitions

Postby Ravana » January 11th, 2017, 10:50 am

This only works for units that are loaded after your addon, core should be before.
User avatar
Ravana
Moderator
 
Posts: 1407
Joined: January 29th, 2012, 12:49 am
Location: Estonia

Re: Redefining Mainline Definitions

Postby Lord-Knightmare » January 11th, 2017, 6:06 pm

This only works for units that are loaded after your addon, core should be before.

True, but he can make it work for core too by...well, making copies of ALL the existing mainline units (with new ID's)...
User avatar
Lord-Knightmare
Forum Regular
 
Posts: 1074
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.

Re: Redefining Mainline Definitions

Postby nuorc » January 11th, 2017, 8:59 pm

Lord-Knightmare wrote:making copies of ALL the existing mainline units (with new ID's)...
I think it sounds like a good idea if an add-on 'keeps to itself' and doesn't mess with core or other add-ons.
Spoiler:
I have a cunning plan.
User avatar
nuorc
Forum Regular
 
Posts: 569
Joined: September 3rd, 2009, 2:25 pm
Location: Barag Gor

Re: Redefining Mainline Definitions

Postby The_Gnat » January 11th, 2017, 11:26 pm

Thanks for all the feedback!

True, but he can make it work for core too by...well, making copies of ALL the existing mainline units (with new ID's)...


I would rather not duplicate all the wesnoth units.

This only works for units that are loaded after your addon, core should be before.


Yes and that doesn't really help me.

I think it sounds like a good idea if an add-on 'keeps to itself' and doesn't mess with core or other add-ons.


Yeah, i would like my add-on only to mess around with stuff if a [modification] is selected which means anything i do needs to be after the game starts. Which means that i will probably be forced to use an [event] that modifies peoples AMLA.

I don't know how the actual game wesnoth was coded but maybe a feature could be added so that before loading all the definitions on the startup the game checks for any add-ons that have an override characteristic, if it finds them then it loads them instead. This would be helpful to a lot of add-ons but it's probably not at all possible.
User avatar
The_Gnat
 
Posts: 1096
Joined: October 10th, 2016, 3:06 am


Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 2 guests