SofaKingWeTardEd Posted December 16, 2007 Share Posted December 16, 2007 Hey again, another question. Still be very, very, very new to AutoIt, I was wondering these questions;Question 1With a Script/Bot made for anything (My case; A game), is it possible to have a Button pressed, perform script, and wait till the button is pressed again? Like the MsgBox command, but whenever "OK" is pressed, it performs this act within the game. Still keeping that option up and not exiting.If you don't understand what I mean, I can always try and explain a little more 'detailed'.Question 2This one, I may just be using my imagination a little too much. But, i'm not fully aware of AutoIt's functions. :"> Within a downloaded game (not browser based), there is a "Ani" folder. This is used for Animated Cursors, what define what character people use and what graphical interface they are shown as. I was wondering with AutoIt, is it possible to detect that 'Ani' within the playing game? And, if possible for a AutoIt script to react and click on that Ani shown on screen. I tried the AutoIt Window Info program, but it doesn't show anything more than the Client area. If you could link AutoIt commands with the specific Ani within the folder to react, a code would be greatly appreciated. ^^Question 3This one also, may be me over thinking. The game I play, has a "Map" folder, with every map defined what to show to you. Now, these maps aren't very large (No more than 60kb in size). How the game is based, is via Coords in the game. Like "You are standing at: 110,49". I guess this could be related to Question 2 in some sort. If it is possible, is it able to be used?I'm sorry if i'm asking for far too much, but I would really hope for these to work. I'm not sure what I am asking for is to be considered hacking, or using the fuctions AutoIt provides.If I have overstepped any border, I am truely sorry and I would not mind if a person of authority was to delete this thread.Thank you. Link to comment Share on other sites More sharing options...
Paulie Posted December 16, 2007 Share Posted December 16, 2007 I don't fully understand #2 and #3, but question 1 doesn't sound too hard.My Interpretation:You want to press a hotkey, have the script display a message while it does whatever, and then once it's done, it will wait for the hotkey again.My solutionGive this a try:HotKeySet("{SPACE}", "Test") While 1 Sleep(100) WEnd Func Test() ToolTip("Function is Running", 0,0) ;Do whatever you want here Tooltip("") EndFunc Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 16, 2007 Author Share Posted December 16, 2007 (edited) I don't fully understand #2 and #3, but question 1 doesn't sound too hard. My Interpretation: You want to press a hotkey, have the script display a message while it does whatever, and then once it's done, it will wait for the hotkey again. My solution Give this a try: HotKeySet("{SPACE}", "Test") While 1 Sleep(100) WEnd Func Test() ToolTip("Function is Running", 0,0) ;Do whatever you want here Tooltip("") EndFunc Hey Paulie. Question 1 refers to a Box that whenever the "OK" button is pressed, it runs the script once, and then ends. While, still keeping that box available. So in this case, whenever "Run" is clicked, it runs the script within the game only once. Here's an example of what could/would be used: For question 2 & 3 On the game client, you have people walking around. Now, to see what kind of player they chose (Male, Female, colour1, colour2) is determined by an ANI (Animated Cursor). I was wondering, if AutoIt could pick up these ANI's shown on the Game Client. This picture is a rough example. The dark blue box, is me. Other colours, other players. On the Client, when people walk past their Character is shown, and whatever ANI is chose, will show me what character they have chosen. Although these ANI can be replaced and renamed to show other players, but that is only client sided. But, I can edit the light blue box, to become a teal coloured box with enough editting. I was wondering if AutoIt could:Detect the ANI that has walked pastClick on them I hope this can, somewhat clarify any doubts of what I am asking. ^^ Edited December 16, 2007 by SofaKingWeTardEd Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 16, 2007 Author Share Posted December 16, 2007 (edited) Bump [Edit]No need for a answer to question 2 & 3 unless you really do have the answer. Edited December 16, 2007 by SofaKingWeTardEd Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 16, 2007 Author Share Posted December 16, 2007 Wondering, if someone could also tell me how to use PixelSearch within just the Client Area and not my whole screen? Link to comment Share on other sites More sharing options...
jokke Posted December 16, 2007 Share Posted December 16, 2007 (edited) Wondering, if someone could also tell me how to use PixelSearch within just the Client Area and not my whole screen? Using WinGetPos, simple example under: $x = 10 $y = 10 $color = 0x000000 While 1 $pos = WinGetPos("YOURWINDOWNAME","") If UBound($pos) > 0 Then $search = PixelSearch($x + $pos[0],$y + $pos[1],10,10,$color,10) If ubound($search) > 0 Then ConsoleWrite("pixel with color "&$color&" found. X:"&$search[0]&" Y:"&$search[1]&@CRLF) EndIf Else ConsoleWrite("Either window does not exist or name was wrong."&@CRLF) EndIf WEnd Edit: better code. and a Typo... Edited December 16, 2007 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 16, 2007 Author Share Posted December 16, 2007 (edited) Using WinGetPos, simple example under: $x = 10 $y = 10 $color = 0x000000 While 1 $pos = WinGetPos("YOURWINDOWNAME","") If UBound($pos) > 0 Then $search = PixelSearch($x + $pos[0],$y + $pos[1],10,10,$color,10) If ubound($search) > 0 Then ConsoleWrite("pixel with color "&$color&" found. X:"&$search[0]&" Y:"&$search[1]&@CRLF) EndIf Else ConsoleWrite("Either window does not exist or name was wrong."&@CRLF) EndIf WEnd Edit: better code. and a Typo... Hey jokke. Just another question (Sorry for so many). After using PixelSearch, is it possible for when the pixel is detected, to move the mouse to that co-ord? Also, if it detects it multiple times, to move to each one? ^^! If anyone is willing to answer a few questions via PM (if possible to PM?), would be very much appreciated. Stop all the Topics lol Oh, and the Window name is in Chinese. Is that allowed? Edited December 16, 2007 by SofaKingWeTardEd Link to comment Share on other sites More sharing options...
jokke Posted December 16, 2007 Share Posted December 16, 2007 Hey jokke. Just another question (Sorry for so many). After using PixelSearch, is it possible for when the pixel is detected, to move the mouse to that co-ord? Also, if it detects it multiple times, to move to each one? ^^! If anyone is willing to answer a few questions via PM (if possible to PM?), would be very much appreciated. Stop all the Topics lol Oh, and the Window name is in Chinese. Is that allowed? It is possible to click every match, but i cant remember how that code went again, but under is an example where it will click the first found item: ;Pixelsearch options. $x = 10 $y = 10 $color = 0x000000 ;Mouseclick options. $button = "left" $clicks = 2 While 1 $pos = WinGetPos("YOURWINDOWNAME","") If UBound($pos) > 0 Then $search = PixelSearch($x + $pos[0],$y + $pos[1],10,10,$color,10) If ubound($search) > 0 Then MouseClick($button,$search[0],$search[1],$clicks,1) ConsoleWrite("Clicking: "&$color&" X:"&$search[0]&" Y:"&$search[1]&", "&$button&" clickking it:"&$clicks&" times."&@CRLF) EndIf Else ConsoleWrite("Either window does not exist or name was wrong."&@CRLF) EndIf WEnd UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 17, 2007 Author Share Posted December 17, 2007 (edited) It is possible to click every match, but i cant remember how that code went again, but under is an example where it will click the first found item: ;Pixelsearch options. $x = 10 $y = 10 $color = 0x000000 ;Mouseclick options. $button = "left" $clicks = 2 While 1 $pos = WinGetPos("YOURWINDOWNAME","") If UBound($pos) > 0 Then $search = PixelSearch($x + $pos[0],$y + $pos[1],10,10,$color,10) If ubound($search) > 0 Then MouseClick($button,$search[0],$search[1],$clicks,1) ConsoleWrite("Clicking: "&$color&" X:"&$search[0]&" Y:"&$search[1]&", "&$button&" clickking it:"&$clicks&" times."&@CRLF) EndIf Else ConsoleWrite("Either window does not exist or name was wrong."&@CRLF) EndIf WEnd Wow, truely confusing. I got the Window name sorted, but everytime I open the Script, it closes.... Why does that happen? Would be nice if I knew what parts to edit :3 Edited December 17, 2007 by SofaKingWeTardEd Link to comment Share on other sites More sharing options...
jokke Posted December 17, 2007 Share Posted December 17, 2007 Any error's returning after it closes ? UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 17, 2007 Author Share Posted December 17, 2007 Any error's returning after it closes ?Nope, it just appears at the bottom toolbar and *poof*; it's gone. Link to comment Share on other sites More sharing options...
jokke Posted December 17, 2007 Share Posted December 17, 2007 (edited) Have written some code with some visual debug: Edit: added the rest of the pixelsearch parameters. ;Pixelsearch options. $left = 0 $top = 0 $right = 100 $bottom = 100 $color = 0xffffff $shade = 10 ;Mouseclick options. $button = "left" ;This one might have made the script close. $clicks = 1 While 1 $pos = WinGetPos("AutoIt Help","") If UBound($pos) > 0 Then $search = PixelSearch($left + $pos[0],$top + $pos[1],$right,$bottom,$color,$shade) If UBound($search) > 0 Then TrayTip("Success","Clicking: "&$color&" X:"&$search[0]&" Y:"&$search[1]&", "&$button&" clickking it:"&$clicks&" times."&@CRLF,10) MouseClick("left",$search[0],$search[1],$clicks,1) ;might have been here the problem was. Sleep(250) Else TrayTip("Error","Unable to find color: "&Hex($color)&@CRLF&"Within cords, Left:"&$left + $pos[0] &", Top: "&$top + $pos[1]&", Right: "& $left + $pos[0]+$right & ", Bottom: " &$top + $pos[1]+$bottom,10) Sleep(250) EndIf Else TrayTip("Error","Either window does not exist or name was wrong."&@CRLF,10) Sleep(5000) Exit EndIf WEnd TrayTip("Exit","Something wrong just happend since this pice of code should not have ran."&@CRLF,10) Sleep(5000) Edited December 17, 2007 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 17, 2007 Author Share Posted December 17, 2007 (edited) Have written some code with some visual debug: Edit: added the rest of the pixelsearch parameters. ;Pixelsearch options. $left = 0 $top = 0 $right = 100 $bottom = 100 $color = 0xffffff $shade = 10 ;Mouseclick options. $button = "left" ;This one might have made the script close. $clicks = 1 While 1 $pos = WinGetPos("AutoIt Help","") If UBound($pos) > 0 Then $search = PixelSearch($left + $pos[0],$top + $pos[1],$right,$bottom,$color,$shade) If UBound($search) > 0 Then TrayTip("Success","Clicking: "&$color&" X:"&$search[0]&" Y:"&$search[1]&", "&$button&" clickking it:"&$clicks&" times."&@CRLF,10) MouseClick("left",$search[0],$search[1],$clicks,1) ;might have been here the problem was. Sleep(250) Else TrayTip("Error","Unable to find color: "&Hex($color)&@CRLF&"Within cords, Left:"&$left + $pos[0] &", Top: "&$top + $pos[1]&", Right: "& $left + $pos[0]+$right & ", Bottom: " &$top + $pos[1]+$bottom,10) Sleep(250) EndIf Else TrayTip("Error","Either window does not exist or name was wrong."&@CRLF,10) Sleep(5000) Exit EndIf WEnd TrayTip("Exit","Something wrong just happend since this pice of code should not have ran."&@CRLF,10) Sleep(5000) That works AMAZING! ;) Thank you ever so much jokke! Is it possible to detect multiple Pixels? (Blue, Green & Red)? Having a slight error: Within the game I know that there is a pure black (0x000000). When editting the script to that colour, it still doesn't detect. Also, the co-ords at the bottom saying there is an error within, is not what I typed. I entered 400 for Bottom, and got 1000+ Showing on the bubbled error. Just...doesn't seem to be picking up pixels. </3 Edited December 17, 2007 by SofaKingWeTardEd Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 17, 2007 Author Share Posted December 17, 2007 Anyone? Link to comment Share on other sites More sharing options...
jokke Posted December 17, 2007 Share Posted December 17, 2007 Post code and issue then helping would be easier. Iwe posted alot code for you, now its time for you doing you'r part of the bargain. UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 17, 2007 Author Share Posted December 17, 2007 Post code and issue then helping would be easier. Iwe posted alot code for you, now its time for you doing you'r part of the bargain.The only code you gave is the only part i'm using... I didn't think it would need any more. Only part to be editted, was the Window Name..other than that, it's exactly what you posted... Link to comment Share on other sites More sharing options...
jokke Posted December 17, 2007 Share Posted December 17, 2007 Well then, give it a try, if you fail inn your atempt post it and ill see if im able to help you out. UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted December 18, 2007 Author Share Posted December 18, 2007 Well then, give it a try, if you fail inn your atempt post it and ill see if im able to help you out.I think it's the Co-ords. Is it possible if you could tell me how I would place Co-ords of the Screen?The game client is 800x600 Windowed in size.It's the middle box where everything is shown. :s 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