![]() |
|
#1
|
|||
|
|||
Character/String Searching for a BotThe general idea for this program is that it's a bot, which grabs text from a chat window (a rich text field) scans through it for commands, and sends text back to the chat.
Here's the code, will explain below. CPP / C++ / C Code:
Essentially... The program looks for the window and the rich text field and passes them to their handles... It then grabs the initial text currently in the chat field and places it into the buffer "buf" Then, the application loop begins and it checks to see if the text inside the chat field has changed from the text in the "buf" buffer... If so, then it would search for a command. If buf and newbuff are the same, it will wait until the chat has been updated to check again for a command. Now here's my issue... If I were to use strstr(str1,str2) and search for the term "admins" in the buffer, it would find it every time the screen updates from previous times the command has been used... causing it to spam. So here's an example situation of what I want to do. EXAMPLE: The chat room has the following text in it when the bot is loaded up: Code:
The application loop grabs the text from the chat and puts it into the buffer "newbuf" after sleeping 1000 m/s The bot then determines that there has been no new chat activity due to its comparison of "newbuf" and "buf" returning null. The loop goes on... Somebody types into the chat and the chatroom now looks like: Code:
My goal is to fill into a third buffer, the text that wasn't present in "buf" when the comparison between "buf" and "newbuf" returns a value... In other words grab "Tod: Huh?" and put it into a buffer so I can check it for commands. Ideas? Right now all it does is say Updated in the console whenever somebody enters new text into the chat. |
|||
|
#2
|
|||
|
|||
Re: Character/String Searching for a BotI cant belive I couldn't figure this out, must've been because I wrote that at 5 am... Figured it out... heres my code for reference purposes.
CPP / C++ / C Code:
|
Recent GIDBlog
Configuring iptables for Webmin Servers Index Module by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| searching for bluetooth services using bluez sdp | ThinkBlue | C Programming Language | 0 | 26-Mar-2007 07:10 |
| Searching for free web hosting No Adds over 1gb | eK3eKyToPa | Free Web Hosting | 1 | 14-Mar-2007 13:23 |
| Generic searching through vectors | zdenek | C++ Forum | 1 | 10-Oct-2006 08:44 |
| Searching and inserting in linked list | s_scientist | C++ Forum | 3 | 10-Apr-2005 19:27 |
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The