My first “hack” into the AGM APIs.
Visual Script debugging seems like it’s already going to be messy, and adding PrintMessageToConsole
actions takes fiddly time to do https://guild.rpgmakerofficial.com/t/topic/197
What would be better is option right on the VisualScriptAction
to enable that debugging.
I am not asking for it be added for 1.0.6 or 1.0.7. This still need refinement as an idea. Looking into what other debugging features can be done of Visual Scripting.
This was just going to be a picture showing where the options should appear, but the tool-coder took over with a demonstration script.
GitHub Gist: Action Game Marker, Visual Script debugging, GDScript tools .
Original Script
# debug_vsa.gd
extends VisualScriptAction
@export var print_message_to_console : bool = true :
set(v):
if v:
_add_print_action.call_deferred()
else:
_remove_print_action.call_deferred()
print_message_to_console = v
var _print_action : Actions = PrintMessageToConsole.new()
var _print_action_at_index : int
func _init() -> void:
_print_action.print_message = visual_script_node_title + " entered"
func _add_print_action() -> void:
other_actions.append(_print_action)
_print_action_at_index = other_actions.size() - 1
func _remove_print_action() -> void:
if other_actions.size() > 0 and other_actions[_print_action_at_index] == _print_action:
other_actions.remove_at(_print_action_at_index)
(.gd scripts can’t be uploaded as file type currently)
The runtime _remove_print_action()
of this is untested.
For advanced users familiar with Godot scripting, to attach this script to an existing State in a VisualScript
(VS)
- create the
debug_vsa.gd
the FileSystem - this should extend
VisualScriptAction
, if you don’t… - copy the whole script above
- create or use an existing VS
- select the
Initial State
- in the Inspector scroll all the way to bottom 'RefCounted` header
- assign by load, quick load, or drag
debug_vsa.gd
You should now have a checked Boolean for “Print Message to Console”. In a test run, you should get an Output message with the State’s name and “entered.”
What would be really helpful in debugging would be something like the SignalVisualizer plugin for Godot. To visually track which Links and States are triggering.
Beyond debugging, keep in mind that extending VisualScriptAction
or VisualScriptActionLink
doesn’t provide entry point to the actual Visual Script interpreter. These are just Resource
s that AGM will use to do pre-coded condition checks, and execute pre-scripted code.
They could allow custom GDScript access to easily modify select Links and States, their Conditions
and Actions
. I don’t know the current process safety, so consider using call_deferred
and set_deferred
from the _physics_process
to allow AGM to reference and modify all the VS resources before you alter them.