MirnesC2 Posted September 21, 2009 Share Posted September 21, 2009 I looked at some examples online and looked at some examples around here and attempted to make this myself. It's just a simple bot that spam 1 key into a video game but the pause/end functions I added just don't seem to work. It starts up and everything, the key {z} is sent(spammed) but the -/+ keys I assigned to pause/end the program don't work. HotKeySet("{NUMPADADD}", "End") HotKeySet("{NUMPADSUB}", "Pause") $answer = InputBox("Z Bot","Windows name?") $Pause = 0 WinWaitActive($answer) While 1 Send("z") WEnd Func End() Exit EndFunc Func Pause() If $Pause = 0 Then $Pause = 1 Else $Pause = 0 EndIf While $Pause = 1 Sleep(1) WEnd EndFunc Also I am not sure if it is possible to use anything else besides WinWaitActive($answer), I only want to program to run in that window and not in any other window when I alt tab. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Just tried this in notepad, it works just like you described it should work. github.com/jvanegmond Link to comment Share on other sites More sharing options...
MirnesC2 Posted September 21, 2009 Author Share Posted September 21, 2009 Just tried this in notepad, it works just like you described it should work.Yea the program starts up and runs, but the -\+ keys don't pause or stop the program. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 (edited) Yea the program starts up and runs, but the -\+ keys don't pause or stop the program.They did for me. That's what I said the first time.Edit: Are you using the numpad + and - or the regular one close to backspace? Edited September 21, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
MirnesC2 Posted September 21, 2009 Author Share Posted September 21, 2009 They did for me. That's what I said the first time.Edit: Are you using the numpad + and - or the regular one close to backspace?Sorry, you are right. It does work on Notepad, I haven't tested it on that.I am using it for a video game and it doesn't seem to be working there.If you look at the chat box in the screens-shot it shows I pressed the num -/+ with out the program stoping. What do you think might be the problem? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 The game is probably blocking/capturing your keys, so they never end up in AutoIt. Can you try running in Windowed mode? github.com/jvanegmond Link to comment Share on other sites More sharing options...
MirnesC2 Posted September 21, 2009 Author Share Posted September 21, 2009 I just tried in window mode like you suggested it didn't work out. Wouldn't it block the z key too if it where blocking keys? I have tried both "z" and "{z}" both worked. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 It's capturing/blocking the hotkeys. The fact it captures your send keys is good. Shame windowed mode doesn't help here.. Often it does. I have no idea what game that is, but maybe you can search Google (site:autoitscript.com game name) for anyone else with this issue. github.com/jvanegmond Link to comment Share on other sites More sharing options...
MirnesC2 Posted September 21, 2009 Author Share Posted September 21, 2009 Would a GUI version help? I was hoping someone had an example piece such as {this} but his code is all jumbled up into a single line =[. You know anything similar I could take a look at? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Oh yeah, GUI version would solve your problem! It's the HotKey that has problems. Using GUI would solve it immediately. github.com/jvanegmond Link to comment Share on other sites More sharing options...
MirnesC2 Posted September 21, 2009 Author Share Posted September 21, 2009 Don't suppose you/or someone could un-jumble that code from the link? I don't know where the lines end or begin. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 I had to do it manually expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled #Region ### START Koda GUI section ### Form=C:\Documents and Settings\lheks\My Documents\Cabal Proj\attackform.kxf $atkfrm = GUICreate("Attack Skill", 154, 225, 192, 124) $atkchk1 = GUICtrlCreateCheckbox("1", 24, 32, 33, 17) $atkchk2 = GUICtrlCreateCheckbox("2", 24, 64, 33, 17) $atkchk3 = GUICtrlCreateCheckbox("3", 24, 96, 33, 17) $atkchk4 = GUICtrlCreateCheckbox("4", 24, 128, 33, 17) $atkbox1 = GUICtrlCreateInput("", 64, 32, 57, 21) $atkbox2 = GUICtrlCreateInput("", 64, 64, 57, 21) $atkbox3 = GUICtrlCreateInput("", 64, 96, 57, 21) $atkbox4 = GUICtrlCreateInput("", 64, 128, 57, 21) $startbtn = GUICtrlCreateButton("START", 40, 176, 75, 25, $WS_GROUP) $atkgrp1 = GUICtrlCreateGroup("Attack Skills", 8, 8, 137, 161) GUICtrlCreateGroup("", -99, -99, 1, 1) G UISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetOnEvent($startbtn, "Attack") Global $ct1, $ct2, $ct3, $ct3, $xx1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd HotKeySet("{PGDN}", "attack") HotKeySet("{PGUP}", "stop") ; $attack = 0 While 1 Sleep(100) WEnd Func stop() $attack = 0 EndFunc ;==>stop Func attack() Send({F1}) Opt("GUIOnEventMode", 1) GUICtrlSetData($startbtn, "STOP") WinActivate("Untitled - Notepad") $attack = Not $attack $ct1 = GUICtrlRead($atkbox1) $ct2 = GUICtrlRead($atkbox2) $ct3 = GUICtrlRead($atkbox3) $ct4 = GUICtrlRead($atkbox4) $xx1 = 1 ; If $nMsg = $startbtn Then ; If GUICtrlRead($startbtn) = "START" Then ; GUICtrlSetData($startbtn, "STOP") ; $xx1 = 1 ; ElseIf GUICtrlRead($startbtn) = "STOP" Then ; GUICtrlSetData($startbtn, "START") ; $xx1 = 0 ; EndIf ; EndIf While $xx1 = 1; $attack = 1 ;Press Attack Skill from slot 2-5 ; Sleep(5000) Send("2", 3) Sleep($ct1) Send("3", 1) Sleep($ct2) Send("4", 1) Sleep($ct3) Send("5", 1) Sleep($ct4) WEnd EndFunc ;==>attack Func stop() $xx1 = False GUICtrlSetData($startbtn, "START") EndFunc ;==>stop github.com/jvanegmond Link to comment Share on other sites More sharing options...
MirnesC2 Posted September 21, 2009 Author Share Posted September 21, 2009 Thanks for helping out man, I clicked the little + sign on all your posts. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Haha, thanks. If you have more questions, just come back. : ) github.com/jvanegmond 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