italiano21 Posted August 8, 2009 Share Posted August 8, 2009 well mates, in the last few hours i've been trying to make a bot for a silly game called Deco-Online... but i don't know how to do some things... i know how to make that window the active one.. i know how to make the bot press the attack keys (1, 2, 3, 4, 5 for now)- but it wont seem to work i've tried pressing the attacks with the mouse left button - but it wont seem to work, pointer goes to the spot but i cant see no click... but i'm missing the most important part... which is.. target the nearest mob... i cant figure it out.. for starters the mobs are moving all the time... i've tried to use pixel color but the coords are not the same all the time.. then the pixel color changes too... because a mob have lots of similar colors.. (like 2 or 3 kinds of brown..) i would really aprecciate if someone could guide me into the right direction.. thanks Link to comment Share on other sites More sharing options...
italiano21 Posted August 8, 2009 Author Share Posted August 8, 2009 well yesterday i forgot to put the codes so i'll do it today... i have this code to active window $win_title = "Deco-Online" WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(10) well when i start the script the window comes on top but i think that after this it stops working... to target mobs i tried a pixel search like this while 1 While $On = True $coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5) $n = @error If NOT @error Then while $n = 0 $x = Random($coord[0], $coord[0]+40, 1) $y = Random($coord[1], $coord[1]+40, 1) MouseClick("left", $x, $y, 2, 0) $mm = PixelGetColor ( 534 , 388 ) $mob = Hex($mm, 6) If $mob = "CD2718" Then ExitLoop EndIf $coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5) $n = @error WEnd EndIf $mobgreen = the color in the mob bar $xTop,$yTop,$xBot,$yBot = Window Coords am i doing something wrong? thanks for the help Link to comment Share on other sites More sharing options...
WannaLearnPls Posted August 8, 2009 Share Posted August 8, 2009 (edited) not sure about the pixel function as i have yet to try those... but regarding the clicks, you could try holding down a bit the click so it gives the game time to "recieve" the click... you can do that by Sleep(150) MouseDown("left") ;for left clicking.. or "right" for right clicking Sleep(300) MouseUp("left") Sleep(150) or Opt("MouseClickDownDelay", 300) ;this way all your clicks will be pressed for 0.3 seconds if those dont work... i got no idea what would it be.. hopefully this will work >_< Edited August 8, 2009 by WannaLearnPls Link to comment Share on other sites More sharing options...
italiano21 Posted August 8, 2009 Author Share Posted August 8, 2009 should i use any pixelcoordmode? i've seen some cases where it can help in the pixelsearch i'll try the code you put there >_< thanks then i'll give you feedback Link to comment Share on other sites More sharing options...
WannaLearnPls Posted August 8, 2009 Share Posted August 8, 2009 Uhm, you might try that pixel function, but as I said, I'm new to AutoIt and I have yet to try those >_ Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 8, 2009 Share Posted August 8, 2009 Opt("PixelCoordMode", 1) ;1=absolute, 0=relative, 2=client Try 2, client, that'll help I think. Also, I see 3 whiles and only 1 wend. That would definately cause a problem. - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
WannaLearnPls Posted August 8, 2009 Share Posted August 8, 2009 Hehe certainly! I didn't get to see the code so I didn't notice that >_ Link to comment Share on other sites More sharing options...
italiano21 Posted August 8, 2009 Author Share Posted August 8, 2009 wannalearn your mousedown didn't work because the mouse has to left click in the coords that have been randomized before in the variables $x and $y... so i think i just have to use mouseclick but with the opt mousedelay.. well the full code is like this right know... expandcollapse popupHotKeySet("{F1}", "_start") HotKeySet("{F2}", "_exit") $xTop = 30 $yTop = 73 $xBot = 1002 $yBot = 692 $mobGreen = "0xA5AC94" $ON = False Opt("PixelCoordMode", 1) Opt("MouseClickDelay", 300) Sleep(6000) while 1 while $ON = True $coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5) $n = @error If NOT @error Then while $n = 0 $x = Random($coord[0], $coord[0]+40, 1) $y = Random($coord[1], $coord[1]+40, 1) Sleep(150) MouseClick("left", $x, $y) Sleep(150) $mm = PixelGetColor ( 534 , 388 ) $mob = Hex($mm, 6) If $mob = "CD2718" Then ExitLoop EndIf WEnd EndIf WEnd $coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5) $n = @error wend If $mob = "CD2718" Then while $mob = "CD2718" Send("{1}") Send("{3}") Send("{2}") Send("{5}") $mm = PixelGetColor ( 534 , 388 ) $mob = Hex($mm, 6) wend Else Send("{Right 7}") Endif Func _start() $ON = True EndFunc Func _exit() $ON = False EndFunc Link to comment Share on other sites More sharing options...
italiano21 Posted August 9, 2009 Author Share Posted August 9, 2009 (edited) well the code seems right... but the _exit function seems to not be working.. code is working well out side of the game window.. within it seems the left click doesn't work... the mouse moves around searching for the mobs pixels but can't seem to find it.. maybe i have messed up the pixel colors.. but i'll try and check it again.. will try to expand the area where the pointers looks for them to a bigger one.. $x = 30 and $y = 78 seems too litle in the game window... i'll check with u guys later to tell you what happened Edited August 9, 2009 by italiano21 Link to comment Share on other sites More sharing options...
WannaLearnPls Posted August 10, 2009 Share Posted August 10, 2009 Well, to start with, you could've done the identation better, so you wouldn't get mixed up while fixing the code.. and the same for whoever looks at your code Sorta like this expandcollapse popupHotKeySet("{F1}", "_start") HotKeySet("{F2}", "_exit") $xTop = 30 $yTop = 73 $xBot = 1002 $yBot = 692 $mobGreen = "0xA5AC94" $ON = False Opt("PixelCoordMode", 1) Opt("MouseClickDelay", 300) Sleep(6000) while 1 while $ON = True $coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5) $n = @error If NOT @error Then while $n = 0 $x = Random($coord[0], $coord[0]+40, 1) $y = Random($coord[1], $coord[1]+40, 1) Sleep(150) MouseClick("left", $x, $y) Sleep(150) $mm = PixelGetColor ( 534 , 388 ) $mob = Hex($mm, 6) If $mob = "CD2718" Then ExitLoop EndIf WEnd EndIf WEnd $coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5) $n = @error wend If $mob = "CD2718" Then while $mob = "CD2718" Send("{1}") Send("{3}") Send("{2}") Send("{5}") $mm = PixelGetColor ( 534 , 388 ) $mob = Hex($mm, 6) wend Else Send("{Right 7}") Endif Func _start() $ON = True EndFunc Func _exit() $ON = False EndFunc Regarding the MouseDown and MouseUp functions.. you could use the MouseMove(x,y) function before them, and then the mouse would move as well >_< Anyway, try a bigger delay.. say 500... if that doesn't work, try a bigger one till it works? About the exiting function.. you could just make a Func _exit() While 1 Sleep(500) WEnd EndFunc and that should work as well! Anyway, you got an If statement in there (If $mob = "CD2718") which is outside of your loop.. shouldn't it be on the inside? Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now