VisualScriptAction Debugger, Improvement Proposal

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)

  1. create the debug_vsa.gd the FileSystem
  2. this should extend VisualScriptAction , if you don’t…
  3. copy the whole script above
  4. create or use an existing VS
  5. select the Initial State
  6. in the Inspector scroll all the way to bottom 'RefCounted` header
  7. 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 Resources 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.

「いいね!」 2

Added a GitHub Gist link that will receive updates as I test options.

The use of PrintMessagetoConsole isn’t elegant. It doesn’t have enough information for a serious trace.

Debugging output should be able to tell not only if something is wrong, but where exactly it’s going wrong (GameObject instance & Link/State). Or close enough to find the trouble spot nearby.

Probably a better solution is to have Links register themselves and their Conditions with a central Debugger. This would let a Debugger be aware of what needs to be monitored. At a minimum a GUI could be made to investigate which Links should have triggered. Based purely off observable parameters elsewhere.

「いいね!」 1