i got some guys that can level up some skills

need send the key of the dictionary when level up but im sending the values instead

var skills = {
	"energy_consumption": {"level":0, "experience":0, "working_on": false},
	"food_processing": {"level":0, "experience":0, "working_on": false},
	"ore_extraction": {"level":0, "experience":0, "working_on": false},
	"ore_smelting": {"level":0, "experience":0, "working_on": false},
	# and so on
	}


func onTicDay(): # every day
	if has_job: # if the guy is employed
		for skill in skills.values():
			if skill["working_on"] : # check what skill is he doing
				skill.experience += 1 # add 1 point exp to that skill

		for skill in skills.values(): 
			if skill["experience"] == 100: # if has enough experience in the skill
				skill.level += 1 # add level to the skill

				print("skill level up: ", skill)
				levelUp(skill, skill.level)

prints this skill level up: {experience:100, level:1, working_on:True}1

but i would need send the [key] and level (only the leveled up skill) like this ore_extraction 1

So values() gets the values() in the Dictionary. The values are {"level":0, "experience":0, "working_on": false}, and so on, which is another Dictionary. You can use keys(), which will get the keys() instead, which is what I think you want (which will return "energy_consumption" and so on).

for skill in skills.keys(): 
    print(skill) # energy_consumption
    var data = skills[skill]
    print(data) # {"level":0, "experience":0, "working_on": false}
    data["level"] += 1
    var level = data["level"]
    print(level) # 1

not exactly...

i need give exp only to the skill (key) with the workin_on(value)

and if that key is leveled up, send the info of that key only

in other words, need to check in what bussiness is the guy working, level up that skilll and send the signal.

Yes, you can do that with the code I showed. That was just an example, you can access or modify any key or value by the name.

ok I was confused myself, ty

for skill in skills.keys():
	var values = skills[skill]
	if values["working_on"]: # if the guy working the skill
		values["experience"] += 1 # add exp to the skill
		if values["experience"] == 10: # if has enough exp
			values["level"] += 1 # add level
			
			print("LEVEL UP: " , skill, ": ", values["level"])
			levelUp(skill,values["level"]) # send the signal to the factory

edit. google translate works meh

a year later