-
Notifications
You must be signed in to change notification settings - Fork 0
Hotspot
static Hotspot* Hotspot.GetAtRoomXY(int x, int y)
Returns the hotspot at ROOM 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.
Example:
if (Hotspot.GetAtRoomXY(player.x, player.y) == hPressurePlate) {
Display("As soon as adventurer stands on the pressure plate the door opens.");
}
will display the message if the player character is over the hPressurePlate hotspot.
Compatibility: Supported by AGS 3.5.0 and later versions.
See Also: Hotspot.GetAtScreenXY, Character.GetAtRoomXY, Object.GetAtRoomXY, Region.GetAtRoomXY, Game.GetLocationName, GetLocationType
(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.
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: Hotspot.GetAtRoomXY, Character.GetAtScreenXY, Object.GetAtScreenXY, Region.GetAtScreenXY, Game.GetLocationName, GetLocationType
(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
(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
bool Hotspot.SetProperty(const string property, int value)
Sets the new value for the custom property for the specified hotspot. Returns TRUE if such property exists and FALSE on failure.
This command works with Number properties (it sets the numeric value), and with Boolean properties (sets FALSE is value is equal to 0, or TRUE otherwise).
Use the equivalent SetTextProperty function to set new text property value.
Example:
hDoor.SetProperty("LockDifficulty", 5);
will change Door hotspot's "LockDifficulty" custom property to 5.
Compatibility: Supported by AGS 3.4.0 and later versions.
See Also: Hotspot.SetTextProperty
bool Hotspot.SetTextProperty(const string property, const string value)
Sets the new value text for the custom property for the specified hotspot. Returns TRUE if such property exists and FALSE on failure.
This command works with Text properties only. The property's text will be changed to new value.
Use the equivalent SetProperty function to set a non-text property.
Example:
hDoor.SetTextProperty("Description", "The sturdy door");
will change Door's "description" property.
Compatibility: Supported by AGS 3.4.0 and later versions.
See Also: Hotspot.SetProperty
Hotspot.IsInteractionAvailable(CursorMode)
Checks whether there is an event handler defined for activating the hotspot in cursor mode MODE.
This function is very similar to RunInteraction, except that rather than run the event handler script function, it simply returns true if something would have happened, or false if unhandled_event would have been run.
Example:
if (hTable.IsInteractionAvailable(eModeLookat) == 0)
Display("looking on this table would not do anything.");
Compatibility: Supported by AGS 3.4.0 and later versions.
See Also: IsInteractionAvailable, Hotspot.RunInteraction
(Formerly known as RunHotspotInteraction, which is now obsolete)
Hotspot.RunInteraction(CursorMode)
Processes the event handler as if the player had clicked the mouse on the hotspot using the specified cursor mode.
Example:
hDoor.RunInteraction(eModeLookat);
will run the code defined in the "LOOK AT HOTSPOT" event for hotspot hDoor.
See Also: Room.ProcessClick, Hotspot.IsInteractionAvailable, Character.RunInteraction, Object.RunInteraction
(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
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
(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
(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
(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
Getting Started in AGS
Editor Reference
- Music and sound
- Distributing your game
- Backing up your game
- The text parser
- Translations
- Global variables
- Custom Properties
- Plugins
- Lip sync
- New Game templates
- Debugging features
- Auto-number speech files
- Integration with Windows
- Source Control integration
Engine
Scripting
- Scripting tutorial part 1
- Scripting tutorial part 2
- Pointers in AGS
- Calling global functions from local scripts
- The script header
- String formatting
- Multiple Scripts
- Understanding blocking scripts
- Dynamic Arrays
- Extender functions
- Game variables
- Predefined global script functions
- repeatedly_execute (_always)
- Custom dialog options rendering
- Built-in enumerated types
- Script language keywords
- AudioChannel functions and properties
- AudioClip functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game / Global functions
- GUI functions and properties
- GUI control functions and properties
- GUI Button functions and properties
- GUI InvWindow functions and properties
- GUI Label functions and properties
- GUI List Box functions and properties
- GUI Slider properties
- GUI Text Box functions and properties
- Hotspot functions and properties
- Inventory item functions and properties
- Maths functions and properties
- Mouse functions and properties
- Multimedia functions
- Object functions and properties
- Overlay functions and properties
- Palette functions
- Parser functions
- Region functions and properties
- Room functions
- Screen functions
- Speech functions and properties
- String functions
- System functions and properties
- Text display / Speech functions
- ViewFrame functions and properties
Working on Legacy games
Upgrading from a previous version
- Upgrading to AGS 2.7
- Upgrading to AGS 2.71
- Upgrading to AGS 3.0
- Upgrading to AGS 3.1
- Upgrading to AGS 3.2
- Upgrading to AGS 3.3
- Upgrading to AGS 3.3.5
- Upgrading to AGS 3.4
- Upgrading to AGS 3.4.1
Legal Notice
Getting in touch