Skip to reading
Action Lists & Events

26. Make this mean the caller

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page

Use this to reuse one operation on several calling objects. A script called by the lever can treat this as the lever; the same script called by another prop can treat this as that prop. It does not automatically mean the player.

Code example
func run(_context: Dictionary = {}) -> Variant:
    if this == null:
        return false
    await SetObjectVisible({"entityId": "this",
                            "visible": false})
    return true

That example is a small "hide the calling object" operation. Use it only from an appropriate object-owned event. If an editor picker does not offer this, use the text script or structured expression route instead of choosing a random object as a substitute.

Source table from 26. Make this mean the caller, page 30
SituationWhat to expect
Object/character/trigger eventA caller can normally be captured from its entity context.
GUI eventthis identifies the owning GUI; elementId this has a special route for the calling element.
Inventory eventThe item can be the owner when its item context is supplied.
Ownerless startup/room eventThere may be no this record. Check for null.
Nested script callThe original captured caller is retained through the call chain.
OnCharacterControlThe controlled player can supply the character caller in this special event.

A structured action targeting this without a caller is skipped with a diagnostic in the checked runtime. It does not silently fall back to the player. The runtime check used for this guide confirmed that behavior.

Page 30 of 189Permalink
Go to page