What the heck is wrong with this code?

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
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

What the heck is wrong with this code?

Post by DDR »

Code: Select all

[ai]
	recruitment_pattern=fighter, scout, archer, healer, mixed fighter
	{ATTACK_DEPTH 6 6 6}
[/ai]
recruit=Goblin Spearman, Orcish Archer, Orcish Assassin, Orcish Grunt
It simply crashes wesnoth, without giving any reasons. I have checked over the code, and I cannot find any flaws in it. When the code is removed, it works fine. Any ideas?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

No, that looks fine. At least assuming your campaign uses the difficulties EASY, NORMAL and HARD.

Does it crash when starting the scenario or when starting/loading the campaign?
User avatar
Bob_The_Mighty
Posts: 870
Joined: July 13th, 2006, 1:15 pm

Post by Bob_The_Mighty »

I always thought you weren't meant to have spaces after the commas in lists of units, but i might be mistaken there.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Post by Iris »

The WML preprocessor strips the extra spaces IIRC.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

More Detail

Post by DDR »

Sorry for being unspecific. My campaign does use EASY, NORMAL and HARD. There are 4 players. 1 & 2 are AI, 3 is human (you), and 4 is AI. The code above is the AI instructions for the 4th player, and is much like the AI instructions for players 1 and 2. Player 1, 2, 3 move fine, but when it starts player 4's turn Wesnoth causes a runtime error. When I remove the aforementioned code, it runs without a hitch.
HaJo
Inactive Developer
Posts: 174
Joined: August 7th, 2005, 11:52 pm
Location: DE

Re: What the heck is wrong with this code?

Post by HaJo »

DDR wrote:

Code: Select all

[ai]
	recruitment_pattern=fighter, scout, archer, healer, mixed fighter
[/ai]
recruit=Goblin Spearman, Orcish Archer, Orcish Assassin, Orcish Grunt
It simply crashes wesnoth, without giving any reasons. Any ideas?
Did you try to remove that healer, or add a shaman to the recruit-list ?
-HaJo
User avatar
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

Post by DDR »

:oops: :shock: Thanks.
I rather expected wesnoth to have a workaround in place for that. Hunh.

Anyway, problem solved... say, should I submit this as a bug?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Woot, that causes a crash? :? Uh, yeah, please do submit a bug report.
User avatar
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

Post by DDR »

Ok, submitted the bug. It works now...

I spoke to soon.

Now, any ideas what causes this code to crash?

Code: Select all

[side]
	side=4
	no_leader=no

	{QUANTITY type (Goblin Knight) (Goblin Knight) (Goblin Knight)}
	description=Harg
	user_description= _ "Harg"
	unrenamable=yes
		[modifications]
			{TRAIT_STRONG}
			{TRAIT_RESILIENT}
		[/modifications]
	{GOLD 150 150 150}
	{INCOME 5 5 5}

	team_name=Northern Defenders
	controller=ai

	fog=no
	shroud=no

	canrecruit=1

	[ai]
		recruitment_pattern=fighter,scout,archer,mixed fighter
		{ATTACK_DEPTH 6 6 6}
	[/ai]
	recruit=Goblin Spearman, Orcish Archer, Orcish Assassin, Orcish Grunt

[/side]
I am posting more code this time, as something may be affecting something else. The scenario this is in consists of 3 other side statements, and a start tag with a bit of speech and some objectives. When I remove player 4, (this code) it works. When I have it in, it doesn't. The crash occurs after player 3 ends turn. Here is the error message I get. Something about a divide error?

View the screenshot at: http://www.exong.net/forum/files/error_167.png
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Post by Iris »

recruitment_pattern has 'scout' in it, but I don't see any (usage=scout) units in your recruit list.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

Post by DDR »

I tried removing the scout from the recruit list, but it had no effect.

Code: Select all

WESNOTH caused a divide error in module WESNOTH.EXE at 01cf:00425771.
Registers:
EAX=00011170 CS=01cf EIP=00425771 EFLGS=00210202
EBX=00000000 SS=01d7 ESP=00b2deac EBP=074a08d8
ECX=00000011 DS=01d7 ESI=00000003 FS=508f
EDX=00000000 ES=01d7 EDI=00000003 GS=0000
Bytes at CS:EIP:
f7 fb 03 c8 89 4c 24 18 8b 44 24 30 81 c5 e8 00 
Stack dump:
073d0390 073a03e0 0552e8bc 05d6484c 0108b9a2 00011170 00000011 03fabb60 00000032 00000000 00000032 05d648f8 074a09c0 073d0300 00000000 00000000 
Does this code mean anything? It is the runtime error description.
Post Reply