Error with custom terrain

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
Steelclad Brian
Posts: 110
Joined: November 15th, 2005, 5:26 am

Error with custom terrain

Post by Steelclad Brian »

I'm trying to implement a custom terrain based on the roving ship keep idea in the Useful WML Fragments wiki.

Here's the page in question:
http://www.wesnoth.org/wiki/WML_Scenari ... rom_a_ship

So I've implemented the following code, but I keep getting error messages. Note that the previous two custom terrains work fine. Here's the block of code that, when included in my campaign, breaks the whole thing.

Code: Select all

#ifdef CAMPAIGN_AGE_OF_AXES
[terrain]
symbol_image=swampwater
id=troll_spawn
name= _ "Spawning Grounds"
char=y
aliasof=w
recruit_onto=true
recruit_from=true
[/terrain]
{TERRAIN_BASE y swampwater}

[terrain]
symbol_image=dirt
id=summoning_dirt
name= _ "Summoning Circle"
char=x
aliasof=g
recruit_onto=true
recruit_from=true
[/terrain]
{TERRAIN_BASE x dirt}

# THIS IS THE PART THAT BREAKS
# \/\/\/\/
[terrain]
    id=ship_keep
    name= _ "Dock"
    image=coast.png
    char=z
    aliasof=c
    submerge=0.4
    unit_height_adjust=-4
    recruit_from=true
[/terrain]

{TERRAIN_BASE_PROB      z	coast3        30}
{TERRAIN_BASE_PROB      z	coast2        30}
{TERRAIN_BASE		z	coast}
{TERRAIN_ADJACENT -202  z	!cz	coast}

{@campaigns/Age_of_Axes/scenarios}
{@campaigns/Age_of_Axes/maps}
{@campaigns/Age_of_Axes/utils.cfg}
[+units]
{@campaigns/Age_of_Axes/units}
{@campaigns/Age_of_Axes/race.cfg}
[/units]
#endif
[binary_path]
path=data/campaigns/Age_of_Axes/
[/binary_path]
The error message is:
ERROR DETAILS:
Missing closing tag for terrain at /Users[...]/Age_of_Axes.cfg:36 at /Users[...]/Age_of_Axes.cfg:50

I figure I'm not doing something right with the terrain, but since I copy-pasted it from the fragments page, I really don't know what could be wrong.
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

you probably need to close:

Code: Select all

#ifdef CAMPAIGN_AGE_OF_AXES 
with

Code: Select all

#endef (or something like that, rusty on that bit of WML)
at the end of the code
Anyar
Posts: 191
Joined: July 25th, 2005, 9:18 pm
Location: MI

Post by Anyar »

Ranger M wrote:

Code: Select all

#endef (or something like that, rusty on that bit of WML)
Actually, #endif, and he already has it.
Even as the fingers of the two hands are equal, so are human beings equal to one another. No one has any right, nor any preference to claim over another. You are brothers. - Muhammed
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

:oops: oh yeah, didn't notice it between the [binary_path] tag and the [/units] tag.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I must say that I don't have any idea why it breaks. I can't see anything wrong with it. Perhaps you could try to isolate the problem a bit more?
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Code: Select all

[+units]
(path)
[/units]
... may be right, but it works also with:

Code: Select all

[units]
(path)
[/units]
First read, then think. Read again, think again. And then post!
Steelclad Brian
Posts: 110
Joined: November 15th, 2005, 5:26 am

Post by Steelclad Brian »

zookeeper wrote:I must say that I don't have any idea why it breaks. I can't see anything wrong with it. Perhaps you could try to isolate the problem a bit more?
It appears that the macro that I had copy-pasted into the scenario as part of the ship thing didn't work, for some reason. I re-wrote it from scratch since it wasn't exactly what I wanted anyway, and it now works. Sort of.

The scenario now force quits the application at turn 5-7 with no warning or error message, and I have no idea why. :?

Time for more debugging...
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I could take a closer look myself, if you zip everything up (campaign file + directory) and post them here (in that case it would also be good to know what version of Wesnoth you're using). Having written the ship thing, I'm slightly interested in the problem myself. :wink:
Steelclad Brian
Posts: 110
Joined: November 15th, 2005, 5:26 am

Post by Steelclad Brian »

If I fail to figure out the source of what's going wrong, I'll take you up on that offer. For now I'm going to use the tried and true method of deleting chunks of WML until it stops crashing. Like I said, I essentially re-wrote your code from scratch although I use the same ideas. Mostly I took out the cleverest parts, so you may be disappointed by my version. :)

The major differences are I don't use the whole "get back on the ship and into the recall list" idea and instead of actually examining the terrain to see if nearby hexes are castle hexes I have a [filter] with every single hex the player can recruit from listed.
Post Reply