From 3f80c38867c3347b9decf0ac76acfb1f08059406 Mon Sep 17 00:00:00 2001 From: Adrien Tremblay Date: Sun, 19 Oct 2025 19:17:16 -0400 Subject: [PATCH 1/3] Added additional case in Event Variable _execute() function for string addition assignment --- addons/dialogic/Modules/Variable/event_variable.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/dialogic/Modules/Variable/event_variable.gd b/addons/dialogic/Modules/Variable/event_variable.gd index f23c347db..0b29271cb 100644 --- a/addons/dialogic/Modules/Variable/event_variable.gd +++ b/addons/dialogic/Modules/Variable/event_variable.gd @@ -89,14 +89,14 @@ func _execute() -> void: VarValueType.NUMBER, VarValueType.BOOL, VarValueType.EXPRESSION, VarValueType.RANDOM_NUMBER: interpreted_value = dialogic.VAR.get_variable(str(value)) - if operation != Operations.SET and (not str(original_value).is_valid_float() or not str(interpreted_value).is_valid_float()): + if operation == Operations.SET: + result = interpreted_value + elif (typeof(original_value) == Variant.Type.TYPE_STRING and _value_type == VarValueType.STRING and interpreted_value and operation == Operations.ADD): + result = original_value + interpreted_value + elif not str(original_value).is_valid_float() or not str(interpreted_value).is_valid_float(): printerr("[Dialogic] Set Variable event failed because one value wasn't a float! [", original_value, ", ",interpreted_value,"]") finish() return - - if operation == Operations.SET: - result = interpreted_value - else: original_value = float(original_value) interpreted_value = float(interpreted_value) From b3d559774fa67855b0970f4dca92f54736904d00 Mon Sep 17 00:00:00 2001 From: Adrien Tremblay Date: Sun, 19 Oct 2025 19:58:10 -0400 Subject: [PATCH 2/3] Updated the editor warnings not to trigger if trying to add two strings together --- addons/dialogic/Modules/Variable/event_variable.gd | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/dialogic/Modules/Variable/event_variable.gd b/addons/dialogic/Modules/Variable/event_variable.gd index 0b29271cb..26b977b63 100644 --- a/addons/dialogic/Modules/Variable/event_variable.gd +++ b/addons/dialogic/Modules/Variable/event_variable.gd @@ -341,18 +341,15 @@ func _on_variable_editor_pressed() -> void: func update_editor_warning() -> void: - if _value_type == VarValueType.STRING and operation != Operations.SET: + if _value_type == VarValueType.STRING and operation != Operations.SET and operation != Operations.ADD: ui_update_warning.emit('You cannot do this operation with a string!') elif operation != Operations.SET: var type := DialogicUtil.get_variable_type(name) if not type in [DialogicUtil.VarTypes.INT, DialogicUtil.VarTypes.FLOAT, DialogicUtil.VarTypes.ANY]: - ui_update_warning.emit('The selected variable is not a number!') - else: - ui_update_warning.emit('') - else: - ui_update_warning.emit('') - - + if not (type == DialogicUtil.VarTypes.STRING and operation == Operations.ADD and _value_type == VarValueType.STRING): + ui_update_warning.emit('The selected variable is not a number!') + return + ui_update_warning.emit('') ####################### CODE COMPLETION ######################################## ################################################################################ From 42c8face9b878c06f328a61e9d2c4d0323694afa Mon Sep 17 00:00:00 2001 From: Adrien Tremblay Date: Sun, 19 Oct 2025 20:02:35 -0400 Subject: [PATCH 3/3] Use DialogicUtil.get_variable_name() to get the type of the original variable --- addons/dialogic/Modules/Variable/event_variable.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dialogic/Modules/Variable/event_variable.gd b/addons/dialogic/Modules/Variable/event_variable.gd index 26b977b63..c812d4eff 100644 --- a/addons/dialogic/Modules/Variable/event_variable.gd +++ b/addons/dialogic/Modules/Variable/event_variable.gd @@ -91,7 +91,7 @@ func _execute() -> void: if operation == Operations.SET: result = interpreted_value - elif (typeof(original_value) == Variant.Type.TYPE_STRING and _value_type == VarValueType.STRING and interpreted_value and operation == Operations.ADD): + elif (DialogicUtil.get_variable_type(name) == DialogicUtil.VarTypes.STRING and _value_type == VarValueType.STRING and interpreted_value and operation == Operations.ADD): result = original_value + interpreted_value elif not str(original_value).is_valid_float() or not str(interpreted_value).is_valid_float(): printerr("[Dialogic] Set Variable event failed because one value wasn't a float! [", original_value, ", ",interpreted_value,"]")