I want to be able to dynamically set the img path in a BBCode in my dialogue. Currently, I’m using an array of strings, and each member is a phrase. In some of these phrases, I will display an icon for input (keyboard, gamepad, etc).
So, for example:
Use [img]res://assets/inputs/keyboard_mouse/keyboard_s.png[/img] and [img]res://assets/inputs/keyboard_mouse/keyboard_x.png[/img] buttons to rotate direction.
It will include the icons for keyboard s and x, respectively, in the text displayed. But I need this to be dynamically set because I want to let the player choose which input it will use.
This way, if they decide to change the button for a specific action, the phrase will display the correct icon. How can I do that with BBCode?
In the Content array I have each phrase from a speaker. In this screenshot, you can see me using the [img] with the path to the input button. I would like to try to keep this structure.
I loop through all the dialogue content and display them in the dialogue box.
Allowing users to change control bindings at runtime adds quite a bit of complexity to the project.
If I were you, I would first try to make the control binding changing before I make the dynamic dialogues. I believe working on this might shed more light on how to make your dialogues react to the dynamic bindings.
In case you still have issues then, let me know and we can try to help you achieve your goal.