Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Guides & Templates
You last visited: Today at 04:33

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Making bots/macros in VisualBasic 6.0

Discussion on Making bots/macros in VisualBasic 6.0 within the CO2 Guides & Templates forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2005
Posts: 251
Received Thanks: 115




At the begining sorry for my bad speling...
I decided to contribute to the comunity and help some people wich are begining to program in VB with some usefull stuff I know. Also I would like to encurage all the VB programers in this forum to post programs and short tutorials in this topic so that we make a good usefull VB library

I will start with small programs and go big and add new tool with tutorial when I have time. If this topic spreads in more pages list thro them all because I will post new tools with How To in diferent posts. I hope my work will be found usefull and will help some coding beginers.
--------------------------------------------------------------------------

Program no.1: AutoScater

1. Open new project and add new module. In the module paste this.

Quote:
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Option Explicit
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long

Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10
Public Const MOUSEEVENTF_MOVE = &H1

Public Type POINTAPI
X As Long
Y As Long
End Type

Public Function GetCurrentX() As Long
Dim Position As POINTAPI
GetCursorPos Position
GetCurrentX = Position.X
End Function

Public Function GetCurrentY() As Long
Dim Position As POINTAPI
GetCursorPos Position
GetCurrentY = Position.Y
End Function

Public Sub LeftClick()
LeftDown
LeftUp
End Sub

Public Sub LeftDown()
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
End Sub

Public Sub LeftUp()
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub

Public Sub MiddleClick()
MiddleDown
MiddleUp
End Sub

Public Sub MiddleDown()
mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
End Sub

Public Sub MiddleUp()
mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
End Sub

Public Sub MoveMouse(xMove As Long, yMove As Long)
mouse_event MOUSEEVENTF_MOVE, xMove, yMove, 0, 0
End Sub

Public Sub RightClick()
RightDown
RightUp
End Sub

Public Sub RightDown()
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
End Sub

Public Sub RightUp()
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub

The first GetAsyncKeyState function is used to get the current state of a key. This works with any key on keyboard as well as with the mouse.
The mouse_event and SetCursorPos are used to control the mouse. GetCursorPos is used to return you the curent position of your mouse.
How to control the mouse? Lets say you want to move the cursol to pixel coordinates 500, 500 and click. You simply call...
Quote:
MoveMouse 500, 500
LeftClick
Also see the other functions in the module... you can use any like midle click,right click ect. More about mouse control in next tutorials. Now lets return to our AutoScater.

On the main form add a timer and set its "Interval" value to 150. This will call the code under timer every 0.15 sec, In our case will autoclick if you hold the right button every 0.15 sec. I set it to so low because i dont know the minimum time between 2 scaters and I dont want to miss any 0.1 sec
Now under timer add this code:
Quote:
Private Sub timMain_Timer()
result = GetAsyncKeyState(vbKeyRButton) 'gets the state of the right mouse button
If result = -32768 Then 'if its down
RightUp 'release it
RightDown 'and return it down again untill you release it in reality
End If
End Sub
Edit: not to confuse any1, the timer should be renamed to "timMain" or replace the "timMain" in the above code with "Timer1".

Now compile and vala... you have an AutoScater wich will constantly press righ mouse button whyle you hold it.
I hope this helped some people... More will come
inSertCoiN is offline  
Thanks
1 User
Old 12/05/2006, 14:24   #2
 
swords's Avatar
 
elite*gold: 20
Join Date: Dec 2005
Posts: 811
Received Thanks: 352
Very nice man, thank you for contributing to epvp, but why go to all that coding if you can just simply do macro express or ghost mouse or make a quick code with autoit that does the same thing? :P

Btw is this in language C or is it just visual basics?
swords is offline  
Old 12/05/2006, 15:17   #3
 
elite*gold: 0
Join Date: Mar 2005
Posts: 251
Received Thanks: 115
Well the 1st module code is public code thet you can find on internet and its used to control mouse, get mouse output and keyboard output. When you create that module (just copy paste) you can use it for any next program you need to write.
So the only coding for this program is:
Quote:
Private Sub timMain_Timer()
result = GetAsyncKeyState(vbKeyRButton) 'gets the state of the right mouse button
If result = -32768 Then 'if its down
RightUp 'release it
RightDown 'and return it down again untill you release it in reality
End If
End Sub
This takes only about 0.5 min work so its not so bad to make an own custom made AutoScater with so litle work. + its only introduction so it will get more advanced and advanced.
For all the people who plan to use this: save the module. You will need it for other programs.

PS. Its a pure Visual Basic 6.0 code, you might have mestaken it because the function declarations are very simular in C++ as far as I know.
inSertCoiN is offline  
Old 12/05/2006, 16:25   #4
 
elite*gold: 0
Join Date: Feb 2006
Posts: 523
Received Thanks: 4
Quote:
Originally posted by swords@Dec 5 2006, 14:24
Very nice man, thank you for contributing to epvp, but why go to all that coding if you can just simply do macro express or ghost mouse or make a quick code with autoit that does the same thing? :P

