Pattern script

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
(Expression operators)
Line 1: Line 1:
 
{{article unfinished}}
 
{{article unfinished}}
  
= Introduction =
+
== Introduction ==
 
Pattern scripts is special kind of expressions that returns 1 or 0 used to determine availability of some functionality or event. This scripts can check for very wide range of conditions (gametime, special parms of entities, [[Infoportions | infoportions]] etc.).
 
Pattern scripts is special kind of expressions that returns 1 or 0 used to determine availability of some functionality or event. This scripts can check for very wide range of conditions (gametime, special parms of entities, [[Infoportions | infoportions]] etc.).
  
Line 9: Line 9:
 
* Gamemodels damage masks (checks if could be damaged by certain weapon)
 
* Gamemodels damage masks (checks if could be damaged by certain weapon)
 
* Checking if trigger could be touched
 
* Checking if trigger could be touched
 
  
 
Basic syntax:
 
Basic syntax:
Line 21: Line 20:
 
   // this script check if it's fullmoon night or raining  
 
   // this script check if it's fullmoon night or raining  
 
   (night & fullmoon) | raining
 
   (night & fullmoon) | raining
 
  
 
== Expression operators ==
 
== Expression operators ==
Line 28: Line 26:
  
 
{| border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse"
 
{| border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse"
! bgcolor=#EEDFDF | #
 
 
! bgcolor=#EEDFDF | Operator
 
! bgcolor=#EEDFDF | Operator
 
! bgcolor=#EEDFDF | Example
 
! bgcolor=#EEDFDF | Example
 
! bgcolor=#EEDFDF | Description
 
! bgcolor=#EEDFDF | Description
 
|-
 
|-
| colspan=3 | '''Boolean operators (only applicable between expressions)'''
+
| colspan=3 | '''Logical operators (only applicable between expressions)'''
 
|-
 
|-
| align=center | 1
 
 
| align=center | '''( )'''
 
| align=center | '''( )'''
 
| align=center | '''(''' ''expression'' ''')'''  
 
| align=center | '''(''' ''expression'' ''')'''  
 
| Expression
 
| Expression
 
|-
 
|-
| align=center | 2
 
 
| align=center | '''&'''
 
| align=center | '''&'''
 
| align=center | x '''&''' y
 
| align=center | x '''&''' y
 
| Logical 'And'
 
| Logical 'And'
 
|-
 
|-
| align=center | 3
 
 
| align=center | '''|'''
 
| align=center | '''|'''
 
| align=center | x '''|''' y
 
| align=center | x '''|''' y
 
| Logical 'Or'
 
| Logical 'Or'
 
|-
 
|-
| align=center | 4
+
| align=center | '''not'''
 +
| align=center | x & '''not''' y
 +
| Logical Not
 +
|-
 +
| colspan=3 | '''Comparison operators'''
 +
|-
 
| align=center | '''='''
 
| align=center | '''='''
 
| align=center | x '''=''' y
 
| align=center | x '''=''' y
 
| Equal
 
| Equal
 
|-
 
|-
| align=center | 5
 
 
| align=center | '''!='''
 
| align=center | '''!='''
 
| align=center | x '''!=''' y  
 
| align=center | x '''!=''' y  
 
| Not equal
 
| Not equal
 
|-
 
|-
| align=center | 6
 
 
| align=center | '''>'''
 
| align=center | '''>'''
 
| align=center | x '''>''' y  
 
| align=center | x '''>''' y  
 
| Greater
 
| Greater
 
|-
 
|-
| align=center | 7
 
 
| align=center | '''>='''
 
| align=center | '''>='''
 
| align=center | x '''>=''' y
 
| align=center | x '''>=''' y
 
| Greater or equal
 
| Greater or equal
 
|-
 
|-
| align=center | 8
 
 
| align=center | '''<'''
 
| align=center | '''<'''
 
| align=center | x '''<''' y
 
| align=center | x '''<''' y
 
| Lesser
 
| Lesser
 
|-
 
|-
| align=center | 9
 
 
| align=center | '''<='''
 
| align=center | '''<='''
 
| align=center | x '''<=''' y
 
| align=center | x '''<=''' y
 
| Lesser or equal
 
| Lesser or equal
 
|-
 
|-
| align=center | 10
 
| align=center | '''not'''
 
| align=center | x & '''not''' y
 
| Logical Not
 
|-
 
| align=center | 11
 
 
| align=center | '''><'''
 
| align=center | '''><'''
 
| align=center | x '''><''' start end
 
| align=center | x '''><''' start end
 
| x > start And x < end
 
| x > start And x < end
 
|-
 
|-
| align=center | 12
 
 
| align=center | '''=><'''
 
| align=center | '''=><'''
 
| align=center | x '''=><''' start end
 
| align=center | x '''=><''' start end
 
| x >= start And x < end
 
| x >= start And x < end
 
|-
 
|-
| align=center | 13
 
 
| align=center | '''><='''
 
| align=center | '''><='''
 
| align=center | x '''><=''' start end
 
| align=center | x '''><=''' start end
 
| x > start And x <= end
 
| x > start And x <= end
 
|-
 
|-
| align=center | 14
 
 
| align=center | '''=><='''
 
| align=center | '''=><='''
 
| align=center | x '''=><=''' start end
 
| align=center | x '''=><=''' start end
Line 106: Line 91:
 
|}
 
|}
  
