Skip to content

Variable Does not Update/Save in Variables Tab #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Slick9000 opened this issue Nov 19, 2024 · 2 comments
Closed

Variable Does not Update/Save in Variables Tab #2484

Slick9000 opened this issue Nov 19, 2024 · 2 comments

Comments

@Slick9000
Copy link

The problem

Describe the bug
I apologize if this is known/intentional, but I searched the docs and project issues and found no solution. To my knowledge, in order to use a variable in timelines, the variable must be made in the Variables tab of Dialogic. No changes I make to the variable are being saved in the Variables tab.

To Reproduce

  1. Create a variable, e.g in my case, learnt_movement
  2. Set learnt_movement to true. then check the Variables tab. It is not updated in the Variables tab. Type does not seem to matter for the variable.
  3. If you print the value in the timeline or print(Dialogic.VAR.learnt_movement) in gdscript, you'll see the value did change, but only for the currently running game. It does not update in the Variables tab and thus does not persist on future launches.

Expected behavior
I figured that when I set learnt_movement = true, that I would open the Variables tab and see a checkmark that the bool has been set to true,.

Screenshots
A screenshot of the variable defined within the Variables tab:
image

A screenshot of a timeline which updates the bool variable to be true, and then prints the new value:
image

A screenshot of the timeline's output after running (learnt_movement is now true, so it is somehow updating):
image

And finally, a screenshot of the Variable's tab after "updating" the variable in the timeline:
image

Again, I am not sure if this is intentional and variables aren't really meant to be used this way.

System (please complete the following information):

  • OS: Windows 10 Home 22H2
  • Godot Version: Godot 4.4 dev 4
  • Dialogic Version: 2.0 Alpha-16

Solutions
Unknown

Workaround
Unknown

Possible fixes
Unknown

@Jowan-Spooner
Copy link
Member

This is not how this works. The variables tab allows you to ADD variables and set their STARTING value. If they are changed during gameplay that won't be shown in editor.

@Slick9000
Copy link
Author

Slick9000 commented Nov 19, 2024

Thank you very much for the clarification. What I chose to do is save each variable in the "extra_info" dictionary, and autoload it back to the Dialogic variable when the game starts.

Saving:

func save_game(slot_name: String):
    var extra_info = {
        "learnt_battle": Dialogic.VAR.learnt_battle
    }

    # save the game state + the extra info
    Dialogic.Save.save(slot_name, false, Dialogic.Save.ThumbnailMode.TAKE_AND_STORE, extra_info)

Loading:

func load_game(slot_name: String):
	
    # check for save slot, and load the game
    if Dialogic.Save.has_slot(slot_name):
		
        var slot_info = Dialogic.Save.get_slot_info(slot_name)

        Dialogic.VAR.learnt_battle = slot_info.get("learnt_battle", Dialogic.VAR.learnt_battle)

    else:
		
        push_warning("No game slot available to load (slot ", slot_name, ")")

On ready, I have this:

func _ready():

	GameManager.load_game("0") 
	
        # blank timeline
	Dialogic.start("startup") 

Also similar to #2354 by @phantomdesvin I'm experiencing a shader compilation stutter with dialogue and have to run a blank timeline "startup" on ready.

Overall, this works for me. I appreciate the help very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants