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 15:56

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

 

[GUIDE]AutoIt Part 2. 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 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 fundamentals in my previous Basic Guide on how to create Bots and Macros for RF Online 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
• MouseClick
• MouseMove
• MouseGetPos
• MouseClickDrag
• MouseDown and MouseUp
• MouseWheel

3. What are GUI’s?
4. Creating a GUI
• Making Transparent

5. Incorporating past knowledge into GUI
6. Debugging Code


1. AutoIt Window Info

In this tutorial I will be using AutoIt Window Info for both Mouse Functions and GUI. AutoIt Window Info can be found in your AutoIt folder. Eg. “C:\Program Files\AutoIt3\Au3info.exe”. This program enables you to get information about a program which you can use for GUI and mouse such as finding what coordinates your mouse is at.

2. Mouse Functions

RF Online is a clicking game. You don’t use the arrow keys much, so for making Bots and Macros for RF Online you need to incorporate the mouse. AutoIt scripting supports mouse functions in all the ways you will ever need it to.

• MouseClick
MouseClick is a function which tells the cursor in Windows to click. You can specify which button you want clicked, where you want it clicked and how many clicks you want the macro to send to the mouse.

Eg. This is an example of the MouseClick Function.

Quote:
Originally Posted by Hiyoal
MouseClick("Left",76, 749,1) ;Order of operations are "MouseClick" function, "Mousebutton" being used, "x" and "y" pixel axis of screen, "clicks" the number of clicks
Sleep(2000) ;stalls program for 2 seconds
MouseClick("Left",981, 757,2) ;clicks on your Time bar
• MouseMove

MouseMove is a function which tells the cursor in windows to change its position (measured in pixels). You can specify where to move the mouse and how fast it should change its position (Range: 0 “Fastest”, 100 “Slowest”)

Eg. This is an example of the MouseMove Function.

Quote:
Originally Posted by Hiyoal
MouseMove(10,10,0) ;moves mouse to points 10,10 (pixels) in an instant
Sleep(5000) ;stalls for 5 seconds
MouseMove(100,57,50) ;moves mouse to points 100,57 (pixels) slower than first mousemove
• MouseGetPos

MouseGetPos is a function which tells the program where your mouse is (x and y values of coordinates). This can be used to make an autoclicker for RF Online but to specify where the mouse is for the MouseClick function, you need to make a declaration before so that the program can read where the mouse is and store it, not just find where the mouse is and never use it.

Eg. This is an example of an autoclicker

Quote:
Originally Posted by Hiyoal
Global $counter=0 ;globally declare $counter to the program, not just as a variable contained in a Function

While 1
HotKeySet("{INSERT}","Start")
HotKeySet("{END}","END")
WEnd

Func Start()
$counter=1
While $counter=1
$getpos=MouseGetPos() ;finds where the mouse is at (in x and y coordinates)
MouseClick("Left",$getpos[0],$getpos[1],1) ;$getpos[0] is the x coordinate number from MouseGetPos and $getpos[1] is the y coordinate number from MouseGetPos
WEnd
EndFunc


Func End()
$counter=0
EndFunc
• MouseClickDrag

MouseClickDrag is a function which tells the mouse to click at a coordinate and hold down the mouse button and move to another coordinate. This can be used to make an Autotrader in RF Online or an Autodropper.

Eg. Here is an example of the mouseclickdrag function.

Quote:
Originally Posted by Hiyoal
MouseClickDrag("left", 0, 200, 600, 700, 5) ;Order: “Button”, “x” coord (#1), “y” coord (#1), “x” coord (#2), “y” coord (#2), “Speed”
• MouseDown and MouseUp

MouseDown is a function which tells the mouse to hold down the mousebutton until the MouseUp function is called.

Eg. This is how you can incorporate MouseDown and MouseUp Functions in AutoIt

Quote:
Originally Posted by Hiyoal
MouseDown(“Left”)
Sleep(10000)
MouseUp(“Left”)
• MouseWheel

MouseWheel is a function which tells the cursor or mouse functions for 2000/NT/XP to move the mousewheel in a direction for a certain amount of repetitions. This could be used in RF Online for zooming in and out.

Eg.

Quote:
Originally Posted by Hiyoal
MouseWheel(“Down”,10) ;moves the mousewheel down 10 times (in clicks)
MouseWheel(“Up”,10) ;moves the mousewheel up 10 times (in clicks)
__________________________________________________ __________________________________________________ _________________________

3. What are GUI’s?

GUI stands for Graphical User Interface. This is User friendly and it is better to use a GUI instead of giving prompts such as MsgBoxes. You can also make it look nice and it gives the User an image to refer to instead of just pressing buttons and not knowing what they are doing.

4. Creating a GUI

GUI is Extremely Hard to create when writing code. It is much better if you can use your mouse to click and drag, resize and customise the look without debugging code continually. So… I have found a program on the internet called .
It is a visual GUI creator which makes creating GUI for AutoIt much faster then writing code.

If you are going to code GUI then always start off the coding with “#include <GUIConstants.au3>”

You must register and activate your account in order to view images.

KODA is pretty straight forward to use but I have realised that it does not include Transparency for Labels in the Styles or ExStyles tabs. I have also figured out how to make transparent labels from making
THIS:
You must register and activate your account in order to view images.

Into THIS:
You must register and activate your account in order to view images.

• Making Transparent

To make transparent labels (only show text, doesn’t show grey background when on top of a picture), Generate Code You must register and activate your account in order to view images. from a GUI script with a background and a label in it, and copy and paste into an *.au3 file.

Next, open the script ([Edit script], not [Run script]) and find the words “GUICtrlCreateLabel”

Quote:
Originally Posted by Hiyoal
$Label1 = GUICtrlCreateLabel("Hello", 208, 40, 48, 28)
Now enter down a line from the end of $label1 and write “GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

Quote:
Originally Posted by Hiyoal
$Label1 = GUICtrlCreateLabel("Hello", 208, 40, 48, 28)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
as so.

Now you have Transparent Labels!!!

5. Incorporating past knowledge into GUI

From what we have learnt so far in creating and writing code in AutoIt, I can now explain how to make a GUI which…FUNCTIONS. If you just create a GUI with buttons and other fancy things but do not include any written code from the Part 1 Guide, Mouse Functions or File Read Functions then the program will do NOTHING.

Here is a template in which I have explained how to incorporate past knowledge into GUI. Open this up using SciTE editor and read the green lines if you do not understand how something works.



6. Debugging Code

If you ever want to know a value of a returned $variable then use MsgBoxes. I use these all the time to see whether a function has failed or succeeded in running through the code. You can check what some different values will return in AutoIt if you read the Help File. This is how I have learnt all the things I have been teaching you.

An example of debugging is:

Quote:
Originally Posted by Hiyoal

$value=Msgbox(3, “Test”, “Click on the buttons below and I can you can see what each returns”)
Msgbox(0, “”, $value)
You can now see that if you press the button:
“Yes”:: it will receive the value “6”
“No”:: it will receive the value “7”
“Cancel”:: it will receive the value “2”

You can now write code like this:

Quote:
Originally Posted by Hiyoal

$value=Msgbox(3, “Test”, “Click on the buttons below and I can you can see what each returns”)

If $value=6 Then
Msgbox(0, “”, “You pressed Yes”)
Exit
ElseIf $value=7 Then
Msgbox(0, “”, “You pressed No”)
Exit
ElseIf $value=2 Then
Msgbox(0, “”, “You pressed Cancel”)
EndIf
One last thing I have not pointed out with AutoIt scripting is that when you use the instance “InputBox”, you cannot just close it when it are in use (You can click the X button, but the Box will not close). I have not explained InputBoxes but by reading the prompts when in SciTE, you will be able to determine how they work.

To fix this “Close” error use code like this:

Quote:
Originally Posted by Hiyoal
$value=InputBox("Test", "Press the X Button","","")
If @error=1 Then
Msgbox(0,"","Close")
Exit
EndIf
That is the end of my Part 2 guide to creating Bots/Macros yourself.

I hope you have all found this very helpful because it has taken me a long time to write and edit this.

Written by Hiyoal
For ElitePvPers

Hiyoal



Hiyoal is offline  
Thanks
15 Users
Old   #2
 
elite*gold: 0
Join Date: Nov 2007
Posts: 111
Received Thanks: 83
Nice tut Hiyoal , I guess Part 3 will be about PixelSearch Function of AutoIt


spin_roan is offline  
Old   #3
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Quote:
Originally Posted by spin_roan View Post
Nice tut Hiyoal , I guess Part 3 will be about PixelSearch Function of AutoIt
If i have time too, Ill actually have to learn pixel functions...LOL!!

Part 3 would probably include both Pixel functions and Memory Reading/Writing.

Hiyoal
Hiyoal is offline  
Old   #4
 
elite*gold: 0
Join Date: Apr 2008
Posts: 219
Received Thanks: 366
nice work =) +1 thanks to you


