Register for your free account! | Forgot your password?

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

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

Advertisement



The FULL guide to making your own Bots/Macros...PART1

Discussion on The FULL guide to making your own Bots/Macros...PART1 within the CO2 Guides & Templates forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
Hiyoal's Avatar
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,066
Talking The FULL guide to making your own Bots/Macros...PART1

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
3. Declarations
4. Functions
5. If, Then, ElseIf and Else
6. Timers
7. Loops
8. Setting hotkeys
9. [Part 2]



1. What we are using

In this tutorial, I will be teaching you how to write code in

What is AutoIt??
is a multifunctional script writing tool which enables you to create simple to advanced programs. In part 1 of this tutorial I will be teaching you the very basics of script writing in . The script writer used for writing AutoIt code is called SciTE. This writer helps you write code more effectively and more efficiently while also giving the script an organised view.


2. Introduction to the AutoIt language

As I have explained above, AutoIt is a multifunctional script writing too which enables you to create simple to advanced programs. This means that script language should be understandable but at the same time, simple and easy to use. If you look at some Visual Basic coding examples, they can be understood but they contain lots of complicated coding in declarations and in the way in which one coding example may identify a process. AutoIt can use language to identify a process simply by using: ProcessExists().

See how AutoIt is much simpler?!

3. Declarations

Declarations an instruction or statement that defines data (fields, variables, arrays, etc.) and resources, but does not create executable code. This means that if I declare “ProcessExists(“[Conquer 2.0]”)” then I would write “$ANYTHINGHERE=ProcessExists(“[Conquer 2.0]”)”.
The use of $ or Dim in AutoIt will define data used in the program. I will explain this concept in more detail when we start writing some code.

4. Functions

Functions can be used to organise data and create different points for the program to read. If you create a Function which stores data about the function of pressing “F1” then you can set “Call” functions in other parts of your script to read and process the above function.

Eg.

Quote:
Originally Posted by Hiyoal
Start() ;Calls the Function named "Start"

Func Start()
$msgbox=Msgbox(4, “Start”, “4+1=6….Press yes if you think this equation is correct. Press no if you think it is incorrect”)

If $msgbox=6 then ;asks the program whether “Yes” was pressed. If it wasn’t then it skips this If statement
Incorrect() ;this calls the Function “Incorrect”
EndIf

If $msgbox=7then ;asks the program whether “No” was pressed
correct() ;this calls the Function “Correct”
EndIf
EndFunc


Func incorrect()
Msgbox(0, “Incorrect”, “You were incorrect”)
Exit
EndFunc


Func correct()
Msgbox(0, “Correct”, “You were correct”)
Exit
EndFunc
5. If, Then, ElseIf and Else

If, Then and Else commands are used in many scripting languages. What they do is ask the program a question. I have written some codes above which demonstrate how the If and Then statement work.

Eg. This Example will demonstrate If, Then and ElseIf and Else.

Quote:
Originally Posted by Hiyoal
If $var >= 0 Then ;asks the program if $var is equal to more than 0, and if it is then it continues through code lines.
MsgBox(4096,"", "Value is positive.") ;displays a messagebox
ElseIf $var <= 0 Then ;if the above
MsgBox(4096,"", "Value is negative.")
Else
If StringIsXDigit ($var) Then
MsgBox(4096,"", "Value might be hexadecimal!")
Else
MsgBox(4096,"", "Value is either a string or is zero.")
EndIf
EndIf
6. Timers and Send

Timers and Send Functions are one of the most important lines of code written for Bots and Macros. What a timer does is tell the program when to “stall” for a period of time. This can be used when using Sit functions in Conquer 2.0 when levelling a stamina skill. You will have to program your AutoIt script to “Sleep” for an amount of time to allow regeneration stamina time.
What the Send Function does is presses a button on your keyboard without you physically pressing it. This

Eg. This Example is a snippet of code from a personal Spiritual Healing Bot I have made.

Quote:
Originally Posted by Hiyoal
Func StartHeal()
$number=IniRead(@systemdir & “\coolies\hello.ini”, “Hi”, “Sup”, “”) ;reads the value from an Ini file.

If $number=1 then
While $number=1
Sleep(12000) ;number is how many milliseconds to sleep for 12seconds
Send({F1}) ;presses the F1 key
Wend
EndIf


If $number=2 then
Exit
EndIf
EndFunc
For this coding to work, you would have to write values to the file hello.ini in @SystemDir\coolies\ for this line of code to work. Otherwise the program could not determine the value of $number and it would receive “”.

7. Loops

Loops are what they are. They cycle through code until the program tells them to stop or else the program quits. They can also cycle forever. This is very helpful when writing codes such as Auto Hunters because you might want the program to read certain user inputted data (SH “F” key. Eg. SH=F3) to cycle through steps until…say…the “Stop” hotkey is pressed.
Loops use the coding:
While
Wend


