From 3e80abf322241677d36da408d7e833c9927a6a5f Mon Sep 17 00:00:00 2001 From: balloonpopper <5151242+balloonpopper@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:02:49 +1000 Subject: [PATCH] feat: Added print command to print output at any debug level (#564) Co-authored-by: Balloonpopper --- .../game/core-scripts/esc/commands/print.gd | 27 +++++++++++++++++++ game/rooms/room10/esc/room10.esc | 1 + 2 files changed, 28 insertions(+) create mode 100644 addons/escoria-core/game/core-scripts/esc/commands/print.gd diff --git a/addons/escoria-core/game/core-scripts/esc/commands/print.gd b/addons/escoria-core/game/core-scripts/esc/commands/print.gd new file mode 100644 index 00000000..5b1d8db4 --- /dev/null +++ b/addons/escoria-core/game/core-scripts/esc/commands/print.gd @@ -0,0 +1,27 @@ +# `debug string [string2 ...]` +# +# Prints a message to the Godot debug window. +# Use this for debugging game state. +# +# **Parameters** +# +# - *string*: The string to log +# +# @ESC +extends ESCBaseCommand +class_name PrintCommand + + +# Return the descriptor of the arguments of this command +func configure() -> ESCCommandArgumentDescriptor: + return ESCCommandArgumentDescriptor.new( + 1, + [TYPE_STRING], + [""] + ) + + +# Run the command +func run(command_params: Array) -> int: + print(command_params[0]) + return ESCExecution.RC_OK diff --git a/game/rooms/room10/esc/room10.esc b/game/rooms/room10/esc/room10.esc index a7f49ff2..4b49d544 100644 --- a/game/rooms/room10/esc/room10.esc +++ b/game/rooms/room10/esc/room10.esc @@ -1,5 +1,6 @@ :setup +print "This is room 10" > [eq ESC_LAST_SCENE room9] teleport player r10_l_exit