How to handle less-than in a filter?

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
Kharn
Posts: 83
Joined: December 12th, 2005, 7:50 pm
Location: Dallas, Tx

How to handle less-than in a filter?

Post by Kharn »

How do I fix the code below to replace the Less than symbol since wesnoth cant handle less than symbols?

Code: Select all

[event]
	name=attack_end
	first_time_only=no
	
	[filter_attack]
		name=Theft
	[/filter_attack]
	[filter_second]
		canrecruit=no
		[and]
			max_experience<265
		[/and]
	[/filter_second]
...
...
Creator of 120+ units Lord of the Rings era and campaign now outdated & lost.
Creator of WWII Battleground Europe mod with 120+ units most with custom wml and animations. Every variable is mathematically derived based on WWII stats such as historical cost & mm armour.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: How to handle less-than in a filter?

Post by gfgtdf »

you have to use formula or lua, here the formula version (not tested, might have typos):

Code: Select all

[filter_second]
formula = "max_experience < 265"
[/filter_second]
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
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How to handle less-than in a filter?

Post by beetlenaut »

You can do it purely in WML too (also not tested):

Code: Select all

[filter_wml]
    [variable]
        name=second_unit.max_experience
        less_than=256
    [/variable]
[/filter_wml]
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: How to handle less-than in a filter?

Post by zookeeper »

beetlenaut wrote:You can do it purely in WML too (also not tested):
Yes, although you need to use [filter_condition] for it:

Code: Select all

[event]
   name=attack_end
   first_time_only=no
   
   [filter_attack]
      name=Theft
   [/filter_attack]
   [filter_second]
      canrecruit=no
   [/filter_second]

   [filter_condition]
      [variable]
         name=second_unit.max_experience
         less_than=256
      [/variable]
   [/filter_condition]
...
...
Post Reply