Skip to content
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

Setting variables in dictionaries or arrays not working. #2195

Closed
Pynthare opened this issue Apr 20, 2024 · 3 comments
Closed

Setting variables in dictionaries or arrays not working. #2195

Pynthare opened this issue Apr 20, 2024 · 3 comments

Comments

@Pynthare
Copy link

The problem

Describe the bug
I am using a singleton dictionary to store the information for each quest that is currently in my game. I can fetch information from this dictionary without problem e.g: "if {Quest.quests["shipHullRepairPart1"].status} == 0:" and it works flawlessly.

However, when tring to SET a variable e.g: "set {Quest.quests["shipHullRepairPart1"].status} = 1", dialogic just trows a tantrum in the output log:
Dialogic: Expression failed to parse: Expected expression.
[Dialogic] Failed parsing variable/expression ''.

This also appears when tring to use other parts, like using a variable to minus itself using another variable:
image
If I look in the timeline files this is not even saved correcly:
"set {{Itemresource.inventoryResources[0].amountOwned}} -= {}"

To Reproduce
Steps to reproduce the behavior:
Try setting any variable in a dictionary or .

Expected behavior
I would expect dialogic to set the variables and save the entered variables.

System (please complete the following information):

  • OS: Windows 11
  • Godot Version: 4.2.1
  • Dialogic Version: 2.0 alpha 13

Am I missing something supidly obvious?

@CakeVR
Copy link
Collaborator

CakeVR commented Apr 20, 2024

Hello, please try again with the latest commit on the main branch.

@Pynthare
Copy link
Author

Pynthare commented Apr 20, 2024

Hi, thank you for your response. I tried updating to the latest commit, and sadly no change. I did however try to force the entry of the variable by adding it into the timeline-file manualy with code. This gave the error:
"[Dialogic] Tried setting non-existant variable 'Itemresource.inventoryResources[0].amountOwned'." which leads me to belive dialogic does not recognize that this is acctualy a autoloaded gd-file for some reason.

I also wanted to add that yes, this code works from any other gd-script in the game and I have spellchecked it anyway :)

@Jowan-Spooner
Copy link
Collaborator

Hey @Pynthare The access to arrays and dictionaries is for now limited to this syntax array["my_entry"] while array.my_entry is not supported. This is simply because noone had the time to implment that, as it makes the code much more complex (because it's harder to differentiate from member access of an object).

So you should be able to do what you want with: {Itemresource.inventoryResource[0]["amountOwned"]}

I have created a new separate feature request (#2197) for that syntax so we can track the missing functionality there.

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

No branches or pull requests

3 participants