Hey. I have a problem to get the value of a key entry in my dictionary using a for loop to check all entrys.

onready var items = get_tree().get_nodes_in_group("item") var vitem = {} func _ready(): set_fixed_process(true) func _fixed_process(delta): for i in items: var name = i.get_name() vitem = {name:1} for i in vitem: if i.value() == 1: #################################### print(i) var pic = get_node("items"+str(i)) pic.set_pos(Vector2(0,0)) the line with the quotes doesn't work. i also tried vitem.i, but godot searches for a entry named "i" in the dictionary. does anybody know how to solve this?

thank you very much!

You access values in a dictionary with brackets. dictionary[key]. If the key is a string without spaces you can also use the dot notation: dictionary.key. You should read the documentation. You can also look up Python documentation (or basically any other language with dictionaries afaik) for more details on when each method can be used.

What is this value() function you're using? I couldn't find it in the docs, is that your own function? I don't know what your code is supposed to do or I would rewrite it for you.

6 years later