Help: my campaign always crashes

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.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Help: my campaign always crashes

Post by toms »

I can't figure out the reason. It is not the scenario's fault, because when I made the second scenario the first, it still crashes. And in the first scenario, I commented everything out(in hope to find the error then)
The paths to include the scenarios seem right. Can there be other reasons?
First read, then think. Read again, think again. And then post!
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

By crash do you mean the game quits or the preprocessor give you errors?
Hope springs eternal.
Wesnoth acronym guide.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

scott wrote:By crash do you mean the game quits or the preprocessor give you errors?
The game quits, I don't get errors by the preprocessor.


BTW, I don't like the new behavior of the game to quit when an error appears. I liked it more when I got back to the main menu. Is it to avoid freezes or harder crashes?
(even if I don't have to quit wesnoth to correct the bug now :P )
First read, then think. Read again, think again. And then post!
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

The only time I know when a campaign can cause a crash like that is with text encoding and weird UTF character combinations.

For example, I wanted to get the game to display a right arrow character, which is accomplished with a ü and a square root symbol, but those characters together caused the game to crash every time because of how they were encoded. You may have a stray character or something encoded weirdly. If it's not a text issue, I don't know what it would be. I would re-write the scenario from scratch.
Hope springs eternal.
Wesnoth acronym guide.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I tried to rewrite the first scenario, but nothing works still. As well not the second. :(
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Uhm...I'm gonna rewrite it from scratch. So far I only have story, sides and some lines of code which should be alright.
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Remove half of the code, check if it still crashes. If yes, then remove another half, test if it crashes, and so on, until you find the spot that makes it crash. Then just go through that spot with plenty of thought and see how it links to other parts of the code (since the error isn't usually on the line that seems to cause it), and you should the problem eventually.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

That's what I tried before. Because it also crashed when I took another scenario as the first one, I suspect that the campaign file is not alright.

Code: Select all

[campaign]
	id=campaign_scout
	icon=elvish-rider-attack.png
	image=elvish-scout-moving.png
	name=_"Scout"
	#first_scenario=undead_attack
	first_scenario=prologue
	difficulties=EASY,NORMAL,HARD
        difficulty_descriptions="&elvish-scout.png=Scout=(easiest);*&elvish-rider.png=Rider;&elvish-outrider.png=Outrider=(hardest)"

	define=CAMPAIGN_SCOUT
	description= _ "Eldromir,a elvish scout is sent to the green isle by the elven Kali'an because the elves want to steal the ruby of fire from the undead lords. The storyline isn't changed because he doesn't get the ruby in the end.

Play to find it out..."
[/campaign]

#ifdef CAMPAIGN_SCOUT

[units]
{@campaigns/Scout/units}
[/units]
{@campaigns/Scout/utils/main.cfg}
{@campaigns/Scout}
{@campaigns/Scout/scenarios}

#endif
It might be a bug too, should I try again with the next version? (I use 1.1.2, and decided to download 1.2)
First read, then think. Read again, think again. And then post!
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

You want to use [+units] not [units]. There might be more, but that jumped out at me. I always use the MENU_IMG_TXT2 macro so I don't know the correct syntax for the difficulty descriptions off the top of my head, but you might double check that too.
Hope springs eternal.
Wesnoth acronym guide.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

[+units] wasn't it. The weird thing is it worked fine all the time, but suddenly it only crashed any more, even if I cut the changed part out.
First read, then think. Read again, think again. And then post!
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

I would say start with this and add keys until it breaks. However, it's possible something changed in another file somewhere completely unrelated (like you installed an add-on) that is causing problems. If you want to PM me the files you're using I can test them out on this end.

Code: Select all

[campaign]
	id=campaign_scout
	name= _ "Scout"
	first_scenario=prologue
	define=CAMPAIGN_SCOUT
[/campaign]

#ifdef CAMPAIGN_SCOUT
[binary_path]
path=data/campaigns/Scout
[/binary_path]
[+units]
{@campaigns/Scout/units}
[/units]
{@campaigns/Scout/utils}
{@campaigns/Scout/scenarios}
#endif
Hope springs eternal.
Wesnoth acronym guide.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

With your change it doesn't show up in the menu at all. :?
First read, then think. Read again, think again. And then post!
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

the description needs a " on the end, I haven't spotted any others.
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

toms wrote:With your change it doesn't show up in the menu at all. :?
I can get it to show up on the menu with what I suggested, but I can't get it to load without the 2 difficulty keys.
Hope springs eternal.
Wesnoth acronym guide.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

scott wrote:I can get it to show up on the menu with what I suggested, but I can't get it to load without the 2 difficulty keys.
You get it working with those keys?
First read, then think. Read again, think again. And then post!
Post Reply