Running string line as a command

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By protofan
:warning: Old Version Published before Godot 3 was released.

Currently I need to find a way to do 2 things:

  1. I need to get a custom value out of dictionary. I have a dialogue.json which contains text somewhat like this:
Language->Dialogues->Events->Lines->Text + Other values

to get it I use something like this:

line_to_use=str("dictionary.+"str(language)"+.dialogue.+"str(event)"+.line"+str(number)+".text")
textfield.set_text(line_to_use)

But it obviously doesnt work. How can I convert this string to actual command?

  1. I need to do the same thing as mentioned above, but use the string as an actual command. Besides text, Line can contain something system would need to do when this string appears like “score=score+1”. I need to somehow translate data from dictionary to function.