Editing Pattern script
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | {{ | + | {{article unfinished}} |
− | + | ||
− | + | ||
− | ===Script input=== | + | == Introduction == |
+ | Pattern scripts is special kind of expressions that returns 1 or 0. Script can check and combine wide range of conditions (gametime, special parms of entities, [[Infoportions | infoportions]] etc.). Patters script are used for enemy appearance, gamemodel damage masks, trigger touchability and other events which only need to control availability of some action. | ||
+ | |||
+ | === Script input === | ||
* Pattern - script string | * Pattern - script string | ||
− | * Script owner - entity that owns | + | * Script owner - entity that owns pattern comparison |
* Script activator - entity that launched comparison event | * Script activator - entity that launched comparison event | ||
− | ===Script rules=== | + | === Script rules === |
* Instructions are case sensative | * Instructions are case sensative | ||
− | * Operators (excluding ''( | + | * Operators (excluding ''()'') should be separated by space or tab. |
* Null script always returns 1 | * Null script always returns 1 | ||
Line 24: | Line 25: | ||
(night & fullmoon) | raining | (night & fullmoon) | raining | ||
− | ==Operators== | + | == Operators == |
+ | |||
+ | Link expressions together. | ||
+ | |||
{| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | {| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | ||
− | ! width=10% | Operator | + | ! bgcolor=#EEDFDF width=10% | Operator |
− | ! width=20% | Example | + | ! bgcolor=#EEDFDF width=20% | Example |
− | ! width=70% | Description | + | ! bgcolor=#EEDFDF width=70% | Description |
|- | |- | ||
− | | colspan=3 | + | | colspan=3 | '''Logical operators (only applicable between expressions)''' |
|- | |- | ||
| align=center | '''( )''' | | align=center | '''( )''' | ||
Line 38: | Line 42: | ||
| align=center | '''&''' | | align=center | '''&''' | ||
| align=center | x '''&''' y | | align=center | x '''&''' y | ||
− | | Logical 'And'. | + | | Logical 'And'. Must be always separated by space. |
|- | |- | ||
| align=center | '''|''' | | align=center | '''|''' | ||
| align=center | x '''|''' y | | align=center | x '''|''' y | ||
− | | Logical 'Or'. | + | | Logical 'Or'. Must be always separated by space. |
|- | |- | ||
| align=center | '''not''' | | align=center | '''not''' | ||
| align=center | x & '''not''' y | | align=center | x & '''not''' y | ||
− | | Logical Not. | + | | Logical Not. Must be always separated by space. |
|- | |- | ||
− | | colspan=3 | + | | colspan=3 | '''Comparison operators''' (must be always separated by space) |
|- | |- | ||
| align=center | '''=''' | | align=center | '''=''' | ||
Line 91: | Line 95: | ||
|} | |} | ||
− | ==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. | ||
− | ===GenericPattern=== | + | === GenericPattern === |
This is generic appearance pattern. It used on enemies appearance, [[Zones | zone appearance]]. | This is generic appearance pattern. It used on enemies appearance, [[Zones | zone appearance]]. | ||
− | '''true''' | + | {| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" |
− | + | ! width=25% bgcolor=#EEDFDF | Operator | |
+ | ! width=75% bgcolor=#EEDFDF | 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. | ||
+ | |- | ||
+ | | '''enemy'''.''field'' | ||
+ | | Check field of script owner enemy. See fields list above. | ||
+ | |- | ||
+ | | '''target<'''''name'''''>'''.''field'' | ||
+ | | Find entity by targetname (return first match). See fields list above. | ||
+ | |- | ||
+ | | '''enemy<'''''radius'''''>'''.''field'' | ||
+ | | Find enemy of script owner within given radius. See fields list above. | ||
+ | |- | ||
+ | | '''sid<'''''name'''''>'''.''field'' | ||
+ | | Find entity by [[SaveId]]. See fields list above. | ||
+ | |} | ||
− | + | === GamemodelHitPattern === | |
− | + | ||
− | + | Used on [[misc_gamemodel]] when model is hit. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | {{hidden begin | GamemodelHitPattern functions}} | |
− | + | {| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | |
− | + | ! width=25% bgcolor=#EEDFDF | Operator | |
− | + | ! width=75% bgcolor=#EEDFDF | Description | |
− | + | |- | |
− | + | | '''true''' | |
− | + | | Always returns 1 | |
− | + | |- | |
− | + | | '''false''' | |
− | + | | Always returns 0 | |
− | + | |- | |
− | + | | '''pushonly''' | |
− | + | | System word. Allows to push object but not destroy. This should be the first operator in expression if used. | |
− | + | |- | |
− | + | | '''tag_''tagname''''' | |
− | + | | Returns 1 if model tag closest to hit position matches this tag. Otherwise 0. | |
− | + | |- | |
− | + | | '''''number''%''' | |
− | + | | Randomly returns 1 with this chance percentage. Typical values are 25%, 50%, 90% etc. | |
− | + | |- | |
− | + | | '''''damagetype''''' | |
− | + | | Check if weapon have this damage type. Damagetype should be one of following constants: | |
− | + | * slash - sword | |
− | + | * crush - mace | |
− | + | * crushblow - mace special hit | |
− | + | * hack - axe | |
− | + | * impale - throwing knifes, arrows | |
− | + | * teeth - animals | |
− | + | * claw - animals, wolf form | |
− | + | * water - water damage | |
− | + | * energy - energy bolts, magic missiles | |
− | : | + | * spikes - spike zones |
− | + | * flame - fire, flame sword | |
− | + | * flaying - flay artefact | |
− | + | * imploding - implode artefact | |
− | + | * soulreaver - soul reaver magic attack | |
− | + | |} | |
− | + | {{hidden end}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | === | + | |
− | + | ||
− | '''true''' | + | |
− | + | ||
− | + | ||
− | '''false''' | + | |
− | + | ||
− | + | ||
− | '''pushonly''' | + | |
− | + | ||
− | + | ||
− | '''tag_''tagname''''' | + | |
− | + | ||
− | + | ||
− | '''''number''%''' | + | |
− | + | ||
− | + | ||
− | '''''damagetype''''' | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |