I have a method which is meant to fetch a String from a dictionary. This is called inside of the emit_signal() method and ideally should allow emit_signal to send various signals stored in the dictionary. It didn’t work as a standard string and I saw also that it may need to be a StringName to work, but so far no luck there either. I’ve confirmed that my own method called get_upgrade_signal_by_id() is returning the proper values, but I’ve had no luck getting the emit signal to do what I’m expecting.
It looks like this: Events.emit_signal(StringName(get_upgrade_signal_by_id(upgrade_id)))
So, let’s say you have a tool_upgraded as a signal in Events.
What you are saying is that Events.emit_signal("tool_upgraded") works fine but if you return it in get_upgrade_signal_by_id() it does not work?
Try doing something like:
var signal_name = get_upgrade_by_id(...)
var result = Events.emit_signal(signal_name)
print("Signal %s emitted: %s" % [signal_name, error_string(result)])
signal name: item_purchased
Signal item_purchased emitted: OK
UPDATE:
This works for emitting the signal. I found I had another problem that was unrelated that was preventing things from working properly on the Events script. Thanks for your help!