Sign in to follow this  
Followers 0
muzle6074

Help with amature bot script

20 posts in this topic

Hi guys!

I'm making an anti-afk bot for an RPG I play because if you stand still for to long in a particular area then you get booted. The script currently sends ("{SPACE}") key stroke every 2 minutes. I didnt want this to be a consistent 2 minutes(because may get detected) so is there a way I could make it a randomized time between 90 & 120 seconds?

Here is my current code...

$szTitle = "World of Warcraft"

WinWaitActive($szTitle);Wait for WoW window
WinMove($szTitle, "", 0, 0, 1570, 1000);Move and resize WoW window

While 1 = 1;While always True
    Sleep(120000)
    Send("{SPACE}")
    WEnd

I was also wondering is there a way to find an x & y location in a game screen so I can perform a mouse click on a certain event?

All help appreciated!

- muzle6074

Share this post


Link to post
Share on other sites



I was also wondering is there a way to find an x & y location in a game screen so I can perform a mouse click on a certain event?

PixelSearch(), i think it's a bit hard, especially with WoW. Btw, does the send(space) work? I thought it's blocked.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks for the quick response Aassdd

Yes so far all keys I have sent to WoW have worked.

EDIT: Thx Jex I'll see how it goes.

Edited by muzle6074

Share this post


Link to post
Share on other sites

Can anybody give me an example on how to use PixelSearch()? I want to find a button in the middle of the screen that's red or even if there is a way to click the middle of the screen using co-ords?

Share this post


Link to post
Share on other sites

Can anybody give me an example on how to use PixelSearch()? I want to find a button in the middle of the screen that's red or even if there is a way to click the middle of the screen using co-ords?

Use window info to get the buttons color code and use it with pixelsearch.

Share this post


Link to post
Share on other sites

Hey guys this is a practice script I use to test if I could get pixelsearch to work but as you can see I'm very new to this :)

Can someone tell me the syntax please?

$szTitle = "World of Warcraft"

WinWaitActive($szTitle);Wait for WoW window
WinMove($szTitle, "", 0, 0, 1570, 1000);Move and resize WoW window
$rez = PixelSearch(CD140B)

While 1 = 1;While always True
    Sleep(random(1000, 2000, 1))
    MouseMove($rez)
    MouseClick("{LEFT}")
    Sleep(random(1000, 2000, 1))
    Send("{SPACE}")
    WEnd

Share this post


Link to post
Share on other sites

Can anybody give me an example on how to use PixelSearch()? I want to find a button in the middle of the screen that's red or even if there is a way to click the middle of the screen using co-ords?

#Include <misc.au3>
$Dll = DllOpen("User32.Dll")
HotKeySet("{ESC}","qt")
MsgBox(0,"HowTo","Hold your mouse over the color you want, then click mouse1")
While 1
IF _IsPressed("01", $Dll) Then
$pos = MouseGetPos()
$var = PixelGetColor( $pos[0] , $pos[1] )
MsgBox(0,"The decmial color is", $var)
MsgBox(0,"The hex color is", Hex($var, 6))
MsgBox(0,"Exit","Press ESC if you are done")
EndIf
WEnd
DllClose($Dll)
Func qt()
Exit
EndFunc

This Script will give you the HEX and Decimal of the color.

Sleep(1000)
 $c=PixelSearch(7,77,1245,922,4936024)
If IsArray($c) Then MouseMove($c[0], $c[1])

This script will Move the mouse to the selected color. For more info lookup PixelSearch in the help file.

Share this post


Link to post
Share on other sites

Thanks for prompt response Bonchen!

Where do i put that in my script? also u got msg boxs in there which i cant have in game or is that an example script? All I'm wanting to do is find 1 pixel in the game window.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Thanks for prompt response Bonchen!

Where do i put that in my script? also u got msg boxs in there which i cant have in game or is that an example script? All I'm wanting to do is find 1 pixel in the game window.

The MsgBoxes are there to help you, however you can remove all the MsgBoxes except MsgBox(0,"The decmial color is", $var) and

MsgBox(0,"The hex color is", Hex($var, 6)), Because you need the color. Oh and by the way, you can save this script as "Color.au3"

I think you can but the PixelSearch whereever you want.

Edited by Bonchen

Share this post


Link to post
Share on other sites

Thanks again for the prompt response but I'm still struggling to comprehend how PixelSearch() works.

Please dont laugh at me :)

$szTitle = "World of Warcraft"

WinWaitActive($szTitle);Wait for WoW window
WinMove($szTitle, "", 0, 0, 1570, 1000);Move and resize WoW window

While 1 = 1;While always True
    Sleep(random(1000, 2000, 1))
    $c=PixelSearch(7,77,1245,922,4936024)
    If IsArray($c) Then MouseMove($c[0], $c[1])
    MouseClick("{LEFT}")
    Sleep(random(1000, 2000, 1))
    Send("{SPACE}")
WEnd

Can you please explain the parameters in PixelSearch()? I might understand better.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thanks again for the prompt response but I'm still struggling to comprehend how PixelSearch() works.

Please don’t laugh at me… :)

$szTitle = "World of Warcraft"

WinWaitActive($szTitle);Wait for WoW window
WinMove($szTitle, "", 0, 0, 1570, 1000);Move and resize WoW window

While 1 = 1;While always True
    Sleep(random(1000, 2000, 1))
    $c=PixelSearch(7,77,1245,922,4936024)
    If IsArray($c) Then MouseMove($c[0], $c[1])
    MouseClick("{LEFT}")
    Sleep(random(1000, 2000, 1))
    Send("{SPACE}")
WEnd

Can you please explain the parameters in PixelSearch()? I might understand better.

First you need to run the color script i gave you. Then go ingame and press mouse1 on the red color. When a window called "The decimal color is" pops up, you go to you'r script and type in the numbers that are shown in the popup window on this line: $Color =. So the code will look like this.

$szTitle = "World of Warcraft"

WinWaitActive($szTitle);Wait for WoW window
WinMove($szTitle, "", 0, 0, 1570, 1000);Move and resize WoW window
$Color = TheNumbersYouGot
While 1 = 1;While always True
    Sleep(random(1000, 2000, 1))
    $c=PixelSearch(5,8,1277,968,$Color)
    If IsArray($c) Then MouseClick("Left",$c[0], $c[1],1,0)
    Sleep(random(1000, 2000, 1))
    Send("{SPACE}")
WEnd

I hope you understand. I'm not very good at explainig. Oh and by the way, the script I posted should work.

Edited by Bonchen

Share this post


Link to post
Share on other sites

Thanks again Bonchen for your input. Yes I do understand it a bit better now and the script sort of works. I'm struggling to get it to select the right color but ill get there in the end :)

I was just wondering what the parameters "5,8,1277,968" mean in $c=PixelSearch(5,8,1277,968,$Color)

Share this post


Link to post
Share on other sites

Thanks again Bonchen for your input. Yes I do understand it a bit better now and the script sort of works. I'm struggling to get it to select the right color but ill get there in the end :)

I was just wondering what the parameters "5,8,1277,968" mean in $c=PixelSearch(5,8,1277,968,$Color)

5,8 Is The coordinate of the top left corner of World of Warcraft.

1277,968 Is The coordinate of the bottom right corner of World of Warcraft.

PixelSearch searches after the color between these two coordinates.

If you want the script to use other coordinates you can use this scritp:

#Include <misc.au3>
$Dll = DllOpen("User32.Dll")
HotKeySet("{ESC}","qt")
While 1
IF _IsPressed("01", $Dll) Then
$pos = MouseGetPos()
MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])
EndIf
WEnd
DllClose($Dll)
Func qt()
Exit
EndFunc

This works exactly as the Color script.

Share this post


Link to post
Share on other sites

Thank you so much Bonchen!

I understand the functionality of pixel search now and your little scripts you made for me have been a great help!

Regards

- muzle6074

Share this post


Link to post
Share on other sites

you do know this is a noob post for a reason right?...


[center][/center]

Share this post


Link to post
Share on other sites

Hi DBak,

What are you referring to? If you mean how noob I am at Autoit then yes I only just started 2-3 days ago lol. The script works and prevents me from been booted from my game so it's an anti afk script as I wanted :)

Share this post


Link to post
Share on other sites

Hello,

I want you to know a little about me, DBaK,

I love to help and inspire noobs BUT I highly dislike users (mostly noobs do this) that make bots to cheat in there games. You are the ones that take all the fun out of it. But, if you need help with a real script that has a non-cheating purpose I'd be glad to help! Like my media player it has an actual purpose, and it isn't helping me cheat when I play my games. Not trying to be an A$$ to you or just be red with noobs but I dislike bots. Besides that I'm really cool...


[center][/center]

Share this post


Link to post
Share on other sites

DBak,

That's understandable. It does take the fun out of the game but in this specific game (World of Warcraft) there is a major AFK problem and the team I have to side with has 98-99% lose rate which defeats the purpose of playing. Having an AFK script means that I don't have to waste my time until they fix the problem.

Don't get me wrong I know where youre coming from.

- muzle6074

Share this post


Link to post
Share on other sites

good I'm glad you undstand lol see here for another nagging of bot requests

Anyway I can understand that situtation but I still will not help with a bot I don't have many posts but I am skilled scripter and I like helping noobs with USEFULL things so let me know if you need help!


[center][/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0