• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM [Solved] Twitch overlay game

C

CornerLord

Guest
Hello everyone!
I'm currently trying to create Twitch overlay game for my streams, but i can't figure out how I could make players join it automatically when they enter to my channel. Now viewers have to type "!join" to join but it would be awesome if I could make automatic. :)

I'm using this project for my game: https://github.com/kbjwes77/GMTwitch

I think this is the way to make that happen. Connect to https://tmi.twitch.tv/group/user/USERNAMEHERE/chatters, get all the names of the viewers and put them into a list. For example every 3mins check names again and create new list and compare it to the previous list and add new players to game. Clear the lists when exiting.

I'm not familiar with stuff like this so it would be nice if you could give me some code to help me to understand. Thanks for help! :)
 
Last edited by a moderator:
C

CornerLord

Guest
Update:
Now I've found video tutorial about http request from heartbeast and using that I tried to get viewers from http://tmi.twitch.tv/group/user/cornerlord/chatters.
Here is my current code on test project:
Press space:
Code:
http_get("http://tmi.twitch.tv/group/user/cornerlord/chatters");
HTTP
Code:
/// Get answer
var json = async_load[? "result"];

// Just to see when this event is on :P
show_message("Http event on!");

// Convert the json to a ds_map
var map = json_decode(json);
show_message(map);

if(map = -1) {
    show_message("Invalid result!");
    exit;
}

if(ds_map_exists(map, "viewers")){
    var chatters = map[? "viewers"];
    show_message("Chatters: " + string(chatters));
}
But so far I've only got numbers 3 from show_message(map) and 4 from the second show_message. I think they are error codes but I can't find anywhere what they mean.

Also if I use "chatter_count" instead of "viewers" it works and returns the right value.
 
Last edited by a moderator:
Top