dialogic-godot / dialogic

💬 Create Dialogs, Visual Novels, RPGs, and manage Characters with Godot to create your Game!
https://dialogic.pro
MIT License
3.35k stars 206 forks source link

Dialogic 2 - Unable to set bool variable to false #2171

Closed ImJustHereForTheCode closed 1 month ago

ImJustHereForTheCode commented 1 month ago

The problem

Describe the bug Unable to set a boolean variable to false. Instead I get the error "Dialogic: Set Variable event failed because one value wasn't set!" This is caused by a bug in the if check on line 54 of event_variable.gd:

if value and orig != null:

If you are setting the variable to false, then value is set to false which causes the if check to always evaluate to false. Assuming the if check is trying to ensure value has been set, the check should be:

if value != null and orig != null:

Have changed the if check to check 'value != null' and verified bool variables can now be set to false.

To Reproduce Steps to reproduce the behavior:

  1. Create new variable of type bool (default value can be false or true)
  2. Create new timeline
  3. Add a set event that sets the variable from step 1 to false
  4. Run the timeline

Example timeline: set {fail_variable} = false

Expected behavior A set event on a bool variable setting the value to false will set the variable value to false

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

Solutions

Workaround Have manually changed the if check on line 54 of event_variable.gd to: if value != null and orig != null:

Possible fixes Change line 54 of event_variable.gd to: if value != null and orig != null:

CakeVR commented 1 month ago

Hello, please try using the latest commit on the main branch.

If you need help to get this version, here is our documentation about it: https://docs.dialogic.pro/getting-started.html#-how-to-install-the-latest-wip-version-

ImJustHereForTheCode commented 1 month ago

Confirmed unable to reproduce with most recent commit, thanks CakeVR