While tells the program when to start (If While is written using “While 1” then the program will loop forever until the program exits)

Eg. This example will loop through msg boxes until the declared statement $i adds up to 10 or above.

Quote:
Originally Posted by Hiyoal
$i = 0 ; i is declared as equal to 0

While $i <= 10 ;While i’s value is below 10, Loop through below code

MsgBox(0, "Value of $i is:", $i) ;msg boxes the value of i

$i = $i + 1 ;rewrites i again but adds 1 to it so that i is equal to 1 more value to i then the last time.

WEnd
9. Setting Hotkeys

Hotkeys are used in Bots and Macros for the initiation of functions. They are usually used to start, pause, speed up, prompt or stop a program. They are very useful because they are easy to use and they are quick response. They are also easy to code .

Eg. This Example shows how to integrate hotkeys into a simple msgbox program.

Quote:
Originally Posted by Hiyoal

While 1
HotKeySet({INSERT},”Start”) ;Calls the function "Start" when INSERT is pressed
HotKeySet({END},”Exit”) ;Calls the function "Exit" when END is pressed
Wend

Func Start()
Msgbox(0, “Start”, “You have pressed the key INSERT and it has prompted this message!”)
EndFunc

Func Exit()
Msgbox(0, “Start”, “You have pressed the key END and it has prompted this message and will exit after you press OK”)
Exit
EndFunc
8. Setting Hotkeys

Hotkeys are used in Bots and Macros for the initiation of functions. They are usually used to start, pause, speed up, prompt or stop a program. They are very useful because they are easy to use and they are quick response. They are also easy to code .

Eg. This Example shows how to integrate hotkeys into a simple msgbox program.

Quote:
Originally Posted by Hiyoal

While 1
HotKeySet(“{INSERT}”,”Start”) ;Calls the Function "Start"
HotKeySet(“{END}”,”Exit”) ;Calls the Function "Exit"
Wend

Func Start()
Msgbox(0, “Start”, “You have pressed the key INSERT and it has prompted this message!”)
EndFunc

Func Exit()
Msgbox(0, “Start”, “You have pressed the key END and it has prompted this message and will exit after you press OK”)
Exit
EndFunc
9. Part 2



I hope that everyone can benefit from this Guide on creating Bots and Macros for themselves and for the community.

Written by Hiyoal
For Elitepvpers

Hiyoal
Hiyoal is offline  
Thanks
53 Users
Old 12/13/2007, 23:56   #2
 
elite*gold: 0
Join Date: Sep 2007
Posts: 87
Received Thanks: 8
Since I am really deep into autohotkey I have a question about autoit

Could autoit manage to send a key i.e. F1 too a inactive co window or id.

biertje! is offline  
Old 12/14/2007, 00:02   #3
 
swords's Avatar
 
elite*gold: 20
Join Date: Dec 2005
Posts: 811
Received Thanks: 352
Very good, as an AutoIt coder myself it explains a lot...

But why start off the bat with functions? I made an awesome macro/bot with just mouseclicks...

May try starting them off with mouseclicks to be a bit more simpler?

But still a good guide
swords is offline  
Old 12/14/2007, 00:36   #4
 
Hiyoal's Avatar
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,066
@biertje!:
Autoit can manage to send keys to inactive Conquer Windows or ids. That is going to be posted in either my second guide or 3rd

@swords:
Im starting Mouse clicks and GUI's in the second guide. I will try to explain everything in detail but i used Functions first because it sets a base for a more organised and better macro, even when using mouse clicks.

Hiyoal
Hiyoal is offline  
Old 12/14/2007, 03:05   #5
 
elite*gold: 0
Join Date: Nov 2007
Posts: 223
Received Thanks: 34
TY! by the way i sended u a PM
HackforLive is offline  
Old 12/15/2007, 08:43   #6
 
elite*gold: 0
Join Date: Jul 2007
Posts: 18
Received Thanks: 20
Wow, great guide. I can't wait for the next parts. I decided to start playing around with the program and made this script based on your guide.

------------------------------------------------------------------

Begin() ;calls the 'Begin' Function

$running = 1
$started = 0

;--------Actual instructions--------
While $running = 1

While $started = 1 ;While macro is active, it...
Send("{F2}") ;presses the F2 key
Sleep(11000) ;waits for 11000 ms/11 sec
Send("{F1}") ;presses the F1 key
Wend

Wend

