0 votes

Hi, so I have some code that will select some buttons in a group and when that button is pressed stuff happen, but the hting is, I have a dictionary that the keys have the names of the buttons. So when I try to edit the dictionary with the button using the code from before, it doesn't get the name it gets the id of the button

here is my code

func _ready(): 
for button in get_tree().get_nodes_in_group("Wheats"):
    button.connect("pressed", self, "_some_button_pressed", [button])

func _some_button_pressed(button):
    #the "button" is the id of the said button, not the name
    print(Main.WheatDict)
    Main.WheatDict[button] = true
    yield(get_tree(). create_timer(Main.WheatTimer), "timeout")
    button.disabled = false
    Main.WheatDict[button] = false
Godot version 3.5.1
in Engine by (24 points)

Oh, I'm sorry I misunderstood. To be honest, I don't know how to do that

If it's in Github, just provide the link to the repo.

Otherwise, you'd need to:

  • Zip up the Godot project folder
  • Upload it to an online host (Google Drive, Dropbox, OneDrive, ...)
  • Provide a link to the file.

OK, I see that you're using the button name as the Dict key now. With that, is this working as expected?

It actually is working!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.