• Welcome to Valhalla Legends Archive.
 

Battle.net Bot w/...

Started by StormGage, January 20, 2004, 08:54 PM

Previous topic - Next topic

StormGage

I would be interested in having a bot which prints timestamps that measure to the miliseconds.  For instance:  [hour:minute:seconds:miliseconds].  I would be interested in using one of these bots for various reasons.  Does anyone know of such a bot?

Stealth

- Stealth
Author of StealthBot

StormGage

I'm not familiar with VB, so It'd just be easier for me to have the bot with it allready implemented.  But I'll see what use I can make of that code.

Stealth

Quote from: StormGage on January 20, 2004, 09:19 PM
I'm not familiar with VB, so It'd just be easier for me to have the bot with it allready implemented.  But I'll see what use I can make of that code.

Sorry, I misread your question. Forward that link on to your bot developer of choice.
- Stealth
Author of StealthBot

StormGage


Spht

Quote from: GoSS on January 21, 2004, 10:22 AM
Shouldn't this post be in the BotDev forum?

No. He's asking for a bot which has a certain feature.

UserLoser.

I have one, supports all clients (uses BNLS) - Doesn't have much features yet but it's being worked on.. I'll upload it when I get home since I installed a new server on my system and it's not currently there

hismajesty

I have one as well yet, it's unreleased. I also encountered a problem that UserLoser pointed out to me. It logs milliseconds larger than the maximum millisecond number.  >:(

Kp

Quote from: hismajesty on January 21, 2004, 02:19 PM
I have one as well yet, it's unreleased. I also encountered a problem that UserLoser pointed out to me. It logs milliseconds larger than the maximum millisecond number.  >:(

Nice trick.  If you want some help fixing it, spawn a new thread about that (preferably either in botdev or in a language specific forum, as you feel appropriate) and I'm sure someone will take a look.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

UserLoser.

Quote from: hismajesty on January 21, 2004, 02:19 PM
I have one as well yet, it's unreleased. I also encountered a problem that UserLoser pointed out to me. It logs milliseconds larger than the maximum millisecond number.  >:(


void TimeStamp(char *buf, bool bMSTime)
{
   SYSTEMTIME st;
   GetLocalTime(&st);
   if (bMSTime)
      sprintf(buf, "[%02i:%02i:%02i.%03i] ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
   else
      sprintf(buf, "[%02i:%02i:%02i] ", st.wHour, st.wMinute, st.wSecond);
}

Kp

Quote from: UserLoser. on January 21, 2004, 03:25 PM

void TimeStamp(char *buf, bool bMSTime)
{
  SYSTEMTIME st;
  GetLocalTime(&st);
  if (bMSTime)
     sprintf(buf, "[%02i:%02i:%02i.%03i] ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
  else
     sprintf(buf, "[%02i:%02i:%02i] ", st.wHour, st.wMinute, st.wSecond);
}

A quick optimization:

     sprintf(buf, bMSTime ? "[%02i:%02i:%02i.%03i] " : "[%02i:%02i:%02i] ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);

This cuts down on code size by only having one way to call sprintf.  The ternary operator ?: picks a format string appropriate to the request, rather than an if/else construction which picks an entire function call.  When bMSTime is false, the fourth field st.wMilliseconds is silently ignored by sprintf, since the non-ms format string only specifies three fields.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Adron

Quote from: Kp on January 21, 2004, 03:42 PM
This cuts down on code size by only having one way to call sprintf.  The ternary operator ?: picks a format string appropriate to the request, rather than an if/else construction which picks an entire function call.  When bMSTime is false, the fourth field st.wMilliseconds is silently ignored by sprintf, since the non-ms format string only specifies three fields.

It would also prevent the compile-time checking of printf format arguments done by some modern compilers?

Kp

Quote from: Adron on January 23, 2004, 03:01 PMIt would also prevent the compile-time checking of printf format arguments done by some modern compilers?

Sure.  That's why I only make such changes when I'm going back through looking for easy enhancements, after I've already built everything and gotten any associated warnings. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

DarkMinion

I am of the opinion that someone should stab you in the face.

Kp

Quote from: DarkMinion on January 27, 2004, 06:39 AM
I am of the opinion that someone should stab you in the face.

Stab who?  You should indicate the poster to whom you are referring.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!