Emitters not emitting? #5

Closed
opened 2020-09-14 07:03:08 +02:00 by HeroicNate · 6 comments
HeroicNate commented 2020-09-14 07:03:08 +02:00 (Migrated from github.com)

First of all this is awesome! I've got it mostly working though I don't really know how the emotes are suppose to work.

The issue I'm having is the signals. I've been searching through the code but can't seem to find if there was some sort of emitter on off code. If I build my own emitters they work, but I can't tap into the ones already in the code. I try connecting to them but they never seem to fire. Any suggestions?

First of all this is awesome! I've got it mostly working though I don't really know how the emotes are suppose to work. The issue I'm having is the signals. I've been searching through the code but can't seem to find if there was some sort of emitter on off code. If I build my own emitters they work, but I can't tap into the ones already in the code. I try connecting to them but they never seem to fire. Any suggestions?
issork commented 2020-09-14 18:11:59 +02:00 (Migrated from github.com)

I'll look into it.
As long as you set 'get_images' to true, emotes and badges should be cached in RAM. When also enabling 'disk_cache', emotes and badges will also be stored to disk so that you don't have to download them again. Don't forget to specify a cache path as well if you enable the disk cache.

The procedure would then be;

  1. Listen to the 'chat_message' signal
  2. Check if the message has emotes in the "emotes" tag in the 'sender_data'
  3. Check if the emote has been downloaded yet ('get_emote()' in 'image_cache' will return null if it hasn't)
    • if it hasn't been downloaded yet, remember its id and then wait for the emote_downloaded signal to emit with that id
  4. Do whatever you want with the emote

The process is still cumbersome now that I look into it, will probably do some more adjustments.

Currently it doesn't seem to work at all.

Thanks a lot for bringing this to my attention.

I'll look into it. As long as you set '**get_images**' to true, emotes and badges should be cached in RAM. When also enabling '**disk_cache'**, emotes and badges will also be stored to disk so that you don't have to download them again. Don't forget to specify a cache path as well if you enable the disk cache. The procedure would then be; 1. Listen to the '**chat_message**' signal 2. Check if the message has emotes in the "emotes" tag in the '**sender_data**' 3. Check if the emote has been downloaded yet ('**get_emote()**' in 'image_cache' will return null if it hasn't) - if it hasn't been downloaded yet, remember its id and then wait for the emote_downloaded signal to emit with that id 4. Do whatever you want with the emote The process is still cumbersome now that I look into it, will probably do some more adjustments. Currently it doesn't seem to work at all. Thanks a lot for bringing this to my attention.
HeroicNate commented 2020-09-14 18:30:10 +02:00 (Migrated from github.com)

Ok. I hadn't tried to use the emotes yet but maybe the issue is related to the emitters not firing.

I was not able to detect the emitters at all for some reason, so listening for "chat_message" would never activate.

Ok. I hadn't tried to use the emotes yet but maybe the issue is related to the emitters not firing. I was not able to detect the emitters at all for some reason, so listening for "chat_message" would never activate.
issork commented 2020-09-14 18:34:03 +02:00 (Migrated from github.com)

Other signals do work for me. How are your currently using them?

Other signals do work for me. How are your currently using them?
HeroicNate commented 2020-09-16 23:33:01 +02:00 (Migrated from github.com)

At the moment all I'm trying to do it respond to the signal

func _on_Gift_chat_message(sender_data, message, channel): print("chatted")

or even directly in the script itself:
func _on_chat_message(sender_data, message, channel): print("chatted")

It never fires, but the function processing the message does activate because I can put all the functionality I want right into it.

At the moment all I'm trying to do it respond to the signal `func _on_Gift_chat_message(sender_data, message, channel): print("chatted")` or even directly in the script itself: `func _on_chat_message(sender_data, message, channel): print("chatted")` It never fires, but the function processing the message does activate because I can put all the functionality I want right into it.
issork commented 2020-09-17 14:44:18 +02:00 (Migrated from github.com)

But are you connecting the signal to the function properly?

Edit: I think I know why you are having trouble. Currently, the 'channel' parameter in the signal is unused (I forgot to remove it), so your function might only work if you only accept 2 params. The channel is contained in the sender_data. The debugger should also give a hint that this might be the issue;

emit_signal: Error calling method from signal 'chat_message': 'Node(Gift.gd)::chat_message': Method expected 3 arguments, but called with 2.

To fix it, simply only declare your function with 2 params:

func _ready() -> void:
	connect_to_twitch()
	yield(self, "twitch_connected")
	authenticate_oauth("#####", "oauth:######")
	if(yield(self, "login_attempt") == false):
		print("Invalid username or token.")
		return
	join_channel("#####")

	connect("chat_message", self, "chat_message")

func chat_message(sender_data, message):
	print("message received")

~~But are you connecting the signal to the function properly?~~ Edit: I think I know why you are having trouble. Currently, the 'channel' parameter in the signal is unused (I forgot to remove it), so your function might only work if you only accept 2 params. The channel is contained in the sender_data. The debugger should also give a hint that this might be the issue; `emit_signal: Error calling method from signal 'chat_message': 'Node(Gift.gd)::chat_message': Method expected 3 arguments, but called with 2.` To fix it, simply only declare your function with 2 params: ```gdscript func _ready() -> void: connect_to_twitch() yield(self, "twitch_connected") authenticate_oauth("#####", "oauth:######") if(yield(self, "login_attempt") == false): print("Invalid username or token.") return join_channel("#####") connect("chat_message", self, "chat_message") func chat_message(sender_data, message): print("message received") ```
HeroicNate commented 2020-09-17 17:49:28 +02:00 (Migrated from github.com)

That solved it.

To create the signal listener I did it in the Node signal menu:
https://cdn.discordapp.com/attachments/663542917540872215/756178926128332840/unknown.png

That solved it. To create the signal listener I did it in the Node signal menu: https://cdn.discordapp.com/attachments/663542917540872215/756178926128332840/unknown.png
Sign in to join this conversation.
No description provided.