Author | Message | Time |
---|---|---|
Minor | Using Microsoft Visual C++ Compiler. Is there an easy way to check if a person is in a game or not by using a specific Idle. For Example: If you type to bot "info Username" and bot goes through the whois and then Send("/msg %s %s is Currently in Game: %s\r\n",Master,User,Game); or Send("/msg %s %s is Not in a Game.\r\n",Master,User); **Not in specific indentifiers but you get the point, i hope*** Can someone help me on this subject please. | April 13, 2004, 6:36 AM |
LoRd | /whois <user> and/or if the user is on your friends list, /friends list. | April 13, 2004, 8:09 AM |
Minor | I ment, not from the command line... When making the bot... How do i get the bot to recieve the "%s is using Broodwar in game %s" and off of that say "%s is in a Game: %s"? How do i get to say, Example: "Bot: /whois Username" "Server: Username is using Brood war In game 3on3" "Bot: /msg Master Username is in game: 3on3" How do i get it to Reply to the Server message to get it to message me saying its in a game... And... "Bot: /whois Username" "Server: Username is using Broodwar in a Private channel." "Bot: /msg Master Username is not in a game" Is there like a special way in C++ to use the If-then-else statement with Wildcards so i could say something like: if(serverreply == *in game*) { Send("/msg %s %s is in Game: %s\r\n",Master,Name,Game); } if(serverreply != *in game*) { Send("/msg %s %s is not in a Game\r\n",Master,Name); } Like that? Can someone please help me im very lost in this situation :-\ | April 13, 2004, 10:43 AM |
iago | look up sprintf and vprintf/vfprintf/vsprintf/vsnprintf - I forget which of those is the most useful. | April 13, 2004, 1:14 PM |
Moonshine | char *pszUsername = strtok(szPacket, " "); char * pszGameName, *p; for (;;) { p = strtok(NULL, " "); if (p != NULL) pszGameName = p; else break; } Edit: pszGameName might not refer to the whole game name if the game name has a space in it (e.g. Warcraft III : The frozen throne). So you might have to use a counter inside the for loop to detect exactly how many tokens you've taken, then use the appropriate token# as the game name. | April 13, 2004, 4:01 PM |
iago | The cool way to get all tokens out of a string, if you want to use strtok, is: [code]for(char *p = strtok(str, " "); p; p = strtok(NULL, " ")) { ... }[/code] Adron showed me that a long time ago when I was complaining I didn't understand strtok(), and I've never forgotten it :) | April 13, 2004, 4:16 PM |
Moonshine | lol the cool way... that's a neat "shortcut" :) | April 13, 2004, 10:19 PM |
Minor | So if i wanted an Idle (saying i have the settings for the idle already inputed) to check if a user in a list "Stalklist" and check if hes in a game it would look something like this: void Bot::StalkProc() { User tmpUser; for (int i = 0; i < stalkList.GetElements(); i++) { stalkList.GetUser(i,tmpUser); Send("/whois %s\r\n",tmpUser.Name); } for(char *p = strtok(str, " "); p; p = strtok(NULL, " ")) { char *pszUsername = strtok(szPacket, " "); char * pszGameName, *p; for (;;) { p = strtok(NULL, " "); if (p != NULL) pszGameName = p; Send("/w %s Stalked.\r\n",tmpUser.Name); else break; } } If not please assist me because now i have 28 errors and before compiling the code i never had any... So obviously its wrong can u tell me what im doing wrong? | April 14, 2004, 5:40 AM |