MikeyMike Posted April 14, 2007 Share Posted April 14, 2007 (edited) Hi, I am new here, I guess its kind of rude to post a topic on my 1st post. Before I begin, a little info about myself. Like a week ago started learning auto it, went through the whole help fine (GJ, on who made it), still some problems, but I am getting the hang of it. I know ASM, I've been studying that for years now, and since Basic was my first language, it made it easier learning auto it. I am interested in a game, well explointing that game. The game would be Pirate King. I have a made a pixel detecting bot, but found an easier way killing monsters throught Manipulating Packets (I'm solid with that too.), But What I want to do, is to be able to loot items while having the game minimized. Anyway, here is my pixel detecting script, just so you can belive me a bit more. expandcollapse popup#include <GUIConstants.au3> Opt("MouseClickDelay", 0) ;setting clicking speed Opt("MouseClickDownDelay", 0) ; setting clicking speed if is pressed Opt("GUIOnEventMode", 1) SplashImageOn ( "SPLASH", "C:\Splashy.bmp" , 200 , 200 ) Sleep(2000) SplashOff() $pic1 = "UCE.jpg" FileInstall("C:\UCE.jpg", @TempDir & "\" & $pic1, 1) GUICreate("UB3R", 200, 200,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Pic_1 = GuiCtrlCreatePic(@TempDir & "\" & $pic1, 0, 0, 200, 200) $Wait = GUICtrlCreateInput("0", 480, 179, 79, 22, 0) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") ;Colose is the function name that closes the bot GUISetState(@SW_SHOW) $msg=GUICtrlCreatePic("C:/UCE.jpg", 0, 0 , 200 , 200) TrayTip ( "UB3R", "Soooo, you like this bot?.", 5 ,1 ) Sleep(5000) ;THE ACTUAL BOT! HotKeySet("{F1}", "Toggle") HotKeySet("{F2}", "_Toggle") Global $OnOff = 0 Global $OnLoot = 0 Global $Search While 1 If $OnOff = 1 then Call ("pixelSrch") WEnd While 1 If $OnLoot = 1 then Call ("ItemLoot") WEnd Func pixelSrch() While $OnOff = 1 Do ;added this check the help file $Search = PixelSearch (0, 0, 1100, 800, 0xed4934, 10,10); Change the HEXED pixel for each different monster. If Not @error Then Mouseclick ("Left", $Search[0], $Search[1], 1, 0) Sleep(100) $Search = PixelSearch (0, 0, 1100, 800, 0x914438, 10,10) If Not @error Then Mouseclick ("Left", $Search[0], $Search[1], 1, 0) Sleep(100) Until $OnOff = 0 WEnd EndFunc Func ItemLoot() While $OnLoot = 1 Do Send ("^a"), 0 Until $OnLoot = 0 Wend EndFunc Func Toggle() $OnOff = Not $OnOff EndFunc Func _Toggle() $OnLoot = Not $OnLoot EndFunc Func Close() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE Exit EndSelect EndFuncoÝ÷ ØÆzØb²l¬zWÍ£ajÜ(®K)ëmÉø§y»¶«yªÞ}«-z¼ÊËhëÞ"wu«®*m¶Â¥vZ(·bé¢)¢ÍçHz0 Cntrl + A is the loot button. Now this does send these keys, while the game is un minimized, but when is minimized, nothing happens, I tested. I really dont know whats wrong, maybe the hooking? There is no protection on the game though. Thank you for reading, hope you can help me. P.S. SXguy, is the awesome person who has been helping me with auto it. Edited April 14, 2007 by MikeyMike Link to comment Share on other sites More sharing options...
Teldin Posted April 14, 2007 Share Posted April 14, 2007 I don't know this game but perhaps you can hide the window, get it's handle and run your scripts on that... Link to comment Share on other sites More sharing options...
MikeyMike Posted April 14, 2007 Author Share Posted April 14, 2007 I don't know this game but perhaps you can hide the window, get it's handle and run your scripts on that...Once again, I am new, could you explain more about what you mean? Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 Anyone? Link to comment Share on other sites More sharing options...
Gcommer Posted April 15, 2007 Share Posted April 15, 2007 Hmmm... I'm not familiar with that game either. However, i can guess that it is played as an object embedded in the website, so maybe in ControlSend() you can enter its control Id... just a thought Oh, you can find its control Id with the Window Info tool. Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 Hmmm... I'm not familiar with that game either. However, i can guess that it is played as an object embedded in the website, so maybe in ControlSend() you can enter its control Id... just a thoughtOh, you can find its control Id with the Window Info tool.Well, its empty, let me show you a screenie in a second. Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 Yes, a rude bump, but this is the only place where someone can help me. Link to comment Share on other sites More sharing options...
bogB Posted April 15, 2007 Share Posted April 15, 2007 I don't know this game but perhaps you can hide the window, get it's handle and run your scripts on that... i had some problems with printing (ctrl+p) command on minimazed window, so i set the win on top maxim. it and hide it, and printing whas working If NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then ToolTip('Pls TurnOn The Game"',0,0) EndIf While NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Wend If WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then WinSetOnTop("Pirate King Online - Caribbean Chapters 1.33.00001", "", 1) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "",@SW_MAXIMIZE) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_HIDE) EndIf While WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Wend I hope that this helps Bdw if i tuped something wrong, then sry, after all this is my first day to see this forum and autoit scripting ^^ Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 i had some problems with printing (ctrl+p) command on minimazed window, so i set the win on top maxim. it and hide it, and printing whas working If NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then ToolTip('Pls TurnOn The Game"',0,0) EndIf While NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Wend If WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then WinSetOnTop("Pirate King Online - Caribbean Chapters 1.33.00001", "", 1) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "",@SW_MAXIMIZE) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_HIDE) EndIf While WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Wend I hope that this helps Bdw if i tuped something wrong, then sry, after all this is my first day to see this forum and autoit scripting ^^ ThaTs cool, leT me Try iT. JusT need To add The pick up opTion. Sorry for all The "T", My boT is running and wonT leT me Type lower case T. Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 If NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then ToolTip('Pls TurnOn The Game"',0,0) EndIf If WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then WinSetOnTop("Pirate King Online - Caribbean Chapters 1.33.00001", "", 1) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "",@SW_MAXIMIZE) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_HIDE) EndIf While WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") ControlSend("Pirate King Online - Caribbean Chapters 1.33.00001", "", "", "^a") Sleep(10) WEnd Please help me, this just turned off my game. Whats wrong with it? Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 Nvm, fixed it, but how would I go about sending keys to a process? Or if the window is hidden, it will still send? Link to comment Share on other sites More sharing options...
Teldin Posted April 15, 2007 Share Posted April 15, 2007 You want to use ControlSend. Send will only use the active window but ControlSend will use any window (even hidden) that you specify. Like I said, I recommend getting your game's HWND and use that for ControlSend. Keep in mind the HWND will change for every instance of the game window so make it a variable. Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 (edited) Like I said, I am still not 100% perfect with auto it, this is what my script looks like, please explain what you mean with HWND? Global $HideUnhide = 0 HotKeySet("{F2}", "_Toggle") If NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then ToolTip('Pls TurnOn The Game"',0,0) EndIf If WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then WinSetOnTop("Pirate King Online - Caribbean Chapters 1.33.00001", "", 1) WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_HIDE) EndIf While 1 If $HideUnhide = 1 then Call ("Hide") WEnd Func Hide () While $HideUnhide = 1 Do WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_HIDE) Until $HideUnhide = 0 WEnd EndFunc While WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") ControlSend("Pirate King Online - Caribbean Chapters 1.33.00001", "", "", "^a") Sleep(10) WEnd Func _Toggle() $HideUnhide = Not $HideUnhide EndFunc And what would unhide look like? The command i mean..? Edited April 15, 2007 by MikeyMike Link to comment Share on other sites More sharing options...
MikeyMike Posted April 15, 2007 Author Share Posted April 15, 2007 (edited) expandcollapse popupGlobal $HideUnhide = 0 HotKeySet("{F2}", "_Toggle") If NOT WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then ToolTip('Pls TurnOn The Game"',0,0) EndIf If WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") Then WinSetOnTop("Pirate King Online - Caribbean Chapters 1.33.00001", "", 1) EndIf While 1 If $HideUnhide = 1 then Call ("Hide") WEnd While 1 If $HideUnhide = 0 then call ("Unhide") WEnd Func Unhide () While $HideUnhide = 0 Do WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_SHOW) Until $HideUnhide = 1 WEnd EndFunc Func Hide () While $HideUnhide = 1 Do WinSetState("Pirate King Online - Caribbean Chapters 1.33.00001", "", @SW_HIDE) Until $HideUnhide = 0 WEnd EndFunc While WinExists("Pirate King Online - Caribbean Chapters 1.33.00001") ControlSend("Pirate King Online - Caribbean Chapters 1.33.00001", "", "", "^a") Sleep(10) WEnd Func _Toggle() $HideUnhide = Not $HideUnhide EndFuncoÝ÷ Øp¢{l"´ù^jÇÆZ|!jÒÚ"+¢x¦·¬°]ز 'xkzË"±¨x²z-Þ-ëfzÚòÜ"¶÷Þéíd{&®¶sdvÆö&Âb33c´FUVæFRÒ¤vÆö&Âb33cµVæFRÒ¤÷D¶W6WBgV÷C·´c'ÒgV÷C²ÂgV÷CµõFövvÆRgV÷C²¤÷D¶W4WBgV÷C·´c7ÒgV÷C²ÂgV÷CµFövvÆRgV÷C² ¤bäõBväW7G2gV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²FVà¢FööÅFb33µÇ2GW&äöâFRvÖRgV÷C²b33²ÃäVæD` ¤bväW7G2gV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²FVà¢vå6WDöåF÷gV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²ÂgV÷C²gV÷C²Â¤VæD` ¥vÆR¤bb33c´FUVæFRÒFVâ6ÆÂgV÷C´FRgV÷C²¥tVæ@ ¥vÆR bb33c´FUVæFRÒFVâ6ÆÂgV÷CµVæFRgV÷C²¥tVæ@ ¤gVæ2VæFR vÆRb33cµVæFRÒ Fð vå6WE7FFRgV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²ÂgV÷C²gV÷C²Â5uõ4õr VçFÂb33cµVæFRÒ tVæ@¤VæDgVæ0 ¤gVæ2FR vÆRb33c´FUVæFRÒ Fð vå6WE7FFRgV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²ÂgV÷C²gV÷C²Â5uôDR VçFÂb33c´FUVæFRÒ¥tVæ@¤VæDgVæ0 ¥vÆRväW7G2gV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²¢6öçG&öÅ6VæBgV÷Cµ&FR¶æröæÆæRÒ6&&&Vâ6FW'2ã32ãgV÷C²ÂgV÷C²gV÷C²ÂgV÷C²gV÷C²ÂgV÷CµægV÷C²¢6ÆVW tVæ@ ¤gVæ2õFövvÆR b33c´FUVæFRÒæ÷Bb33c´FUVæFP¤VæDgVæ0 ¤gVæ2FövvÆR b33cµVæFRÒæ÷Bb33cµVæFP¤VæDgVæ This one didn't work ether. Edited April 15, 2007 by MikeyMike Link to comment Share on other sites More sharing options...
Teldin Posted April 15, 2007 Share Posted April 15, 2007 Function Reference WinGetHandle -------------------------------------------------------------------------------- Retrieves the internal handle of a window. WinGetHandle ( "title" [, "text"] ) Parameters title The title of the window to read. See Title special definition. text [optional] The text of the window to read. Return Value Success: Returns handle to the window. Failure: Returns "" (blank string) and sets @error to 1 if no window matches the criteria. Remarks This function allows you to use handles to specify windows rather than "title" and "text". Once you have obtained the handle you can access the required window even if its title changes. Related WinSetTitle Example ; Identify the Notepad window that contains the text "this one" and get a handle to it ; Change into the WinTitleMatchMode that supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) ; Get the handle of a notepad window that contains "this one" $handle = WinGetHandle("classname=Notepad", "this one") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else ; Send some text directly to this window's edit control ControlSend($handle, "", "Edit1", "AbCdE") EndIf 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