Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 20:35

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

Advertisement



Making a simple bot for 2D game

Discussion on Making a simple bot for 2D game within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2016
Posts: 1
Received Thanks: 0
Making a simple bot for 2D game

Hi. I am trying to make a simple bot in AutoIt for a old school mmo.
I am currently using AHK but i feel the pixelsearch in AutoIt works better.

So fare i have changed the desired sprites in the game so they have a blue square with hexcolor 0x0000FF, that i use durring pixelsearch, and a part that checks for my HP and pots if nessesary.

My problem is in AHK i could do Click, x, y, down to attack a monster for a specific amount of time. Cant rly seem to get that to work in AutoIt - the mouseMove then mouseDown seems unreliable.


Also any suggestions on anything i can improve ?

Code:
HotKeySet("!q", "Terminate")
HotKeySet("!a", "attackLoop")
HotKeySet("!e", "autoPot")

WinActivate("Lineage")

Global $interval
$interval = 5000
$hpcolor = 0x7B3029


Func Terminate()
   Exit 1
EndFunc



Local $aColorArray[1] = [ 0x0000FF]


Func attackLoop()
   While 1
	  $point = PixelSearch(275,192,445,296,$aColorArray)   %% Search a small box around target for monsters
	  $point2 = PixelSearch(228,158,350,252,$aColorArray) %% search a bigger box around target for monsters
		 if IsArray($point) Then
			MouseMove($point[0], $point[1])
                        MouseDown("left")
			Sleep($interval)
                        MouseUp("left")
		 ElseIf IsArray($point2) Then
			MouseMove($point2[0], $point2[1])
			MouseDown("left")
			Sleep($interval)
                        MouseUp("left")
		 Else
			Send("{F7}") % Random teleports to a new area.
			Sleep(3000)
		 EndIf
		 Sleep(50)
   WEnd
EndFunc


Func autoPot()
   While 1
		$pot = PixelGetColor(110,437)
		if $pot = $hpcolor Then

		   sleep(1000)
		Else
		   Send("{F5}")
		   sleep(1000)
		EndIf

   WEnd

   EndFunc

While 1
   Sleep(250)
WEnd
mpaulsen is offline  
Old 04/03/2016, 19:22   #2
 
alexutu2013's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 229
Received Thanks: 66
why you don't use MouseClick instead mousedown/up?
alexutu2013 is offline  
Old 04/04/2016, 05:48   #3

 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,494
Received Thanks: 1,769
If MouseDown and MouseUp doesn't work you can try out AutoItSetOption with the
Moneypulation is offline  
Old 04/13/2016, 00:33   #4
 
HaMaDa..'s Avatar
 
elite*gold: 37
Join Date: May 2014
Posts: 1,835
Received Thanks: 9,833
Why u don't use mouseclick or controlclick instead of down/up ?

MouseClick("Left / right",x,y)
ControlClick("Your game title","","","Left/right",1000 ; clicks,x,y)
HaMaDa.. is offline  
Reply

Tags
2d, bot, lineage, mmo


Similar Threads Similar Threads
Need Help making this simple app
03/22/2015 - General Coding - 1 Replies
hello I want make an application that answears me with X(if answear is true) or (O if answear is wrong) so how could I make something like this? I asked a friend and he told me "If I was you I would create a program which lets you insert questions with the correct answer and tags for the question. Then add a textbox where you can insert tags (space separated or however you prefer) and the program looks through all questions via the entered tags and shows you all fitting questions with...
[Help] Making a simple server
05/15/2010 - EO PServer Hosting - 6 Replies
step by step teach me make a simple server...1by1:handsdown::handsdown: im to noob n beginner 4 all this..realy 1 2 know how n how...im on9 at this forum 20hour a day...just leave msg n guide:handsdown::handsdown:thank you
Simple Tut...Making E*PVP easier.
12/23/2008 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 5 Replies
Sorry...I don't know what forum to put this in so if it's in the wrong one...sorry. ANYWAYS,this is for all the newbs coming here and not knowing what to do or where to go first. This is just one of those things that could go in either forum it's just based on whatever opinion the mods/admins/guards/etc. have I spose and I'm sure someone will move it if they find so fit. I made this tutorial becuase I had the idea while I was reading some threads here. I notice that there is a lot of newbs...
[Release]making a very simple reg. page
09/30/2008 - CO2 Private Server - 0 Replies
This guide was made by me O.O so no stealy plx. Ok so before we begin you wiill have to download the following things : Appserv : SourceForge.net: Downloading ... My Reg. Page files : RapidShare: Easy Filehosting now if you already have a full running server, please make a back up...i wont explain how, but just make one so people wont lose their accs. Ok so lets start :
i need help making a simple bot
06/16/2007 - Conquer Online 2 - 0 Replies
first of all i searched for how to make a bot but didnt find anything so i do appologize if this is a repost .i am trying to create my first lvling/hunting bot i want it to do the following things: -heal -pick up items and money, including comand tokens -possibally disconnect when ur getting pked i am very very new to making a bot of any kind so i dont know what program i should even use so pls someone help me out it would be very much appriciated i give karma to anyone that helps me and if...



All times are GMT +1. The time now is 20:35.


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