zereke is offline  
Old   #5
 
elite*gold: 0
Join Date: Nov 2007
Posts: 111
Received Thanks: 83
Quote:
Originally Posted by hiyoal View Post
If i have time too, Ill actually have to learn pixel functions...LOL!!

Part 3 would probably include both Pixel functions and Memory Reading/Writing.

Hiyoal
Memory Read/Write using AutoIt it will be a very nice TUT

But on my experience this process slows down my bot
spin_roan is offline  
Old   #6
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Memory reading and writing do not slow down botting unless it is coded wrong.
All of my memory bots run at the same speed and functions for memory bots are less limited than that of a pixel bot.

Hiyoal
Hiyoal is offline  
Old   #7
 
elite*gold: 0
Join Date: Nov 2007
Posts: 111
Received Thanks: 83
But the good thing about RF is that it has its own Auto Pots unlike other online games I need to run an Auto Pot script while playing.
spin_roan is offline  
Old   #8
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Yea, that is good
Hiyoal is offline  
Thanks
1 User
Old   #9
 
elite*gold: 0
Join Date: Apr 2008
Posts: 7
Received Thanks: 0
hmmmm..... nice
happytop is offline  
Old   #10
 
elite*gold: 0
Join Date: Jun 2008
Posts: 4
Received Thanks: 0
Thanks a lot to people like you. We are learning a lot. Keep it up bro.

Can I PM you if I have some queries?
xyzLabrador is offline  
Old   #11
 
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,063
Lol sure. Any queries at all
Hiyoal is offline  
Old   #12
 
elite*gold: 0
Join Date: May 2006
Posts: 1
Received Thanks: 0
Great tutorial, I have read part 1 and 2, and I begin to make some little scripts for myself, but at one point I get stuck, because like you said, "
Quote:
If you just create a GUI with buttons and other fancy things but do not include any written code from the Part 1 Guide, Mouse Functions or File Read Functions then the program will do NOTHING."
And the fact is that your Download Link which explains all is dead >.<
Is it possible for you to re-upload it ?

Sorry for my bad english and for my query on a topic which has nothing new since 07/2008, but it's too bad I can't use all of your great guide...

Thanks in advance.
Julien is offline  
Old   #13
 
elite*gold: 0
Join Date: Jun 2006
Posts: 17
Received Thanks: 8
nice tut.

at the moment i try to figure out how to set an autolooter up, that only loots the stuff u want.
for example just the excelsior pieces, any ideas how to solve that.

i dont know if there is any compare method, or do i have to use CE aswell...

any ideas?

ps. german answer is appreciate
TwixMan is offline  
Old   #14
 
elite*gold: 0
Join Date: Dec 2008
Posts: 6
Received Thanks: 0
Hey man,where do you learned all this stuffs about AutoIt ? Can you give me the book or something ?


StaneMkd is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[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...
33 Replies - RFO Hacks, Bots, Cheats, Exploits & Guides
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



All times are GMT +1. The time now is 15:56.


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.