Gahaman Posted August 31, 2009 Share Posted August 31, 2009 Im making a keypresser,with casting time, i want to use a single button and 1 hotkey that would START and STOP,im having trouble on it. im new to autoit i hope u could help me. thank you!!! input box are for casting time, checkbox is which skill will be used. #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) GUISetState(@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 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 func stop() $xx1 = False GUICtrlSetData($startbtn, "START") EndFunc Link to comment Share on other sites More sharing options...
Minikori Posted August 31, 2009 Share Posted August 31, 2009 (edited) For a toggle on, say, and autoclicker, it'd be this: Func AC() $AC = Not $AC While $AC = True MouseClick("left") WEnd EndFunc Do a HotKeySet() for AC(). And at the beginning of your script you'd put $AC = False Edited August 31, 2009 by Minikori For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Unjumbled 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...
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