What would be the best approach to local dialog functions?

I want to make a dialogue module script that can also run functions rather than just displaying plain text. For example, If I want to check the players inventory when a certain reply is said, It references a function in that same script. When the dialogue wrapper requires the specific dialogue script and parses the reply, it runs the specified function.


^ references the function it wants to run below

^ the actual function
image
^ script from the dialogue wrapper script that runs the function.

I feel as if this is kind of limiting, more complex functions would not really work.. For example, if I wanted to create or edit reply buttons based on what is in the player’s inventory, I dont think I can do that with this method. An idea I had was to put more complex functions in the dialogue wrapper itself, but I kind of disregarded that. I want to know what would be the best approach to this…

You could make it accept both strings and functions, so you can keep simple and more complex functions. The script should only check whether it is a function or a string.

I did something like this for an enemy, I pass it the parameters it might need and, if it’s something quick, I just pass it a string.