.. _stdlib_console: ================== Сheats and Hotkeys ================== Cheats are console commands that players can execute in your game using the in-game console. You can create new console commands directly in Daslang by using the ``[cheat]`` annotation. For example, let's write a command that allows you to start a specific level in the game:: [cheat(name="game.start_level")] def start_level(num : int) { set_current_level(num) } This command will be available in the console as ``game.start_level``. Note that the ``name`` parameter of the ``[cheat]`` annotation specifies the name of the command in the console. This parameter is optional; if it is not specified, the function name will be used as the command name. Here is a list of all the console commands that are available by default: ````` - open console ``app.pause`` (hotkey ``ctrl shift P``) - pause/unpause the game ``app.play`` (hotkey ``ctrl P`` or ``F5``) - start/stop the game ``app.next_frame`` (hotkey ``ctrl alt P``) - advance the game by one frame ``app.editor`` (hotkey ``F10``) - open/close the editor ``app.game_reload`` (hotkey ``ctrl shift R``) - reload the game (restores the game state) ``app.hard_reload`` (hotkey ``ctrl shift X``) - hard reload the game ``app.auto_restore_global_state`` - If true, the global state will be restored after a game reload (enabled by default). You can manage how the global state is restored after a game reload. ``app.set_target_fps`` - set an upper limit for the game's frame rate; use 0 to disable the limit ``app.set_time_scale`` - set the scale for game time (default is 1.) ``app.get_locale_name`` - print the current and system (actual) locale names ``app.set_locale_name`` - override the locale name (use an empty string to reset) ``app.listen_editor_shortcuts`` - enable/disable listening to editor shortcuts when the editor is open (enabled by default) Garbage collector commands: ``gc.collect_strings`` - collect unused strings, all unused heaps objects will be collected too ``gc.collect_heap`` - collect unused objects in the heap ``gc.collect_all`` - collect both unused strings and objects in the heap (default strategy) ``gc.enabled`` - enable/disable the garbage collector ``gc.validate`` - validate the heap and report any issues. Useful for debugging memory-related problems. ``gc.report`` - print a report of the current memory usage. Very verbose output, prints only in text log, can freeze the game for a long time. Other hotkeys: ``ctrl shift P`` or ``F5`` - pause/unpause the game ``ctrl P`` - start/stop the game ``ctrl shift =`` - increase the time scale ``ctrl shift -`` - decrease the time scale ``ctrl shift 0`` - reset the time scale to 1 ``F11`` - take a screenshot (it will appear in the ``game/.project/screenshots`` folder) Editor hotkeys: ``ctrl D`` - duplicate the selected node ``F2`` - rename the selected node ``F10`` - toggle fullscreen/editor modes ``delete`` - remove the selected node ``f`` - focus on the selected node ``alt`` - orbit the camera ``ctrl Z`` - undo ``ctrl shift Z`` - redo ``RMB`` - rotate the camera ``w/a/s/d`` + ``RMB`` - move the camera (forward/left/backward/right) ``e/c`` + ``RMB`` - move the camera up or down ``shift`` - speed up camera movement ``ctrl`` - slow down camera movement ``MMB (middle mouse button)`` - move the camera in screen space Hold ``Ctrl`` while creating a new node to place it at the origin. Hold ``Ctrl`` to enable snapping for translation, rotation, and scaling with gizmos.