-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Add ability to pass dialogic variables as args to dialogic event signals #2404
Comments
This sounds like a good addition, however most likely what it will mean is the syntax will be: In a very similar direction it would probably be really useful to allow variables/expressions as any paramter value in shortcode events, e.g.:
|
Then the use code would look something like this:
Changesaddons/dialogic/Editor/Events/Fields/field_flex_value.gd
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
The idea is to add the ability to use Dialogic variables as args for event signals instead of directly using values or "magic numbers" for better readability & maintenance.
Describe the solution you'd like
The ability to pass Dialogic variables as args to event signals, for example in the text editor:
[signal arg=foo.bar.id]
or for dictionaries, something like:
[signal arg_type="dict" arg="{"id":foo.bar.id}"]
where
foo.bar.id
is an int variable to be passed as an arg to the signal..Describe alternatives you've considered
A working alternative solution that was suggested was to use:
[signal arg_type="dict" arg="{"id":"foo.bar.id"}"]
and receive the signal using:
which is one method to avoid using "magic numbers", although there is some overhead.
Additional context
In my use case, I was trying to create an RPG with a system where player can obtain items through dialogue and at certain points, I wanted signals to be emitted when an item is obtained, and to identify what item was obtained.
The idea was to pass an item ID to the signal, and let the receiver handle the rest, but that would require manually typing in the item ID into the Dialogic text editor, effectively making it a magic number.
Another issue was that in the scenario that the item ID(s) changed, then that could potentially cause issues with all the places where that ID was used. Using a variable would solve this as we could simply reference the variable, and if that value needs to be changed in the future, only the value of the single variable would need to be changed, making readability & maintenance significantly easier.
The text was updated successfully, but these errors were encountered: