Contents Up Previous Next

Hotspot functions and properties

GetAtScreenXY (hotspot)
GetProperty (hotspot)
GetTextProperty (hotspot)
RunInteraction (hotspot)
Enabled property (hotspot)
ID property (hotspot)
Name property (hotspot)
WalkToX property
WalkToY property


GetAtScreenXY (hotspot)

(Formerly known as global function GetHotspotAt, which is now obsolete)

static Hotspot* Hotspot.GetAtScreenXY(int x, int y)
Returns the hotspot at SCREEN co-ordinates (X,Y). If there is no hotspot there, or if invalid co-ordinates are specified, the Hotspot* representing hotspot 0 will be returned.

NOTE: The co-ordinates are SCREEN co-ordinates, NOT ROOM co-ordinates. This means that with a scrolling room, the co-ordinates you pass are relative to the screen's current position, and NOT absolute room co-ordinates. This means that this function is suitable for use with the mouse cursor position variables.

Example:

if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hDoor)
  Display("Mouse on the door");
else if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) != hotspot[0])
  Display("Mouse is on something (but not the door)!");
else
  Display("Mouse not on a hotspot");
will display a message depending on what the mouse is on.

See Also: Game.GetLocationName, GetLocationType


GetProperty (hotspot)

(Formerly known as GetHotspotProperty, which is now obsolete)

Hotspot.GetProperty(string property)
Returns the custom property setting of the PROPERTY for the hotspot.

This command works with Number properties (it returns the number), and with Boolean properties (returns 1 if the box was checked, 0 if not).

Use the equivalent GetTextProperty function to get a text property.

Example:

if (hotspot[1].GetProperty("Value") > 200)
  Display("Hotspot 1's value is over 200!");
will print the message if hotspot 1 has its "Value" property set to more than 200.

See Also: Hotspot.GetTextProperty


GetTextProperty (hotspot)

(Formerly known as GetHotspotPropertyText, which is now obsolete)
(Formerly known as Hotspot.GetPropertyText, which is now obsolete)

String Hotspot.GetTextProperty(string property)
Returns the custom property setting of the PROPERTY for the hotspot.

This command works with Text properties only. The property's text will be returned from this function.

Use the equivalent GetProperty function to get a non-text property.

Example:

String description = hotspot[2].GetTextProperty("Description");
Display("Hotspot 2's description: %s", description);
will retrieve hotspot 2's "description" property and display it.

See Also: Hotspot.GetProperty


RunInteraction (hotspot)

(Formerly known as RunHotspotInteraction, which is now obsolete)

Hotspot.RunInteraction(CursorMode)
Processes the interaction list as if the player had clicked the mouse on the hotspot using the specified cursor mode. May be useful with the text parser for simulating a mouse click if they type specific words in.

Example:

hDoor.RunInteraction(eModeLookat);
will run the code defined in the "LOOK AT HOTSPOT" interaction for hotspot hDoor.

See Also: ProcessClick, Character.RunInteraction, Object.RunInteraction


Enabled property (hotspot)

(Formerly known as DisableHotspot, which is now obsolete)
(Formerly known as EnableHotspot, which is now obsolete)

bool Hotspot.Enabled
Enables/disables the specified hotspot. If you set this to false, then all areas of the screen that were previously made up of the hotspot now act as type 0 (no hotspot). You can turn the hotspot back on later by setting this back to true.

This setting is persisted in-game; that is, it will not be reset when the player re-enters the room.

The default value of this property is always true.

Example:

hBrownTree.Enabled = false;
will disable the hBrownTree hotspot.

See Also: Region.Enabled, RemoveWalkableArea, RestoreWalkableArea


ID property (hotspot)

readonly int Hotspot.ID
Gets the hotspot number of this hotspot. This allows you to interoperate with old script using the number-based hotspot functions.

Example:

Display("Hotspot hDoor is hotspot number %d.", hDoor.ID);
Display("Hotspot 3 is number %d.", hotspot[3].ID);
displays hDoor's hotspot number, and then displays hotspot 3's number (which will be 3).

See Also: Hotspot.GetAtScreenXY


Name property (hotspot)

(Formerly known as GetHotspotName, which is now obsolete)
(Formerly known as Hotspot.GetName, which is now obsolete)

readonly String Hotspot.Name;
Gets the name of the hotspot.

This property is read-only; it is currently not possible to change hotspot names at run-time.

Example:

Display("Hotspot 3's name is %s.", hotspot[3].Name);
will retrieve and then display hotspot 3's name.

See Also: Game.GetLocationName


WalkToX property

(Formerly known as GetHotspotPointX, which is now obsolete)

readonly int Hotspot.WalkToX
Gets the X room co-ordinate of the hotspot's walk-to point. If the hotspot does not have a walk-to point, returns -1.

Example:

player.Walk(hTable.WalkToX, hTable.WalkToY, eBlock, eWalkableAreas);
will move the character to hotspot hTable's walk-to point.

See Also: Hotspot.WalkToY, MoveCharacterToHotspot


WalkToY property

(Formerly known as GetHotspotPointY, which is now obsolete)

readonly int Hotspot.WalkToY
Gets the Y room co-ordinate of the hotspot's walk-to point. If the hotspot does not have a walk-to point, returns -1.

Example:

player.Walk(hTable.WalkToX, hTable.WalkToY, eBlock, eWalkableAreas);
will move the character to hotspot hTable's walk-to point.

See Also: Hotspot.WalkToX, MoveCharacterToHotspot