Valhalla Legends Forums Archive | Battle.net Bot Development | Greet bot Anti idles

AuthorMessageTime
AC_Drkan
hey i have an anti idle set but the bot times out after like 3 minutes.
here is my code for the message loop

[code]//============================================================================
int BnBot::MsgLoop() {
int nBufLen=0;
int nBufPos=0;
char stageBuf[BUFSIZE];

if (s == INVALID_SOCKET)
return 0;

for (;;) {


   // Handle timer functions
   DWORD dwCurrentTick = GetTickCount();
   TimerProc(dwCurrentTick);

fd_set fds;
FD_ZERO(&fds);
FD_SET(s, &fds);
struct timeval tv;
tv.tv_sec = 1;
tv.tv_usec = 0;

int n = select(s+1, &fds, 0, 0, &tv);
if (n) {
int nNumToRead = BUFSIZE-nBufLen-nBufPos;

if (nNumToRead == 0) {
memmove(stageBuf, stageBuf+nBufPos, nBufLen);
nBufPos = 0;
nNumToRead = BUFSIZE-nBufLen;
}

n = recv(s, stageBuf+nBufPos+nBufLen, nNumToRead, 0);
if (n <= 0) {
LogWrite("recv() returned %d, error code %u", n, GetLastError());
return 0;
}

nBufLen += n;

// dispatch all complete messages in the staging buffer
while (nBufLen > 0) {
char *m = stageBuf+nBufPos;
int nMsgLen=0;
while (nMsgLen < nBufLen) {
if (m[nMsgLen] == '\n')
break;
nMsgLen++;
}

nMsgLen++;
if (nMsgLen > nBufLen)
break;

m[nMsgLen-1] = '\0';

if (isdigit(*m))
Dispatch(m);

nBufLen -= nMsgLen;
nBufPos += nMsgLen;
}

if (!nBufLen)
nBufPos = 0;
}
IdleHook();
}
return 1;
}[/code]


- Added code tags by popular demand.
April 20, 2004, 9:02 PM
AC_Drkan
[code]Also my anti idle code
//=============================================================================
void BnBot::TimerProc(DWORD currentTick) { /* added 04/16/04 */

   // Anti-idles here - Every minute
   if ((currentTick - lastIdle) / 1000 > 60)
      IdleProc();
}
//=============================================================================
void BnBot::IdleProc() {


   Send(" / w AC_Drkan Total Users Joined %s Since Log On\ r \ n ", y ) ;
   lastIdle = GetTickCount();
}[/code]
April 20, 2004, 9:03 PM
Eli_1
Please put that in [ code ] [ /code ] tags. Also, don't post two consecutive messages, instead either put them both in one post, or use the modify feature.
April 20, 2004, 9:22 PM
LoRd
Failure to send anti-idle messages shouldn't result in your connection being terminated.
Are you responding to 0x25 when you receive it?
April 20, 2004, 11:08 PM
UserLoser.
[quote author=LoRd[nK] link=board=17;threadid=6397;start=0#msg56003 date=1082502539]
Failure to send anti-idle messages shouldn't result in your connection being terminated.
Are you responding to 0x25 when you receive it?
[/quote]

That looks like a Chat bot, due to the fact of no handling of messages that start with 0xff, and packet sizes, ect. Along with "Greet bot"
April 20, 2004, 11:36 PM
AC_Drkan
Do you guys see anything wrong with it?

It runs then gets the "The program must be Terminated"
after 1 user joins the channel
April 21, 2004, 2:57 AM
LW-Falcon
The anti-idle shouldn't be affected by people joining the channel.
April 24, 2004, 5:06 PM

Search