PawBear Posted February 26, 2007 Share Posted February 26, 2007 Ok, I made part of this and my freind craig324 made the message boxes and some other stuff. he said it would help me learn. But this works fine for me but i want it to send the SHift down and the left click loop to an inactive window that i put in. I dont know how to make it work tho. iv tried alot of stuff. i tell it the window name and it should only work active in that window correct? if im not mistaken. this is the code and im not sure how to make it go it inactive window. expandcollapse popup; <AUT2EXE VERSION: 3.2.2.0> #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: PawBear - Craig324 Name: Hammer Caster Version: 1 Script Function: Assists in Casting hammers on left click #ce ---------------------------------------------------------------------------- HotKeySet("{End}", "ExitFunction") HotKeySet("{Ins}", "ReloadFunction") HotKeySet("{Home}", "PauseFunction") AutoItSetOption ("PixelCoordMode", 0) AutoItSetOption("MouseCoordMode", 0) Global $Check Global $Checksum Global $ConfigFile = "Hammer.ini" Global $Delay Global $Game Global $Mode Global $Paused = 0 Global $Size_h Global $Size_w Global $_X Global $_Y If initialize() Then start_game() Else Exit EndIf Func start_game() While Not $Paused If $Check = "On" Then check_if_in_game($Game) EndIf Send('{SHIFTDOWN}') For $x = 1 To 99999999999999 MouseClick("left") Sleep(600) Next Send("{SHIFTUP}") Sleep(200) WEnd EndFunc ;==>start_game Func initialize() If Not FileExists($ConfigFile) Then MsgBox(4096, "Hammer", "No configuration found!" & @LF & _ "Attemping to create one!") If Not generate_config($ConfigFile) Then MsgBox(4096, "Hammer", "Creating config file failed!") Return False EndIf EndIf Local $data = IniReadSection($ConfigFile, "General") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Return False EndIf If is_valid_input($data[1][1], "text") Then $Game = $data[1][1] Else MsgBox(4096, "Hammer", "Wrong config: " & $data[1][0]) Return False EndIf If is_valid_input($data[2][1], "case") Then $Check = $data[2][1] Else MsgBox(4096, "Hammer", "Wrong config: " & $data[2][0]) Return False EndIf If is_valid_input($data[3][1], "place") Then $Mode = $data[3][1] Else MsgBox(4096, "Hammer", "Wrong config: " & $data[3][0]) Return False EndIf If is_valid_input($data[4][1], "char") Then $Class = $data[4][1] If $Class = "Palli" Then $Delay = 600 Else $Delay = 100 EndIf Else MsgBox(4096, "Hammer", "Wrong config: " & $data[4][0]) Return False EndIf If Not WinExists($Game) Then MsgBox(4096, "Hammer", "No Diablo II window found with title " & $data[1][1] & "!") Return False EndIf If Not WinActive($Game) Then WinActivate($Game) $Checksum = PixelChecksum(10, 600, 20, 600) EndIf Local $size = WinGetPos($Game) $Size_w = $size[2] $Size_h = $size[3] set_coords() Return True EndFunc ;==>initialize Func set_coords() Select Case $Mode == "C" $_X = 400 $_Y = 300 EndSelect EndFunc ;==>set_coords Func generate_config($ConfigFile) Local $inWindowTitle = "" While Not is_valid_input($inWindowTitle, "text") $inWindowTitle = InputBox("Hammer", "Enter your Diablo II window title--Btw This whole Script is Case sensitive.") If @error == 1 Then Exit EndIf WEnd Local $inCheckIfInGame = "" While Not is_valid_input($inCheckIfInGame, "case") $inCheckIfInGame = InputBox("Hammer", "Check if you got kicked?" & @LF & _ "(won´t work in minimized mode)" & @LF & _ "[On] or [Off]", "On") If @error == 1 Then Exit EndIf WEnd Local $inSpreadSpells = "" While Not is_valid_input($inSpreadSpells, "place") $inSpreadSpells = InputBox("Hammer", "Where Do you want hammers casted?---Btw This is Case sensitive" & @LF & _ "[C] = Spam In Center", "On") If @error == 1 Then Exit EndIf WEnd Local $inClass = "" While Not is_valid_input($inClass, "char") $inClass = InputBox("Hammer", "What character do you use?" & @LF & _ "[Palli] or [Palli]") If @error == 1 Then Exit EndIf WEnd Local $data = "WinTitle = " & $inWindowTitle & @LF & _ "CheckIfInGame = " & $inCheckIfInGame & @LF & _ "SpreadSpells = " & $inSpreadSpells & @LF & _ "Class = " & $inClass If IniWriteSection($ConfigFile, "General", $data) Then Return True Else Return False EndIf EndFunc ;==>generate_config Func check_if_in_game($game) If Not WinActive($game) Then WinActivate($game) EndIf Local $checksum_now = PixelChecksum(10, 600, 20, 600) If $checksum_now == $Checksum Then Return True Else MsgBox(4096, "Hammer", "You possibly got disconnected!") Exit EndIf EndFunc ;==>check_if_in_game Func is_valid_input($input, $type) If $type == "text" Then If $input <> "" Then Return True Else Return False EndIf ElseIf $type == "case" Then If $input == "On" Or $input == "Off" Then Return True Else Return False EndIf ElseIf $type == "char" Then If $input == "Palli" Then Return True Else Return False EndIf ElseIf $type == "place" Then If $input == "C" Then Return True Else Return False EndIf Else Return False EndIf EndFunc ;==>is_valid_input Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc ;==>_MakeLong Func ExitFunction() Exit EndFunc ;==>ExitFunction Func ReloadFunction() $Paused = 1 initialize() $Paused = 0 EndFunc ;==>ReloadFunction Func PauseFunction() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc ;==>PauseFunction Link to comment Share on other sites More sharing options...
PawBear Posted February 26, 2007 Author Share Posted February 26, 2007 Bump 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