Skip to content

Use arrays in conditionals #994

@georgespatton

Description

@georgespatton

I would like to suggest a feature to handle arrays inside Dialogue Manager. It appears that strings/bool/int/float etc are supported:

https://github.com/nathanhoad/godot_dialogue_manager/blob/main/docs/Conditions_Mutations.md

but if the type of the global state is an array, handle it inside Dialogue Manager. An example of this would be:

if "apples" in SomeGlobal.some_array_property
Nathan: I have apples
elif "oranges" in SomeGlobal.some_array_property
Nathan: I have oranges too.
elif "grapes" in SomeGlobal.some_array_property
Nathan: I have grapes as well.
else
Nathan: I have no fruit.

This allows for more complex conditionals and will allow the SomeGlobal property list to stay concise as we can now load multiple properties into a single SomeGlobal.some_array_property instead of enumerating them into multiple properties.

I don't think you have to implement all the methods in the Godot Array class https://docs.godotengine.org/en/stable/classes/class_array.html

but a simple "in" function or ".has()" would be a good starting point and would satisfy this feature request. I am currently using many SomeGlobal.some_property which bloats my SomeGlobal global variable set.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions