.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Common Questions (http://forums.bots-united.com/forumdisplay.php?f=51)
-   -   Question about bot chatting (http://forums.bots-united.com/showthread.php?t=6819)

person135 14-06-2008 00:28

Question about bot chatting
 
Hey KWo! :clap::clap:
It's been a long time since I came here.

I have a question on how your bots detect keywords in their chats. I am referring to the source code. Also, can you tell me how you detect which player said what.

can you give me the c++ code for this or tell me how to do this?

Thanks

KWo 14-06-2008 08:31

Re: Question about bot chatting
 
The podbot mm sources are here.

In the file bot_client.cpp there is a function BotClient_CS_SayText. It intercepts who (ucEntIndex) and what (pBot->SaytextBuffer.szSayText) is saying and puts it to the buffer, then answer with some delay (pBot->SaytextBuffer.fTimeNextChat) after recognizing the keywords in the function BotCheckKeywords in the file bot_chat.cpp. In that file there is a function called BotPrepareChatMessage, which You should take a look at, too. In the BotCreate function in the file bot.cpp there are also such line:
Code:

  // Assign how talkative this Bot will be
  pBot->SaytextBuffer.fChatDelay = RANDOM_FLOAT (4.0, 10.0);
  pBot->SaytextBuffer.cChatProbability = RANDOM_LONG (40, 100); // KWo - 31.03.2006

The first parameter says how often the bot will be talk (how many seconds between 2 chats from the same bot), the second one is also checking the probability the bot wants to talk after that delay. I hope You have got the full answer.

person135 15-06-2008 01:15

Re: Question about bot chatting
 
what is the void *p? I see that ucEntIndex = *(unsigned char *) p;

I don't understand what you did very well.

Can you explain it to me in C++ how it intercepts who is talking and what he is saying? do you need to hook saymsg or textmsg? What is the hlsdk thing for intercepting chat messages?

KWo 15-06-2008 09:10

Re: Question about bot chatting
 
Quote:

Originally Posted by person135 (Post 58210)
what is the void *p? I see that ucEntIndex = *(unsigned char *) p;

It's a pointer to the data without any fixed format (can be int, can be float, can be char, can be whatever - depanding on the assignement).

Quote:

Originally Posted by person135 (Post 58210)
I don't understand what you did very well.

It wasn't me - it was Count Floyd in 99% of code... Then take a C++ book and learn it. I'm not going to be Your teacher... I just don't have time for that.

Text/say message? Find in engine.cpp the call for BotClient_CS_SayText - then You will see what kind of message it is...

BTW - why exactly do You need to know that bot chating function? Is there something You want to fix (not working correctly)? Or You are trying to make Your own bot?


All times are GMT +2. The time now is 21:02.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.