I dont understand why the filter do not work properly

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
Fosprey
Posts: 254
Joined: January 25th, 2008, 8:13 am

I dont understand why the filter do not work properly

Post by Fosprey »

If i have this code. It works as expected, the meny only appers around the Empire_barracks unit.

Code: Select all

[set_menu_item]
		id=menu_barracks
		description=_"~Barracks menu"
		image=themes/units.png
		[show_if]
		[not]
				[have_unit]
					x,y=$x1,$y1
				[/have_unit]
			[/not]
			[have_location]
				[filter]
					side=$side_number
					type=Empire_Barracks
				[/filter]
				[and]
					x=$x1
					y=$y1
					radius=1
				[/and]
			[/have_location]
			
		[/show_if]
but as long as I change it to this.

Code: Select all

[set_menu_item]
		id=menu_barracks
		description=_"~Barracks menu"
		image=themes/units.png
		[show_if]
		[not]
				[have_unit]
					x,y=$x1,$y1
				[/have_unit]
			[/not]
			[have_location]
				[filter]
					side=$side_number
					type=Empire_Barracks
					[not]
						[wml_filter]
						moves=0
						[/wml_filter]
					[/not]
				[/filter]
				[and]
					x=$x1
					y=$y1
					radius=1
				[/and]
			[/have_location]
			
		[/show_if]
The menu never appears around the unit, even if it has 0 ,4, or 5 moves or whatever number of moves.

The idea is that the menu do not appear if the unit has 0 moves left, but for some reason it makes it so it never appears under any condition. I tried and tried and i got to a clueless spot.

thanks
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: I dont understand why the filter do not work properly

Post by zookeeper »

[wml_filter] -> [filter_wml]
Post Reply