no paragraphs in note (Solved)

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
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

no paragraphs in note (Solved)

Post by Lizard »

First problem solved, see a post below for curred...

I used the Shop-macro from the UsefulWMLFragments and modified it a bit. I made an option sub macro which adds a
image.

Code: Select all

#define ARENA_OPTION_IMG_TXT TXT TXT_EXIT GOLD IMG OBJECT
[option]
	message=_ {MENU_IMG_TXT {IMG} {TXT}}
	[command]
		[if]
			[variable]
				name=gold
				greater_than={GOLD}
			[/variable]
			[then]
				[gold]
					amount=-{GOLD}
					side=$side_number
				[/gold]
				[object]
					{OBJECT}
				[/object]
				[set_variable]
				  name=exit_message
				  value={TXT_EXIT}
				[/set_variable]
			[/then]
		[/if]
	[/command]
[/option]
#enddef
But after you leave the shop there is an empty message as in the attachment. The message is centered. when I click the message disappears(as every message in game) and the $exit_message is shown. here is the Shop Code:

Code: Select all

#define SHOP FILTER
[event]
name=moveto
first_time_only=no
[filter]
{FILTER}
[/filter]
[store_gold]
side=$side_number
variable=gold
[/store_gold]
[message]
speaker=narrator
message=_ "What items would you like to purchase?"
image=wesnoth-icon.png

{ARENA_OPTION_IMG_TXT "140 GP: Sharpen Melee Weapon, damage:+2" "Your weapon is now sharpen." 140 attacks/glaive.png(
[effect]
	apply_to=attack
	range=melee
	increase_damage=2
[/effect]
)}

{ARENA_OPTION_IMG_TXT "150 GP: Enchance Ranged Weapon, damage +2" "Your weapon is now enchanced." 150 attacks/bow.png(
[effect]
	apply_to=attack
	range=ranged
	increase_damage=2
[/effect]
)}

{ARENA_OPTION_IMG_TXT "150 GP: Crystal Orb, damage +2 on magical attack" "Your magical weapons are now Stronger." 150 attacks/magic-missile.png(
[effect]
	apply_to=attack
	special=magical
	increase_damage=2
[/effect]
)}

[/message] # !!! Here the empty message appears :(
[message]
speaker=narrator
message=$exit_message
side_for=$side_number
[/message]
[/event]
#enddef 
How can I remove this empty message? :([/size]
Attachments
the empty message
the empty message
empty.jpg (8.3 KiB) Viewed 2972 times
Last edited by Lizard on March 29th, 2008, 3:28 pm, edited 8 times in total.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
Aethaeryn
Translator
Posts: 1554
Joined: September 15th, 2007, 10:21 pm
Location: Baltimore, Maryland, USA

Re: empty message after shop

Post by Aethaeryn »

Did you try removing all of this?

Code: Select all

[message]
speaker=narrator
message=$exit_message
side_for=$side_number
[/message]
Aethaeryn (User Page)
Wiki Moderator (wiki)
Latin Translator [wiki=Latin Translation](wiki)[/wiki]
Maintainer of Thunderstone Era (wiki) and Aethaeryn's Maps [wiki=Aethaeryn's Maps](wiki)[/wiki]
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: empty message after shop

Post by Lizard »

Aethaeryn wrote:Did you try removing all of this?

Code: Select all

[message]
speaker=narrator
message=$exit_message
side_for=$side_number
[/message]
No, but I added it as a try to remove the empty message...
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
Blueblaze
Posts: 418
Joined: June 24th, 2007, 12:16 am

Re: empty message after shop

Post by Blueblaze »

silent=yes in your [object] tags.

Need further help, search for "silent" in this page: http://www.wesnoth.org/wiki/DirectActionsWML
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: empty message after shop

Post by Lizard »

It works, thanks Blueblaze.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: empty message after shop (Solved)

Post by Lizard »

I want to sell a Goblin, but that did not work.shop takes money, but no goblin is made.

Code: Select all

{ARENA_OPTION_IMG_TXT "10 GP: Goblin Spearman" "Get a sidekick" "I'll fight on your side!" 10 attacks/spear-orcish.png (
[set_variable]
	name=gob_x_pos
	value={FILTER_X}
[/set_variable]
{VARIABLE_OP gob_x_pos add -1}
[unit]
	x=$gob_x_pos
	y={Filter_Y}
	type=Goblin Spearman
	description=Gobi
	user_description= _ "Gobi"
	side=1
[/unit]
)}
This is the macro call. I changed it a bit from the last version, but the other items work. Here is the macro definition:[/size]
The Arena Option Macro

