• Welcome to Valhalla Legends Archive.
 

.Net BoT

Started by AntiVirus, April 26, 2004, 08:22 PM

Previous topic - Next topic

AntiVirus

Does any one know where I can get a tutorial for programming a Visual Basic .NET bot?  I can't seem to find any..  I even tried google and asked other programers I know.. Can anyone help me?
"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

MyndFyre

Quote from: Brandon on April 26, 2004, 08:22 PM
Does any one know where I can get a tutorial for programming a Visual Basic .NET bot?  I can't seem to find any..  I even tried google and asked other programers I know.. Can anyone help me?

Visual Basic .NET is new, and I do not believe that anyone has created a bot in that specific language to date.  I have put one together (there's some controversy as to whether mine or DarkFeanor's was the first in C#), but the library that mine uses is well-encapsulated and should greatly speed your development process.

My library is probably ready-to-go for you right now, as far as the types go.  I will re-publish the documentation and give you some information about how it should be put together (I will try putting one together in VB .NET first, just to be sure it will work).  I have not worked at all on getting the Starcraft connections or anything else in there -- right now it only works with Warcraft III and The Frozen Throne.  The update for connecting to Brood War and the older games (incl. Diablo) will be completely compatible with what I have currently, as long as you implement certain interfaces (such as IConnectionSettings) properly.

Here's how it works:

You are required to validate a key to my server before you can use the bot.  This may be done by hooking some events (sorry, this is C# -- I hope you can translate):


// elsewhere defined:
public delegate void ErrorEventHandler(string message,  bool disconnected, Exception cause);

public void RegisterConnection(string key)
{
 // Connections is a static class
 Connections.KeyValidated += new EventHandler(this.KeyValidated);
 Connections.KeyNotValidated += new ErrorEventHandler(this.KeyNotValidated);
 Connections.ValidateKey(key);
}

public void KeyValidated(object sender, EventArgs e)
{
 // I implement several interfaces, including IConnectionSettings, in a class called
 // ConnectionProfile.  I have an instance in my main connection manager of this
 // called profile.
 // this.connectionManager is an instance of IConnectionManager.
 this.connectionManager = Connections.GetManager(profile);
}

// The IConnectionManager interface defines several properties including EventHost,
// which returns an IEventHost instance.  The IEventHost interface is defined:

public interface IEventHost
{
 void RegisterEvent(EventType type, MulticastDelegate handler);
 void UnregisterEvent(EventType type, MulticastDelegate handler);
}


I'll have more info for you later.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

l)ragon

QuoteVisual Basic .NET is new, and I do not believe that anyone has created a bot in that specific language to date.
I beleve Andreas Strobl has dibs on the first vb.net bot along with one I scraped during one of my what to do Phases back in May last year.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

AntiVirus

#3
Lol Thanks, I can't translate.. But I can ask some of my friends see if they can help me.  But it will still probably help (but they are impatiant with my newbness).  Thanks a bunch.
QuoteI will try putting one together in VB .NET first, just to be sure it will work
Thanks a lot that would be extremely helpful if you would do that.  Cause then I could understand it!  ;D
"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

quasi-modo

Look at some vb6 bots, it would be a fairly similar would it not? I use .net for asp.net, not for application programming, so I do not know how it would differ from using winsock with vb6 though. I know in vb.net with asp.net to use sockets, you request system.net.sockets, is that how it works in vb.net applications too myndfyre?
WAR EAGLE!
Quote(00:04:08) zdv17: yeah i quit doing that stuff cause it jacked up the power bill too much
(00:04:19) nick is a turtle: Right now im not paying the power bill though
(00:04:33) nick is a turtle: if i had to pay the electric bill
(00:04:47) nick is a turtle: id hibernate when i go to class
(00:04:57) nick is a turtle: or at least when i go to sleep
(00:08:50) zdv17: hibernating in class is cool.. esp. when you leave a drool puddle

MyndFyre

Quote from: dRAgoN on April 27, 2004, 01:31 PM
QuoteVisual Basic .NET is new, and I do not believe that anyone has created a bot in that specific language to date.
I beleve Andreas Strobl has dibs on the first vb.net bot along with one I scraped during one of my what to do Phases back in May last year.

1.) Was the VB .NET bot a binary or CHAT bot?
2.) Was the VB .NET bot a clean rewrite or a port of a VB6 bot?
3.) Was your bot binary or CHAT?

To clarify, my bot was a completely clean write in C#, using a binary connection via BNLS.  It made the first successful connection to Battle.net as Starcraft (STAR) in August 2003.  The goals driving the project are extensibility, good OOP practices, and efficiency.

ArmaBot is extensible in these ways:

1.) It uses reflection and type loading to allow third-party developers to create custom database backing.  In the assembly ArmaBot.Data.dll, it specifies several data-centric interfaces which the assembly must consume, the primary being ArmaBot.Data.IDbProvider.
2.) It uses reflection and type loading to allow third-party developers to create custom plugins that can be applied separately to each connection (This will be implemented in the next alpha version -- which may actually end up being the first beta version).  The configuration file automatically accomodates this.
3.) It allows developers who want to create a bot (see above) to easily set up their own consumption of the API.

As for Brandon, I recommend learning the .NET Framework Class Library.  Compare the syntax of VB .NET and C# in the help files.  They're very similar in nature, and you should be able to get them together.

Cheers.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

AntiVirus

#6
QuoteLearn the language before making a bot.  As always, good advice.
I will just keep learning the language, cause I dont' want to over do it.  And I feel as if I am wasting your time with my questions right now.  So I will just ask for the location of some tutorials for vb projects with an open source and I can always ask for codding tips here right?
"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

MyndFyre

Quote from: Brandon on April 27, 2004, 06:12 PM
QuoteLearn the language before making a bot.  As always, good advice.
I will just keep learning the language, cause I dont' want to over do it.  And I feel as if I am wasting your time with my questions right now.  So I will just ask for the location of some tutorials for vb projects with an open source and I can always ask for codding tips here right?

Well, you're not wasting my time as much as you are your own.  As I've said before, I had about a year of experience with C# and .NET before undertaking the making of a bot.  You will find that when you understand the concepts within programming, things are easier to do.

I highly recommend www.gotdotnet.com as a major place for learning.  The user samples and the message boards are a fantastic resource with many, many knowlegeable people; there are, however, just as many ignorant people.  Don't take one user's response as law.

Yes, you can most certainly ask for coding tips here.  As you've run across iago's post on the /WHOAMI forum, just keep things on-topic.  You'll find we try to be helpful. :)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

AntiVirus

Okay I have one question that has been bothering me forever.   What exactly is a string?  I dont' really understand those.  Do you?
"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

Banana fanna fo fanna

Strings are sequences of characters in quotes. This message is a string, for instance. Things that aren't strings are numbers (integers, floats (decimals)), booleans (true false), and complex types (classes, structs, and the like).

MyndFyre

It's worthwhile to note that when strings are transmitted over a network protocol, they typically don't send the quotes.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

dxoigmn

Quote from: Myndfyre on April 27, 2004, 08:07 PM
It's worthwhile to note that when strings are transmitted over a network protocol, they typically don't send the quotes.

Quote
1018 INFO "Welcome to Battle.net!"
1018 INFO "This server is hosted by AT&T."
1018 INFO "There are currently 829 users in Chat, and 157498 users playing 61614 games on Battle.net."

quasi-modo

#12
I think the key word was typically  :-X. I did not get a response to my post before, but vb.net applications would use system.net.sockets just as it is used when doing asp.net with vb.net correct?
WAR EAGLE!
Quote(00:04:08) zdv17: yeah i quit doing that stuff cause it jacked up the power bill too much
(00:04:19) nick is a turtle: Right now im not paying the power bill though
(00:04:33) nick is a turtle: if i had to pay the electric bill
(00:04:47) nick is a turtle: id hibernate when i go to class
(00:04:57) nick is a turtle: or at least when i go to sleep
(00:08:50) zdv17: hibernating in class is cool.. esp. when you leave a drool puddle

MyndFyre

Quote from: dxoigmn on April 27, 2004, 10:28 PM
Quote from: Myndfyre on April 27, 2004, 08:07 PM
It's worthwhile to note that when strings are transmitted over a network protocol, they typically don't send the quotes.

Quote
1018 INFO "Welcome to Battle.net!"
1018 INFO "This server is hosted by AT&T."
1018 INFO "There are currently 829 users in Chat, and 157498 users playing 61614 games on Battle.net."

Of course Mr. Smart Guy, the quotes are part of the string, not the enclosing delimiters of the string itself.

A string is an arbitrary sequence of bytes or words (in the case of Unicode strings).  These are typicially delimited by quotes, but not necessarily:

From YaBB 1.3.1 Display.pl:

   print FILE qq~$tmpa|$tmpb~;


In this case, the string is delimited by the tilde (~) character.

Programmatically, strings are maintained (since they are of arbitrary length) in memory either by the runtime remembering how long a specific string is (as is the case in .NET), or by using a specific byte value not typically seen in normal usage.  For example, C-based languages (excluding C# and Java) use the NULL (0) byte to indicate where a string ends:

The C string "12345" is (in hex):

31 32 33 34 35 00


The null terminator byte isn't a given; in my Assembler class, we used a couple different terminators.  A common one was the byte value 13:


TERMINATOR equ 13
str        db "12345",TERMINATOR


Hope that clarifies things. :)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

AnonProgrammer

Thanks for the links to the code postings.  I derived much enjoyment from reading them.  

So much to do, so little time...