This version is out of date, covering development from v7.0.0 to v7.5.6. 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 7 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. 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' inhertis 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"])