[remove_shroud] and [terrain] question

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
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Transfer selection from editor to wml

Post by Paulomat4 »

No, I don't think so. Probably the easiest thing to do is to break your area up into three or four ranges that cover everything with nothing extra. Then use [filter_location] with an [or] statement for each range.
Okay, thank you. That what I'll do then. :)
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Transfer selection from editor to wml

Post by fabi »

Why don't you use the editor's "area" feature and filter for the id of the area?
"Wesnoth has many strong points but team and users management are certainly not in them." -- pyrophorus
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Unexpected characters at line start error

Post by Paulomat4 »

Hello guys,

I haven't run into any unsolvable wml errors for quite some time until recently. I was trying to include the fire elemental from rise of the elementalist, adding the missing unit macros step by step. Unfortunately I'm getting the following error and I'm clueless on what it is supposed to mean.

Unexpected characters at line start
at ~add-ons\\dawn_of_thunder\\units\\elementals\\Fire_Elemental.cfg:19
included from ~add-ons\\dawn_of_thunder\\_main.cfg:53

here's the elementals.cfg file:
Spoiler:
I've checked the file but can't find any unexpected character. :doh: Any idea someone?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Unexpected characters at line start error

Post by Sapient »

The error message says to check Fire_Elemental.cfg at line number 19.
Are you sure you posted the right file here?
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Unexpected characters at line start error

Post by zookeeper »

Whether it's the right or wrong file, that #textdomain line sure shouldn't be like that...
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Unexpected characters at line start error

Post by Paulomat4 »

The error message says to check Fire_Elemental.cfg at line number 19.
right, sry. here it is:
Spoiler:
that #textdomain line sure shouldn't be like that
You're absolutely right. I currently haven't made my campaign translatable so I figured it didn't matter. :)
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Unexpected characters at line start error

Post by zookeeper »

...and you checked those macros to make sure that calling them there that way won't result in unexpected characters at line start? Because it seems pretty clear that's the problem.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Unexpected characters at line start error

Post by Paulomat4 »

...and you checked those macros to make sure that calling them there that way won't result in unexpected characters at line start?
yup. I don't see anything wrong with them, maybe you could explain :)
here are the two custom macros that are called.

Code: Select all

#define SPECIAL_NOTES_FIRE_HEALING HP
_" This unit regenerates {HP} HP per turn when on lava terrain."
#enddef

#define SPECIAL_NOTES_WOOD_HEALING
    _" This unit regenerates 8 HP per turn by absorbing energy from burning forests. Any time this unit starts a turn on a dry forrest (non-snow), it burns the trees, leaving none left."
#enddef
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Unexpected characters at line start error

Post by Ravana »

Here you can see that it adds unquoted \n to description, so what follows is indeed unexpected.
User avatar
Pentarctagon
Project Manager
Posts: 5527
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Unexpected characters at line start error

Post by Pentarctagon »

You can also check <wesnoth install>/data/core/macros/special-notes.cfg for comparison.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Unexpected characters at line start error

Post by Paulomat4 »

Thanks, i figured it out :) I didn't eben think about this possibility before. You can always learn something new with wesnoth.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

[allow_undo] in moveto events

Post by Paulomat4 »

Could someone maybe clarify for me hoe [allow_undo] works?
I've been working on this event which randomly spawns a crab on a moveto event.

Code: Select all

	[event]
		name=moveto
		first_time_only=no
		[filter]
			side=1,2,3,4,5
			[filter_location]
				terrain=D*^*, Hd, D*
			[/filter_location]
		[/filter]
		[set_variable]
			name=spawnlevel
			rand=0,1,2,3
		[/set_variable]
		[if]
			{VARIABLE_CONDITIONAL spawnlevel equals 1}
			[then]
				[unit]
					type="Crab"
					x,y=$x1,$y1
					side=6
					find_vacant=yes
				[/unit]
			[/then]
		[/if]
		[if]
			{VARIABLE_CONDITIONAL spawnlevel equals 2}
			[then]
				[unit]
					type="Overgrown Crab"
					x,y=$x1,$y1
					side=6
					find_vacant=yes
				[/unit]
			[/then]
		[/if]
		[if]
			{VARIABLE_CONDITIONAL spawnlevel equals 3}
			[then]
				[unit]
					type="Giant Crab"
					x,y=$x1,$y1
					side=6
					find_vacant=yes
				[/unit]
			[/then]
		[/if]
		[allow_undo]
		[/allow_undo]
	[/event]
The Problem is that it is now impossible to undo a move on sandy terrain, even though I added [allow_undo]. How can I do this, at least if no unit is spawned?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [allow_undo] in moveto events

Post by gfgtdf »

The Problem is that it is now impossible to undo a move on sandy terrain, even though I added [allow_undo]. How can I do this, at least if no unit is spawned?
You can't. Requiring a random variable ([set_varialbe] rand=) is in internal change of the gamestate that cannot be undone without causing OOS. The game engine detects this and ignores your [allow_undo]


EDIT: this means you can make it undoable if you don't use rand= to determine whether a unit is spawned, you coudl for example make the unit spawned only depend on the turn and the coodinate, like:

Code: Select all

      [set_variable]
         name=spawnlevel
         value="$(($x1 + $1y + $turn_number + $turn_number +side_number) % 4)"
      [/set_variable]
of this isnt perfect, a proper hash function woudl toa better job
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: [allow_undo] in moveto events

Post by Sapient »

Probably better to pick the ambush points in advance. I think there's an HttT scenario that does that, which you could look at for an example.

At one point there was a nice PseudoRandom algorithm on the wiki. But since someone deleted the page in 2008 it appears that I can no longer view it in the history.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [allow_undo] in moveto events

Post by gfgtdf »

Sapient wrote: At one point there was a nice PseudoRandom algorithm on the wiki. But since someone deleted the page in 2008 it appears that I can no longer view it in the history.
I dont se how this could help here, if he used that instead of of rand= in his code he'd get OOS if the actions was undone since the wml-implemented pseudo random counter would have changed. If he generated them in advance (in prestart event) he could also use rand= .
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Post Reply