diff --git a/classes/deck/nodes/obs_websocket_generic_request.gd b/classes/deck/nodes/obs_websocket_generic_request.gd new file mode 100644 index 0000000..e13ca8b --- /dev/null +++ b/classes/deck/nodes/obs_websocket_generic_request.gd @@ -0,0 +1,59 @@ +extends DeckNode + +var noobs: NoOBSWS + + +func _init() -> void: + name = "OBS WS Generic Request" + node_type = "obs_generic_request" + description = "" + category = "obs" + + props_to_serialize = [] + + add_virtual_port( + DeckType.Types.STRING, + "Request type", + "field" + ) + + add_virtual_port( + DeckType.Types.STRING, + "Request data", + "codeblock" + ) + + add_output_port( + DeckType.Types.DICTIONARY, + "Result" + ) + + add_virtual_port( + DeckType.Types.BOOL, + "Request", + "button" + ) + + +func _receive(on_virtual_port: int, data: Variant, extra_data: Array = []) -> void: + if on_virtual_port != 2: + return + + if noobs == null: + noobs = Connections.obs_websocket + + print(get_virtual_ports()[1].value) + var e: Dictionary = type_convert(get_virtual_ports()[1].value, TYPE_DICTIONARY) + print(e) + if typeof(e) != TYPE_DICTIONARY: + return + + var req := noobs.make_generic_request( + get_virtual_ports()[0].value, + str_to_var(get_virtual_ports()[1].value) + ) + + await req.response_received + + var d := req.message.get_data() + send(0, d) diff --git a/classes/deck/nodes/print.gd b/classes/deck/nodes/print.gd index 7088714..f54e308 100644 --- a/classes/deck/nodes/print.gd +++ b/classes/deck/nodes/print.gd @@ -12,8 +12,8 @@ func _init() -> void: category = "general" add_input_port( - DeckType.Types.STRING, - "Text to print", + DeckType.Types.ANY, + "Data to print", "field" ) @@ -36,11 +36,11 @@ func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void var data_to_print if request_value(0) != null: - data_to_print = request_value(0) + data_to_print = str(request_value(0)) elif get_input_ports()[0].value_callback.get_object() && get_input_ports()[0].value_callback.call() != "": - data_to_print = get_input_ports()[0].value_callback.call() + data_to_print = str(get_input_ports()[0].value_callback.call()) else: - data_to_print = data + data_to_print = str(data) times_activated += 1