Index


NAME

cf::mapscript

DESCRIPTION

This module implements the mapscript object.

Map scripts are perl snippets that get executed whenever any connected element is triggered (e.g. a check inv, a lever etc.)

ENVIRONMENT

The map scripts are compiled and executed into a namespace with the following symbols available:

$self

The mapscript object itself.

$state

The state value (0 means release, <>0 means push/trigger/enable) that triggered the map script.

$activator

The object that was triggered (the lever, check inv element, npc etc.).

$originator

The object that triggered the activator, usually (but not always) the player who stepped on a check inv, pulled a lever etc. Can be undef.

@obs = find $id_or_object

Finds all objects with the given connected $id. If an object reference is passed, it will be returned unchanged.

trigger $id_or_object[, $state]

Triggers the linked chain with the given connected id, or the connected chain associated with the given object (if an object reference is passed), and passes the given state (or 1, if missing) to it.

timer $id_or_object, $seconds

Starts the timer on the given mapscript object (usually, $id_or_object is $self). When the timer expires on the mapscript object, it will trigger the script with $activator == $self and $originator == undef.

EXAMPLE

Have a look at scorn/anthonty/portgate.map for a nontrivial example.