Btw is this in language C or is it just visual basics?
'Making bots/macros in VisualBasic 6.0'
(that is the topic name... I know but it has the answer in it xD)
ganoderma is offline  
Old 12/05/2006, 20:15   #5
 
elite*gold: 0
Join Date: Dec 2005
Posts: 361
Received Thanks: 20
lol nice guide +k.. im trying to learn vb so this will help me alot
GhostRider is offline  
Old 12/05/2006, 20:20   #6
 
elite*gold: 0
Join Date: Apr 2005
Posts: 264
Received Thanks: 181
can i apply this on C++ turbo ?
kokoman is offline  
Old 12/05/2006, 22:52   #7
 
elite*gold: 0
Join Date: Apr 2006
Posts: 22
Received Thanks: 0
xD hi insert its tesshu, *waves again* Another of my chars waved to u!

Dude i tried ur tutorial.. i cudnt get it right but im a dumbass anyway so i duno if this worked for others.. but next time cud u try a bit more detail? great tutorial tho man i tried for ages to make it work =\ guess i jus failed lol
tasshu is offline  
Old 12/06/2006, 03:14   #8
 
elite*gold: 0
Join Date: Mar 2005
Posts: 251
Received Thanks: 115
Quote:
Originally posted by kokoman+Dec 5 2006, 20:20--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (kokoman @ Dec 5 2006, 20:20)</td></tr><tr><td id='QUOTE'>can i apply this on C++ turbo ?[/b]

all the functions in the module are windows functions that can be used by any programing language. I'm sorry but I dont know much about C++, i'm at the first "Hello World" lessons ... so the answer to your question is YES you can use the functions (GetAsyncKeyState, mouse_event, SetCursorPos, GetCursorPos) but i think that they should be declared litle diferent in C++, so the code needs changing.


Hi tasshu...
*waves back*

<!--QuoteBegin--tasshu
@Dec 5 2006, 22:52
xD hi insert its tesshu, *waves again* Another of my chars waved to u!

Dude i tried ur tutorial.. i cudnt get it right but im a dumbass anyway so i duno if this worked for others.. but next time cud u try a bit more detail? great tutorial tho man i tried for ages to make it work =&#092; guess i jus failed lol
[/quote]
OK now...
1. Open new project.
2. in the meny go Project > New Module
3. Copy the 1st code from above (the long one) and paste it in to the module.
4. now go to the form and place a timer
5. set the Timer "interval" value to 150
6. enter this code in the main project
Quote:
Private Sub Timer1_Timer()
result = GetAsyncKeyState(vbKeyRButton) 'gets the state of the right mouse button
If result = -32768 Then 'if its down
RightUp 'release it
RightDown 'and return it down again untill you release it in reality
End If
End Sub
7. save if you want and then compile

If you still cant get it but you need the AutoScater, you can download compiled version from above
inSertCoiN is offline  
Old 12/06/2006, 17:00   #9
 
elite*gold: 0
Join Date: Apr 2006
Posts: 22
Received Thanks: 0
i tried lol jus cant, Im gna still try but this is getting me so angry >.< do u have a frm or summit i can load on visual basic so i can see how u coded it?

I tried yours.. loaded it up dont work mayby im missing sumit =&#092; im really noob. but i gave u K so nice, if u get more tutorials ill try em still
tasshu is offline  
Old 12/07/2006, 02:11   #10
 
tsu's Avatar
 
elite*gold: 0
Join Date: Jan 2006
Posts: 2,534
Received Thanks: 51
Triumph..

InsertCoin
trixie
tesshu
ninja_shadow (?)
~vodka~

Right?
tsu is offline  
Old 12/07/2006, 02:23   #11
 
elite*gold: 0
Join Date: Mar 2005
Posts: 251
Received Thanks: 115
Quote:
Originally posted by tasshu+Dec 6 2006, 17:00--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (tasshu @ Dec 6 2006, 17:00)</td></tr><tr><td id='QUOTE'> i tried lol jus cant, Im gna still try but this is getting me so angry >.< do u have a frm or summit i can load on visual basic so i can see how u coded it?

I tried yours.. loaded it up dont work mayby im missing sumit =&#092; im really noob. but i gave u K so nice, if u get more tutorials ill try em still [/b]

OK i'll upload the source and put it in main post tomorow, its too late now

...and you can't "load up" the AutoScater that you downloaded from above because its compiled program, finished version, final product, not a source code ...


<!--QuoteBegin--tsu
@Dec 7 2006, 02:11
Triumph..

InsertCoin
trixie
tesshu
ninja_shadow (?)
~vodka~

Right?
[/quote]

I'm not gona play dumb and deny it, its true ... But I deny that i'm using any hack/bot/macro from this forum, its only for educational reason...
inSertCoiN is offline  
Old 12/07/2006, 07:23   #12
 
elite*gold: 0
Join Date: Aug 2006
Posts: 100
Received Thanks: 1
I'm very interested too. I haven't really read this topic yet, just scanned it but I seen u are gona load some VB source code tomarrow. I been looking for this. Something that I can look at and figure out how things work and how to use VB to communicate with CO. If your willing, I could really use your help in the up coming days to learn how to make bots in VB. I use VB 2005 express. Dont know if that matters. But Im in the middle of learning it and its alot easier than I thought it would be. Good night to ya I'm going to bed too. lol
Bud_wis_er_420 is offline  
Old 12/07/2006, 16:51   #13
 
elite*gold: 0
Join Date: Mar 2005
Posts: 251
Received Thanks: 115
Quote:
Originally posted by Bud_wis_er_420@Dec 7 2006, 07:23
I'm very interested too. I haven't really read this topic yet, just scanned it but I seen u are gona load some VB source code tomarrow. I been looking for this. Something that I can look at and figure out how things work and how to use VB to communicate with CO. If your willing, I could really use your help in the up coming days to learn how to make bots in VB. I use VB 2005 express. Dont know if that matters. But Im in the middle of learning it and its alot easier than I thought it would be. Good night to ya I'm going to bed too. lol
I'm not realy good at manipulating with CO memory, expecialy not DMA. I will only show you how to create macros and manipulating CO with pixel based coding (wich can be used to make pixel-based bot). Also I will show you how you can use some static CO memory data based on .

VB 2005 express is lil diferent from VB 6.0 but you can find tutorials on the internet how to adapt the code.
Once again I would like to encourage all the VB coders out here to go publik with theyr work.

*source code uploaded*
inSertCoiN is offline  
Old 12/07/2006, 20:38   #14
 
elite*gold: 0
Join Date: Apr 2006
Posts: 22
Received Thanks: 0
Quote:
Originally posted by tsu@Dec 7 2006, 02:11
Triumph..

InsertCoin
trixie
tesshu
ninja_shadow (?)
~vodka~

Right?
and u r...? mr stalker? And vodka and trixie isnt me.. its my gf
tasshu is offline  
Old 12/07/2006, 20:38   #15
 
elite*gold: 0
Join Date: Apr 2006
Posts: 22
Received Thanks: 0
Quote:
Originally posted by inSertCoiN+Dec 6 2006, 03:14--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (inSertCoiN @ Dec 6 2006, 03:14)</td></tr><tr><td id='QUOTE'>
Quote:
Originally posted by -kokoman@Dec 5 2006, 20:20
can i apply this on C++ turbo ?
all the functions in the module are windows functions that can be used by any programing language. I'm sorry but I dont know much about C++, i'm at the first "Hello World" lessons ... so the answer to your question is YES you can use the functions (GetAsyncKeyState, mouse_event, SetCursorPos, GetCursorPos) but i think that they should be declared litle diferent in C++, so the code needs changing.


Hi tasshu...
*waves back*

<!--QuoteBegin--tasshu
@Dec 5 2006, 22:52
xD hi insert its tesshu, *waves again* Another of my chars waved to u!

Dude i tried ur tutorial.. i cudnt get it right but im a dumbass anyway so i duno if this worked for others.. but next time cud u try a bit more detail? great tutorial tho man i tried for ages to make it work =&#092; guess i jus failed lol
OK now...
1. Open new project.
2. in the meny go Project > New Module
3. Copy the 1st code from above (the long one) and paste it in to the module.
4. now go to the form and place a timer
5. set the Timer "interval" value to 150
6. enter this code in the main project
Quote:
Private Sub Timer1_Timer()
result = GetAsyncKeyState(vbKeyRButton) 'gets the state of the right mouse button
If result = -32768 Then 'if its down
RightUp 'release it
RightDown 'and return it down again untill you release it in reality
End If
End Sub
7. save if you want and then compile

If you still cant get it but you need the AutoScater, you can download compiled version from above [/b][/quote]
thanks man ya a legend
tasshu is offline  
Reply


Similar Threads Similar Threads
The FULL guide to making your own Bots/Macros...PART 2
02/20/2011 - CO2 Guides & Templates - 30 Replies
Part 2 Hi all, This is the second guide to making your own Bots and Macros using the script writer AutoIt. I have explained basic fundamentals in my previous Basic Guide on how to create Bots and Macros for Conquer and I will be further sharing my knowledge on how to create bots using Mouse Clicks and GUI for your programs. Contents: 1. AutoIt Window Info 2. Mouse Functions
The FULL guide to making your own Bots/Macros...PART1
04/19/2008 - CO2 Guides & Templates - 27 Replies
Part 1 Hi all, As you have read in the thread title, this is a FULL guide for creating your own Bots and Macros. I will be teaching you some of the basic fundamentals in programming and also some advanced fundamentals which will include creating GUI's for your Bots and Macros. Advanced fundamentals will be in the 2nd Part of this tutorial. Contents: 1. What we are using 2. Introduction to the AutoIt language



All times are GMT +1. The time now is 04:34.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.