Contents Up Previous Next

Region functions

DisableRegion
EnableRegion
GetRegionAt
RunRegionInteraction
SetAreaLightLevel
SetRegionTint


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), but LEVEL is from -100 to 100. This is different from the editor, which takes values from 0 to 200. Subtract 100 from the value you would use in the editor when calling this function. The reason for this discrepancy is legacy reasons from the DOS editor days.

To disable region lighting and tinting effects, pass 0 as 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.

NOTE: Setting a light level will disable any RGB tint set for the region.

Example:

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

See Also: SetRegionTint


SetRegionTint

SetRegionTint (int area, int red, int green, int blue, int amount)
Changes region number AREA to have RGB tint (RED, GREEN, BLUE).

The red, green and blue values are between 0 and 255, and you supply the same values that you would use in the editor.

AMOUNT determines the extent of the tinting, and is from 1 to 100, reflecting a percentage figure. 100% will completely colourize characters in that area to the specified colour.

NOTE: The tint 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.

NOTE: To remove the region tint, call SetAreaLightLevel with a LEVEL of 0.

Example:

SetRegionTint(2, 180, 20, 20, 50); 
will set region 2's RGB tint to (180, 20, 20) with 50% opacity.

See Also: SetAreaLightLevel