You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"}"]
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:
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: