Contents Up Previous Next

Region functions

DisableRegion
EnableRegion
GetRegionAt
RunRegionInteraction
SetAreaLightLevel


DisableRegion

DisableRegion (int regnum)
Disables region number REGNUM in the current room. All areas of the screen that were previously REGNUM now act as type 0 (no region). You can turn it back on later with the EnableRegion command.

While a region is disabled, it will not be returned by GetRegionAt, and if the character walks onto the region then its interactions will not get run.

This command permanently disables the region - that is, it will not be reset when the player re-enters the room. The only way of turning it back on is to use the EnableRegion command.

Example:

DisableRegion(3);
will disable region number 3.

See Also: DisableHotspot, EnableRegion


EnableRegion

EnableRegion (int regnum)
Re-enables region number REGNUM in the current room, that was previously disabled by the DisableRegion command.

Example:

EnableRegion(3);
will re-enable region number 3.

See Also: DisableRegion


GetRegionAt

GetRegionAt (int x, int y)
Returns the number of the region at ROOM co-ordinates (X,Y). If there is no region there, or if invalid co-ordinates are specified, returns 0.

NOTE: Unlike GetHotspotAt, the co-ordinates specified are ROOM co-ordinates. This means that if you want to use the mouse cursor location, you have to add the screen offset to make it work in scrolling rooms.

Example:

if (GetRegionAt(player.x, player.y) == 0)
    Display ("The player is not currently standing on a region.");
See Also: GetWalkableAreaAt


RunRegionInteraction

RunRegionInteraction (int region, int event)
Processes the interaction list as if the EVENT for REGION had been activated. REGION is the region number, 1 to 15.

EVENT is the event type:
0 While player stands on region
1 Player walks onto region
2 Player walks off region

Example:

RunRegionInteraction(4, 1);
will run the actions defined in the interaction editor for "Player walks onto region" for region 4.

See Also: RunCharacterInteraction, RunHotspotInteraction


SetAreaLightLevel

SetAreaLightLevel (int area, int level)
Changes region number AREA to have light level LEVEL. This does the same thing as the Light Level textbox in the editor, but allows you to change it at run-time.

AREA is from 1 to 15 (the region number), and LEVEL is from -100 to 100. (0 is the defualt non-lit level).

NOTE: The light level will be reset when the player leaves the room, so you need to use it in Player Enters Screen if you want a permanent change.

Example:

if (GetGlobalInt(10)==1)
    SetAreaLightLevel(2,100); 
will set region 2's level light to 100 if the Global Integer 10 is 1.