Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > RF Online > RFO Hacks, Bots, Cheats, Exploits & Guides
You last visited: Today at 14:05

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

 

[GUIDE]AutoIt Part 1. Building Bots/Macros for Newbies

Reply
 
Old   #1
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Thumbs up [GUIDE]AutoIt Part 1. Building Bots/Macros for Newbies

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(“RF Online”)” then I would write “$ANYTHINGHERE=ProcessExists(“RF Online”)”.
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. You will have to program your AutoIt script to “Sleep” for an amount of time to allow functions such as HP Regeneration time, FP Regeneration time etc.
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 (From Conquer Online 2.0).

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
19 Users
Old   #2
 
elite*gold: 0
Join Date: Feb 2008
Posts: 84
Received Thanks: 15
ERROR

Quote:
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
im just trying it to call function, use this tut like autoloot while im pressing to turn it on or off but give this error on your sample. tnx

Quote:
Unable to parse line.:
HotKeySet(?{INSERT}?,?Start?)
HotKeySet(^ ERROR
>Exit code: 1 Time: 0.206


kramkram is offline  
Old   #3
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
The quotation marks from websites are not recognised by autoit. Just delete the quotation marks you copied across and then just put in the quotation marks.
Basically just delete and input the quotation marks again.

Notice the ? where the error is?!

Hiyoal
Hiyoal is offline  
Old   #4
 
elite*gold: 0
Join Date: Feb 2008
Posts: 84
Received Thanks: 15
hehehe typo

yep I notice it a while ago I just retype it, by the way how can I stop function to terminate it?


Func Start()
MsgBox(0, "Start", "Starting The AFK PArty Heal")
$i = 0
While $i = 0
Sleep(1300)
Send ("F1")
Sleep(1300)
Send ("F2")
Sleep(60000)
Send ("F3")
WEnd
EndFunc

Func End()
$i = 0
While $i = 0
$i=$i+1
WEnd
EndFunc


I just want to terminate the first function with out exiting the program, just new in this autoit if there a syntax with do while or while do hekhekhek


Quote:
WinActivate("RF Online")
While 1
HotKeySet("{Home}","Start")
HotKeySet("{End}","End")
Wend

Func Start()
MsgBox(0, "Start", "Starting The Afk Buffer")
= 0
While = 0
Sleep(1300)
Send ("F1")
Sleep(1300)
Send ("F2")
WEnd
EndFunc

Func End()
Sleep(600000)
EndFunc
my first ever afk heal Press Home it will start press end it will pause it will not exit the program so if you are a SC in game and need to do quick instead putting coin in keyboard you can use this just compile and ready to go hehhehe thanks to hiyoal.


kramkram is offline  
Old   #5
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
You could always try this:

Code:
WinActivate("RF Online")
[COLOR="Red"]Global $i=1[/COLOR] ;Declared this at the start so that it is available to all functions. Global command!
While 1
HotKeySet("{Home}","Start")
HotKeySet("{End}","End")
HotKeySet("{F11}","ExitLoops")
Wend

Func Start()
MsgBox(0, "Start", "Starting The Afk Buffer")
$i= 0
While $i= 0
Sleep(1300)
Send ("[COLOR="Red"]{[/COLOR]F1[COLOR="Red"]}[/COLOR]"); I assume you are using the "F1" Key. Use Send("{F1}") to send that actual key, because atm it is sending the keys F and then the key 1.
Sleep(1300)
Send ("[COLOR="Red"]{[/COLOR]F2[COLOR="Red"]}[/COLOR]") ; I assume you are using the "F2" Key. Use Send("{F2}") to send that actual key, because atm it is sending the keys F and then the key 2.
MsgBox(0,"","s")
WEnd
MsgBox(0,"","E")
EndFunc

Func ExitLoops()
	$i=1 ;this exits the loop because the While command now finds that the  variable is not equal to 0
EndFunc

Func End()
Exit
EndFunc
Ive also uploaded the script, to avoid comma error notation.
All comments are listed and all symbols listed in red are errors I have fixed.

Hiyoal
Attached Files
File Type: rar sample.rar (500 Bytes, 205 views)
Hiyoal is offline  
Old   #6
 
elite*gold: 0
Join Date: Feb 2008
Posts: 84
Received Thanks: 15
Oh I see my mistake I did not declare the variable as global,
Global $i=1
it was just inside the function thats why when I try to increment the value of the variable doest increase.
Func End()
$i= 0
While $i = 0
$i = $i + 1
WEnd
EndFunc


that is why I just make a sleep for long time hehhehe. now im starting to learn autoit. is there any available Syntax for Autoit I tried to search but no luck. they where just always samle.

is it ok on posting here since this is for tuto?
kramkram is offline  
Old   #7
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
The syntax for AutoIt is basically its own script. I learned the ins and outs of autoit from reading the help file and learning about all its parameters and putting them into projects.

I can see that you understand your mistake, thats really good !!
You can post on this thread, thats absolutely fine

Hiyoal
Hiyoal is offline  
Thanks
1 User
Old   #8
 
elite*gold: 0
Join Date: Oct 2007
Posts: 3
Received Thanks: 0
Hello !

I made this code to try
Code:
WinActivate("RF Online")
Start()


Func Start()
	Global  = False
	
	While  = False
		HotKeySet("{Home}","HelloFunc")
	WEnd
	
EndFunc

Func HelloFunc()
	MsgBox(0, "Stop", "Stop The Afk Buffer")
	 = True	
EndFunc
All work without the "WinActivate("RF Online")" but
if i set "WinActivate("RF Online")" the hotkeyset don't work on the game
How do you manage to make it work in the RFO window ?

oups there is a bug with my $var the forum remove it
kazbot is offline  
Old   #9
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Unless RF Online has hotkeys which are using {HOME}, it should work. RF Online may also be reserving all keys, are you in keyboard mode??

Hiyoal
Hiyoal is offline  
Old   #10
 
elite*gold: 0
Join Date: Oct 2007
Posts: 3
Received Thanks: 0
in fact it seems that rf online can stop all signal i send by autoit
because i make other scripts just with a dialog-box for exemple and it dont work at all on RFO but work wery well on other program windows

maybe i need to find a special bypass or something like that
kazbot is offline  
Old   #11
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Maybe, thats very strange, but very interesting at the same time.

Maybe you should have a look at ControlClick commands. They might come in handy

Hiyoal
Hiyoal is offline  
Old   #12
 
elite*gold: 0
Join Date: Oct 2007
Posts: 3
Received Thanks: 0
Sunday, i had swich on a computer with window xp (befor i was on my vista pc) and the script worked very well
in the game. So i think vista have some strange features which stop my script.

Now i can use your awsome language AutoIt thx
kazbot is offline  
Old   #13
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
OOO, you didnt say you have vista :O

You have to do these steps if you want it to work with Vista:
1. Right Mouse Click on "YourProgram.exe" and select "Properties"

2. Click on the "Compatibility" tab.

3. Under "Compatibility Mode", Click on the checkbox "Run this program in compatibility mode for:" and Select Windows XP (Service Pack 2) in the input box.

4. Then under "Privilege Level", select the checkbox "Run this program as an administrator"

Hiyoal
Hiyoal is offline  
Old   #14
 
elite*gold: 0
Join Date: Jun 2008
Posts: 33
Received Thanks: 2
haha
jaypulse is offline  
Old   #15
 
elite*gold: 0
Join Date: Jun 2008
Posts: 33
Received Thanks: 2
mga bano! )


jaypulse is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
The FULL guide to making your own Bots/Macros...PART 2
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...
30 Replies - CO2 Guides & Templates
[GUIDE]AutoIt Part 2. Building Bots/Macros for Newbies
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...
13 Replies - RFO Hacks, Bots, Cheats, Exploits & Guides



All times are GMT +2. The time now is 14:05.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.