-
Notifications
You must be signed in to change notification settings - Fork 10
GameEventsOrder
ivan-mogilko edited this page Mar 29, 2023
·
4 revisions
The game in AGS consists of "loops" which run repeatedly with certain speed (see SetGameSpeed). On each loop it runs certain events and script callbacks, updates the game and redraws the game on screen.
The order of these actions within a single loop is consistent. When you start using AGS you probably won't care about that, but as you write more complex scripts, it may become important. This order may seem a bit strange in some parts, but it's a result of AGS development history.
Following is a sequence of actions which happen in a normal game loop:
-
repeatedly_execute_always
function is called (if found in script). - (since AGS 3.6.0) Game cursor position update; GUI focus is updated, depending on a new cursor position.
- Reaction to player's input (keyboard, mouse, and so on); not every action is immediate though, some things will be scheduled and put into the event queue, which is processed much later.
- Main game update: almost everything in the game is updated: characters, room objects, animations, and so forth.
-
late_repeatedly_execute_always
function is called (if found in script). - Non-blocking screen shaking update (see ShakeScreenBackground).
- (prior to AGS 3.6.0) Game cursor position update; GUI focus is updated, depending on a new cursor position.
- Game is drawn on screen.
- All the scheduled events are executed. Strictly speaking, the order of execution is undefined. Commonly
repeatedly_execute
goes first, but that's rather a coincidence and is not recommended to rely upon. Other events include:on_key_press
,on_mouse_click
,on_event
, and so forth (see their respective page for details).
Getting Started in AGS
Editor
- New Game templates
- Editor Preferences
- General Settings
- Default Setup
- Colours Editor
- Room Editor
- Character Editor
- Cursor Editor
- Dialog Editor
- Font Preview
- GUI Editor
- Inventory Items Editor
- View Editor
- Sprite Manager
- Music and sound
- Voice speech
- Script Modules
- System limits
- Log Panel
- Plugins
- Other Features
Engine
Scripting
- Scripting Tutorial
- Scripting Language
-
Scripting API
- Script API Overview
- Standard Constants
- Standard Enumerated Types
- Standard Types
- Game variables
- Global arrays
- Global event handlers
- repeatedly_execute / repeatedly_execute_always
- Custom dialog options rendering
- Global functions: general
- Global functions: message display
- Global functions: multimedia actions
- Global functions: palette operations
- Global functions: room actions
- Global functions: screen effects
- Global functions: wait
- AudioChannel functions and properties
- AudioClip functions and properties
- Camera functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- Dictionary functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game functions and properties
- 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
- Object functions and properties
- Overlay functions and properties
- Parser functions
- Region functions and properties
- Room functions and properties
- Screen functions and properties
- Set functions and properties
- Speech functions and properties
- String functions
- System functions and properties
- TextWindowGUI functions and properties
- ViewFrame functions and properties
- Viewport functions and properties
- Obsolete Script API
- Event Types
- Key code table
- Audio in script
Legal Notice
Getting in touch
Misc
Hidden