= Functions =
+
== Functions ==
  
 
Set of functions is determined by pattern implementation. There is two pattern implementations as of yet.
 
Set of functions is determined by pattern implementation. There is two pattern implementations as of yet.

Revision as of 23:23, 17 July 2012

Template:Article unfinished

Contents

Introduction

Pattern scripts is special kind of expressions that returns 1 or 0 used to determine availability of some functionality or event. This scripts can check for very wide range of conditions (gametime, special parms of entities, infoportions etc.).

Usage examples:

  • Enemy appearance (some enemies are only active at night, some only at day etc.)
  • Gamemodels damage masks (checks if could be damaged by certain weapon)
  • Checking if trigger could be touched

Basic syntax:

 // this script check if its a night or if there is an enemy within 300 units
 night | enemy<300>.found
 // this scripts check if gametime is between 12 and 14 hours
 hour =><= 12 14
 // this script check if it's fullmoon night or raining 
 (night & fullmoon) | raining

Expression operators

Link expressions together.

Operator Example Description
Logical operators (only applicable between expressions)
( ) ( expression ) Expression
& x & y Logical 'And'
| x | y Logical 'Or'
not x & not y Logical Not
Comparison operators
= x = y Equal
!= x != y Not equal
> x > y Greater
>= x >= y Greater or equal
< x < y Lesser
<= x <= y Lesser or equal
>< x >< start end x > start And x < end
=>< x =>< start end x >= start And x < end
><= x ><= start end x > start And x <= end
=><= x =><= start end x >= start And x <= end

Functions

Set of functions is determined by pattern implementation. There is two pattern implementations as of yet.

GenericPattern

This is generic appearance pattern. It used on enemies appearance, zone appearance.

Operator Description
true Always returns 1
false Always returns 0
self.field Checks one of the field of script owner. Fields could be:
  • found - entity exists.
  • touchable - entity is touchable trigger or zone.
  • fired - trigger is deactivated. This is only applicable to: trigger_once, trigger_redirect, trigger_multi.
  • solved - puzzle trigger is solved. This is only applicable to: trigger_puzzle.
  • killed - entity was killed (deadflag is set).
  • dist x operator - check distance to activator.
  • deadtime x operator - check time enemy being dead.
target<name>.field
enemy<radius>.field
sid<name>.field

GamemodelHitPattern

Used on misc_gamemodel when model is hit.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox