P
Pyxus
Guest
In all honestly, I'm beginning to feel like I should perhaps drop this "project" until i'm more proficient at the game maker language. Also, I apologize if the title is misleading cause i'm not exactly sure how to explain my problem but i'll try since I feel as if i'm missing something annoyingly simple, which is a tendency for me... especially when trying to learn something new. But I digress... In short I wanted to create a sort of twitch game bot where each viewer can get an avatar that appears on stream. I found a twitch irc script on the game maker market that works perfectly well, in fact everything works well as far as I can tell. When the "!join" command is used in chat a player object is created and the name of the person who used the command appears on top of their head. My issue is I need to store the viewer's name some how so that the viewer can't spam the command and make multiple clones.
So ideally I thought the best way to do this was to have the variable sender (which is the person using the command) added to the list players. sender should return a string each time (i.e the player's name) so each time the command is run the player/viewer is added to the player list. My essential questions are, is there a way to check if the player is already on the list first, is there a better way to be doing this, and is there a way to draw all the players in the list (only because I want to visually see if players are being added to the list"
If I sounded confusing i'll gladly elaborate, and just so you're aware this isn't a serious project. I literally saw the script in the market and thought "I wonder if I can do xyz" so it's all for the sake of learning
*left out some stuff from the networking event since it isn't important(I don't think), but if you do want to see anything, again, I'll gladly do so!
obj_irc_controller
obj_irc_controller
[/B]
So ideally I thought the best way to do this was to have the variable sender (which is the person using the command) added to the list players. sender should return a string each time (i.e the player's name) so each time the command is run the player/viewer is added to the player list. My essential questions are, is there a way to check if the player is already on the list first, is there a better way to be doing this, and is there a way to draw all the players in the list (only because I want to visually see if players are being added to the list"
If I sounded confusing i'll gladly elaborate, and just so you're aware this isn't a serious project. I literally saw the script in the market and thought "I wonder if I can do xyz" so it's all for the sake of learning
*left out some stuff from the networking event since it isn't important(I don't think), but if you do want to see anything, again, I'll gladly do so!
obj_irc_controller
Code:
----Create Event-----
///Set Channel & Bot
scr_saveinfo();
scr_loadinfo();
irc_create_socket("irc.twitch.tv", 6667, username, oauth, channel, true);
background_colour = colour;
alarm[0] = 1
//Organize Players
randomize();
players = ds_list_create();
new_player = ""
-----Networking Event-----
if msg = "!join"
{
new_player = sender
newObj = instance_create(random(400), random(400), obj_player);
newObj.image_index = round(random(8));
ds_list_add(players, sender);
irc_send_message("@" + sender + " is in the game");
}
else
{
//Do Nothing
}
Code:
-----Create Event-----
///Initialize Avatar
//Avatar Customization
image_speed = 0;
face_expression = irandom(6);
name = obj_irc_controller.new_player;
hat = 0;
-----Draw Event-----
draw_self();
draw_text(x-25, y-35, name); //Draw Name
draw_sprite(spr_expressions, face_expression, x, y); //Draw Face
[B]