;--------Functions below---------
Func Begin()
$msgbox=Msgbox(0,"How to use","Press HOME to start." & @CRLF & "Press END to stop." & @CRLF & "Press ESC to terminate the program." & @CRLF & "" & @CRLF & "Set the skill on F1, and sit on F2")
HotKeySet("{HOME}", "Start") ;Sets it so that when {HOME} is pressed, function 'Start' is called
HotKeySet("{END}", "Stop") ;Sets it so that when {END} is pressed, function 'Stop is called
HotKeySet("{ESC}", "Terminate") ;Sets it so that when {ESC} is pressed, function 'Terminate' is called
EndFunc

Func Start()
Msgbox(0,"Started","Macro started!")
$started = 1 ;'Started' equals 1, the macro loop will activate
EndFunc

Func Stop()
Msgbox(0,"Stopped","Macro stopped!")
$started = 0 ;'Started' equals 0, the macro loop will deactivate
EndFunc

Func Terminate()
Msgbox(0,"Exited","Macro has been exited!")
Exit ;Exits the program
EndFunc

------------------------------------------------------

Basically, its a Guard/Meditate/SH leveler. It's not hooked to ConquerOnline yet, but I hope that can be explained later on. Whoever wants to use this script can, just don't claim it as your own.

Again, I thank you for this guide and cannot wait for its next parts.
DaSpy is offline  
Old 12/16/2007, 01:21   #7
 
Hiyoal's Avatar
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,066
Nice. Im glad people understand this guide.

Ty for all your appreciation

Hiyoal
Hiyoal is offline  
Old 12/18/2007, 18:23   #8
 
TekiJinn's Avatar
 
elite*gold: 0
Join Date: Jan 2006
Posts: 125
Received Thanks: 2
Wow man I used to be a 100% Auto Hot Key scripter now I have some AutoIt scripting to learn! and its even EASIER then Auto Hot Key, Thanks for the tutorial man +thanks.
TekiJinn is offline  
Old 12/20/2007, 21:09   #9
 
a1blaster's Avatar
 
elite*gold: 0
Join Date: Jan 2006
Posts: 3,487
Received Thanks: 1,960
Hey just to let you know I changed the title of this thread to reflect on the title of PART2 that you released.
a1blaster is offline  
Old 01/17/2008, 02:46   #10
 
elite*gold: 0
Join Date: Jan 2008
Posts: 42
Received Thanks: 3
hey man im new at this and wanted to ask some questions:
  • what do you do with the code when it is finished
  • is there like a test or run button for the script?
  • how do people make their bots into downloadable windows?

that is all
plz answer, thanks
aydem22 is offline  
Old 01/19/2008, 02:11   #11
 
Scottbee's Avatar
 
elite*gold: 0
Join Date: Dec 2006
Posts: 155
Received Thanks: 53
great thnx
Scottbee is offline  
Old 01/19/2008, 21:48   #12
 
Hiyoal's Avatar
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,066
Sorry for not answering your question earlier aydem22.

1. When the code is finished, you can test run it by staying in the editors window and pressing "F5". This will start your program and you will see an icon in your tasktray which is an autoit icon. This means it is running.
You can also run it by finding your file as if you were going to open it, right mouse click on it, and select "Run Script".

P.S. You will not see an icon if your script contains the code "#notrayincon"

2. People make downloadable EXE files by "Compiling" their script. To do this, you can either:

1. Right mouse click on your file and select "Compile Script"
2. Goto your \Autoit3\aut2exe\ folder (default install location is c:\program files\autoit3\aut2exe). Find "Aut2exe.exe" and run it. You should then be able to figure out the rest.

Hiyoal
Hiyoal is offline  
Thanks
1 User
Old 03/13/2008, 18:00   #13
 
elite*gold: 0
Join Date: Aug 2007
Posts: 98
Received Thanks: 15
u know i took a computer science class this year cause of u..but my stupid teacher is doing visual basic lol
kashman7000 is offline  
Old 03/13/2008, 18:21   #14
 
plaa's Avatar
 
elite*gold: 0
Join Date: Jun 2006
Posts: 43
Received Thanks: 1
Really nice , good for noobs *not anymore those requests ! >*
plaa is offline  
Old 03/13/2008, 22:58   #15
 
AcidTrix's Avatar
 
elite*gold: 0
Join Date: Oct 2007
Posts: 71
Received Thanks: 26
Sorry to say this....but...I love you.....

This has been a awesome thread in my eyes. Helped me alot in many ways.

+K for sureeee

Yours truely, ACID
AcidTrix 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
BIG REQUEST full guide for making a 5165 server up and running full
02/19/2010 - CO2 Private Server - 2 Replies
hi guy i need sirieus help i want to start a own private server but dont know how can anybody make me a guide where i can find full info how to maken how to instal with working links of all programs clients regpage and patches i need plz can sombody help me:( i got nothing i want to start it dont know how it al work hopefull can sombody help me with it and make me a good easy guide for a 5165 server up and running wanne know from wat clien i have to start what program for making it...



All times are GMT +2. The time now is 15:38.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.