Why doesn't this work

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
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Why doesn't this work

Post by Ranger M »

I've checked all over this, and looked at examples of how other poeple have used it, but I just don't get why this isn't working:

Code: Select all

#textdomain wesnoth-Invasion_of_Arendia
#define DEATHS_IOA
	[event]
	name=die
		[filter]
		description=Reth
		[/filter]
		[message]
		speaker=unit
		message= _ "I... I don't think I can make it anymore."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Teresa
		[/filter]
		[message]
		speaker=unit
		message= _ "Now I can't reclaim any throne, let alone my own."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Sarah
		[/filter]
		[message]
		speaker=unit
		message= _ "Reoed, help me, I'm dieing!"
		[/message]
		[message]
		description=Reoed
		message= _ "No, don't die, I love you too much for you to die."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Tom
		[/filter]
		[message]
		speaker=unit
		image=portraits/Tom.png
		message= _ "Brother, help me!"
		[/message]
		[message]
		description=Matt
		image=portraits/Matt.png
		message= _ "Tom! no don't die on me now, not after all we've been through"
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Reoed
		[/filter]
		[message]
		speaker=unit
		message= _ "No, I'm too young to die. Sarah, I love you."
		[/message]
		[message]
		description=Sarah
		message= _ "(sniff) I love you too."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Matt
		[/filter]
		[message]
		speaker=unit
		image=portraits/Matt.png
		message= _ "Brother, help me!"
		[/message]
		[message]
		description=Tom
		image=portraits/Tom.png
		message= _ "Matt! no don't die, I can't live without my other half."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Jaryn
		[/filter]
		[message]
		speaker=unit
		message= _ "For the Sidhe!"
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]
#enddef
and the code I used to add it to the scenario (with loads edited out, to make for easier reading):

Code: Select all

[scenario]
{DEATHS_IOA}
[/scenario]
I also referenced it and the file that it's in in the Invasion_of_Arendia file (also with tons edited out):

Code: Select all

#ifdef CAMPAIGN_INVASION_OF_ARENDIA
[+units]
   {@campaigns/Invasion_of_Arendia/units/arendian_units}
   {@campaigns/Invasion_of_Arendia/units/elemental_units}
   {@campaigns/Invasion_of_Arendia/units/hoard}
   {@campaigns/Invasion_of_Arendia/units/human}
   {@campaigns/Invasion_of_Arendia/units/nagas}
   {@campaigns/Invasion_of_Arendia/units/wild_elves}
[/units]

{@campaigns/Invasion_of_Arendia/units}
{@campaigns/Invasion_of_Arendia/images}
{@campaigns/Invasion_of_Arendia/scenarios}
{@campaigns/Invasion_of_Arendia/utils/deaths.cfg}
{@campaigns/Invasion_of_Arendia/utils}
#endif

Help please (this is why I never used custom macros before, but I thoughth that doing the death events would be an easy, non essential way of practicing, and saving space in the scenario files.[/code]
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Try switching the places of these two:

Code: Select all

{@campaigns/Invasion_of_Arendia/scenarios}
{@campaigns/Invasion_of_Arendia/utils/deaths.cfg}
...so that deaths.cfg will get included before the scenarios (and, if that solves the issue, naturally make the other utils be included before the scenarios as well).
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

Thanks, that worked. :D
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I really wish I had known that earlier, because it explains much.
First read, then think. Read again, think again. And then post!
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

A macro should always be defined before the place where it needs to be used. wiki/PreprocessorRef
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Post Reply