Code: Select all

#define ARENA_OPTION_IMG_TXT TXT TXT_2 TXT_EXIT GOLD IMG EFFECT
[option]
	message=_ "&"+{IMG}+"=~"+{TXT}+"
`"+{TXT_2}	# " # comment for correct syntax highlighting.
	[command]
		[if]
			[variable]
				name=gold
				greater_than={GOLD}
			[/variable]
			[or]
			[variable]
				name=gold
				equals={GOLD}
			[/variable]
			[/or]
			[then]
				[gold]
					amount=-{GOLD}
					side=$side_number
				[/gold]
				{EFFECT}
				[set_variable]
				  name=exit_message
				  value={TXT_EXIT}
				[/set_variable]
				[set_variable]
				  name=exit_image
				  value={IMG}
				[/set_variable]
			[/then]
		[/if]
	[/command]
[/option]
#enddef
and the Shop makro now don't use a filter but 2 coordinates:

Code: Select all

#define SHOP FILTER_X FILTER_Y
.
.
.
What is the problem? How can I correct it?[/size]
Last edited by Lizard on March 24th, 2008, 12:50 pm, edited 1 time in total.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: Shop don't create Goblin

Post by AI »

case-sensitivity: {FILTER_Y} is different from {Filter_Y}

Don't let windows teach you the wrong way, case *does* matter, in code, in filenames, in everything.
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: Shop don't create Goblin

Post by Lizard »

Thanks AI :D it works :D
we definitely need a "bangs head violently against keyboard" smiley. How could this happen?
AI wrote:Don't let windows teach you the wrong way, case *does* matter, in code, in filenames, in everything.
Delphi teaches me...
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: Shop don't create Goblin (Solved)

Post by Lizard »

Here is the next problem I summoned:
you can buy 2 attacks, but only on of them has the given Image. While the Club is correct, the crossbow isn't.

Code: Select all

{ARENA_OPTION_IMG_TXT "25 GP: Buy Crossbow" "gain a 5-3 ranged pierce attack" "feel free to test it out" 25 attacks/crossbow-human.png (
[object]
silent=yes
	[effect]
		apply_to=new_attack
		name=Crossbow
		image=attacks/crossbow-human.png
		type=pierce
		range=ranged
		damage=5
		number=3
	[/effect]
[/object]
)}

{ARENA_OPTION_IMG_TXT "25 GP: Buy Club" "gain a 7-2 melee impact attack" "feel free to test it out" 25 attacks/club-small.png (
[object]
silent=yes
	[effect]
		apply_to=new_attack
		name=Club
		image=attacks/club-small.png
		type=impact
		range=melee
		damage=7
		number=2
	[/effect]
[/object]
)}
What is wrong this time :?:[/size]
Last edited by Lizard on March 29th, 2008, 3:05 pm, edited 1 time in total.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Shop don't create Goblin (Solved)

Post by zookeeper »

Lizard wrote:What is wrong this time :?:
The fact that you invented an image= key which actually does nothing.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: missing new_attack image

Post by AI »

the correct key is named 'icon'

The club works because the default icon is "attacks/$name|.png", though it probably shows the wrong club. (and only on windows, due to the capitalized 'C')
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: missing new_attack image (Solved)

Post by Lizard »

Thanks, it works :!:
Next error will come, it won't take long.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: missing new_attack image (Solved)

Post by Lizard »

Problem No. 4:
the empty lines in my note don't appear, there are newlines, but no lines between. I want the to look like several <p>s, but they actually look like <br />s

Code: Select all

				[objectives]
						side=1
						[objective]
							description= _ "Your team kills all enemy units"
							condition=win
						[/objective]
						[objective]
							description= _ "The other team kills all of your units"
							condition=lose
						[/objective]
						note= _ "
You can only recruit in the first Turn
The Villages don't give money, you can
take them to reduce upkeep and for healing.

You can only get money for killing units.

If your leader dies, you get a new one.

there are several shops on the Map, each
shop offers the same services for the same prices.

Version 0.-1.1, more things will be added."
				[/objectives]
This is how it looks like:

You can only recruit in the first Turn
The Villages don't give money, you can
take them to reduce upkeep and for healing.
You can only get money for killing units.
If your leader dies, you get a new one.
there are several shops on the Map, each
shop offers the same services for the same prices.
Version 0.-1.1, more things will be added.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: no paragraphs in note

Post by tsr »

IIRC the trick is to put some spaces on the 'empty' lines.

/tsr
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: no paragraphs in note

Post by Lizard »

Thanks, it works.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
Post Reply