This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

inheritsFrom(["item",]"prototype")


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Query Boolean   [other Query Boolean operators]

 Baseline

 


inheritsFrom(), is Boolean true if a specific prototype (note) is used by a note, either directly or through other prototypes. For a direct inheritance, the value of $Prototype can be checked but inheritsFrom() allows checking of inheritance via multiple prototypes. Where a note X inherits from a prototype A but the latter itself uses a prototype B, inheritsFrom() allows testing if X inherits indirectly from B. As such inheritance occurs via A, it is otherwise difficult to test such inheritance. This is a specialist operator unlikely to be used except where prototypes themselves use other prototypes.

In a query, or find(), all notes are tested. In an action context (rule, edict, agent action, OnAdd, expression, etc.) only the current note (this) is evaluated. To query the document for notes inheriting from prototype 'pEvent', use the query term:

inheritsFrom("pEvent") 

It is possible to test, via an action, the inheritance of a different note using the second parameter. Thus to test if 'Note B' inherits from prototype 'pTask':

inheritsFrom("Note B","pTask") 

For example, suppose prototype 'pFlower' has the prototype 'pPlant', and note 'Rose' uses the prototype 'pFlower'. Then

inheritsFrom("pPlant") 

is true for both pFlower and pPlant.

inheritsFrom("pFlower") 

is true for Rose, but false for pPlant.

N.B. note that the stated prototype is also included in the items testing true. This makes sense if actual notes in the document are prototypes, as opposed to using only deliberate 'non-content' prototypes. To filter the latter, and exclude all prototype notes, use a query like:

inheritsFrom("pFlower") & $IsPrototype==false 

You can also write an offset test so note 'Rose' can test if note 'Camelia' uses prototype 'pFlower':

inheritsFrom("Camelia","pFlower") 

This returns true if 'Camelia' inherits from that prototype. Or, 'Rose' might want to check if its parent uses that prototype:

inheritsFrom("parent,"pFlower") 



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : inheritsFrom(["item",]"prototype")