Filter documentation - Updated 2009-07-09

Anything related to Game Scanner

Filter documentation - Updated 2009-07-09

Postby bdamage » 19 Apr 2009, 14:24

This is a quick guide how you create your own filters in Game Scanner 2.0.



You can create your own favorites, by right clicking in the treeview window (right pane).


This will pop-up a menu, either you add a new filter or you can edit a exsisting filter.
right_click.jpg



The editor is simple and the filter syntax is pretty much the same as ASE. What you don't have to do is to write line numbers, GS takes cares of that for you.

filtereditor.jpg


There is simple "Test filter" button, which will give some help if the filter is valid or not but it is not 100% fool proof.

Save if you want keep the changes otherwise cancel.

Syntax:
Code: Select all
Command var1 Operator var2 Command2


Command can be if, keep, remove or goto.

var1 can be a constant*, server variable or a string.
var2 can be a constant*, server variable or a string.

If a string then it must be inside quotes ("), requires for numbers values also.
* See below for constants.

eg:
Code: Select all
if hostname == "*hardcore*" keep

or
Code: Select all
if players >= "5" keep


Code: Select all
if players > maxplayers remove

etc

Constants:
    hostname
    anticheat
    game
    ping
    country
    ip
    port
    address
    map
    players
    maxplayers
    modname
    favorite,
    version
    private


if statement

if statement command is used to compare to values.
Syntax:
Code: Select all
if var1 OP var2 command


OP can be any operator code see below for a full list.
command will occur when if statement is TRUE.

Example of if statement:
Code: Select all
if modname != "cpma" remove


Operator codes (for comparing in if statements):

Code: Select all
==    : strings match (case sensitive)
!=    : strings don't match (case sensitive)
~==    : strings match (case insensitive)
~!=    : strings don't match (case insensitive)
<    : less than
<=    : less than or equal
>    : greater than
>=    : greater than or equal


for strings wildcard can be used:
* = match any string
? = match any character

Example with wildcard compares:
Code: Select all
if version == "Quake 4 Final V1.4*" remove

The above filter will remove any version containing "Quake 4 Final V1.4" in the version string.

Additional notes:
If no condition is met then default is to keep the server in the list.


Group filters
You can create group filters, a group filter can be used for ON / OFF typical filters. Which means either you want to see servers with specific setting or hide by simply clicking one of the either filters.

To understand more how they work look at (use edit) the Punbuster On/Off filter or Private hide or show, a third example is the Global ping filter.


How to create such filter ensure to have a common Group name which can be set in top right field in the editor and ensure the check box at bottom of the editor is checked.



Want more to read about the filters, the following topic could be interested Filters, Group filters and Global filters explained
User avatar
bdamage
Site Admin
 
Posts: 275
Joined: 04 Jan 2009, 14:09

Re: Create your own filter - Updated 2009-07-09

Postby TomMRiddle » 16 Jul 2009, 00:34

I think you have missed a crucial detail about filtergroups, filtergroups is more then a convenient way to "group" filters it also dictate the filters relations to one another. Filters in the same group has an "OR" relationship while filters in two different groups have an "AND" relationship, this means grouping filters properly is crucial.

Example 1
Code: Select all
Filter for: Min 7 players
Groupname: minplayers
if players < "7" remove

Filter for: Max 19 players
Groupname: maxplayers
if players > "19" remove
These two filters would not have worked properly if grouped together because then GS would show servers that meet any one of the two filters criteria instead of only showing servers that meet the criteria of both filters.

Example 2
Code: Select all
Filter for: Map - carentan
Groupname: map
if map != "mp_carentan" remove

Filter for: Map - crash
Groupname: map
if map != "mp_crash" remove
If these two filters had not been in the same group you would not be able to show servers for both maps at the same time, they would have canceled eachother out because no server can run two maps at the same time.

Ignoring the groupname when creating filters will cause major problems when combining unrelated filters because they will have the same default groupname.
TomMRiddle
 
Posts: 130
Joined: 04 Apr 2009, 13:01

Re: Create your own filter - Updated 2009-07-09

Postby bdamage » 16 Jul 2009, 10:37

TomMRiddle wrote:I think you have missed a crucial detail about filtergroups, filtergroups is more then a convenient way to "group" filters it also dictate the filters relations to one another. Filters in the same group has an "OR" relationship while filters in two different groups have an "AND" relationship, this means grouping filters properly is crucial.

Example 1
Code: Select all
Filter for: Min 7 players
Groupname: minplayers
if players < "7" remove

Filter for: Max 19 players
Groupname: maxplayers
if players > "19" remove
These two filters would not have worked properly if grouped together because then GS would show servers that meet any one of the two filters criteria instead of only showing servers that meet the criteria of both filters.

Example 2
Code: Select all
Filter for: Map - carentan
Groupname: map
if map != "mp_carentan" remove

Filter for: Map - crash
Groupname: map
if map != "mp_crash" remove
If these two filters had not been in the same group you would not be able to show servers for both maps at the same time, they would have canceled eachother out because no server can run two maps at the same time.

Ignoring the groupname when creating filters will cause major problems when combining unrelated filters because they will have the same default groupname.


You are correct. Good point I will add this into the description.

Just to confirm I understand you correct. Example 1 works fine as long you define two different groupnames one for min and one for max to make a AND operator.
User avatar
bdamage
Site Admin
 
Posts: 275
Joined: 04 Jan 2009, 14:09

Re: Create your own filter - Updated 2009-07-09

Postby TomMRiddle » 16 Jul 2009, 23:44

bdamage wrote:Just to confirm I understand you correct. Example 1 works fine as long you define two different groupnames one for min and one for max to make a AND operator.
Exactly
TomMRiddle
 
Posts: 130
Joined: 04 Apr 2009, 13:01


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron