AutoIt: CSS Autopistol coden

05/04/2012 16:49 xCrazyN00B#1
Hey,
ich wollte ein Autopistol coden, hänge aber gerade an If _IsPressed.
Ich habe keine Ahnung, wie ich es hinbringe, wenn LEFT gefrückt wird eine While 1 aktiviert wird.
05/05/2012 13:55 GoldenPhönix#2
Du willst das z.b. wenn du links drückst der die ganze munition so schnell wie möglich raushaut
05/05/2012 18:34 Achat#3
Quote:
Originally Posted by xCrazyN00B View Post
Hey,
ich wollte ein Autopistol coden, hänge aber gerade an If _IsPressed.
Code:
If calling this function repeatedly, you should open 'user32.dll' and pass the handle.
Make sure to close the handle at end of script using DllClose.
[Only registered and activated users can see links. Click Here To Register...]

MfG
05/06/2012 08:39 xCrazyN00B#4
Quote:
#NoTrayIcon
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


Local $DLL = DllOpen("user32.dll")

HotKeySet ("{F5}", start )
HotKeySet ("{F6}", pause )
HotKeySet ("{F7}", ende )



#Region ### START Koda GUI section ### Form=
$form = GUICreate("Autopistol by crazylumi", 258, 48, 192, 124)
$on = GUICtrlCreateButton("F5 = On", 8, 8, 75, 25, 0)
$pause = GUICtrlCreateButton("F6 = Pause", 88, 8, 75, 25, 0)
$off = GUICtrlCreateButton("F7 = Off", 168, 8, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $on
start ()
Case $pause
pause ()
Case $off
ende ()
EndSwitch
WEnd


Func start ()
While 1
If _IsPressed("01", $hDLL) Then
Send ("{left}")
Sleep (10)
EndIf
WEnd
EndFunc

Func pause()
While True
Sleep(100)
If _isPressed("75") Then return ;F6
WEnd
EndFunc


Func ende ()
Exit
EndFunc


DllClose($DLL)
Nun zeigt es an: Error parsing function call,
05/06/2012 11:37 Achat#5
So habe hier mal die Fehler verbessert, du kannst es jetzt starten. In de Kommentaren habe ich dir dazu geschrieben, was falsch war.

Code:
;Corrected by Achat on www.elitepvpers.com

#NoTrayIcon
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3> ;Du hast das Include für _IsPressed vergessen - also existierte die Funktion gar nicht.


Global $hDLL = DllOpen("user32.dll") ;Global damit diese Variable überall gültig ist -> du rufst sie ja in einer Funktion auf ; Außerdem hast du diese Varibale $DLL genannt, in den Funcs heist sie aber $hDll !

HotKeySet("{F5}", "start") ; Hallo? Strings oder Zeichen oder Zeichenketten immer in "Anführungszeichen"
HotKeySet("{F6}", "pause")
HotKeySet("{F7}", "ende")



#region ### START Koda GUI section ### Form=
$form = GUICreate("Autopistol by crazylumi", 258, 48, 192, 124)
$on = GUICtrlCreateButton("F5 = On", 8, 8, 75, 25, 0)
$pause = GUICtrlCreateButton("F6 = Pause", 88, 8, 75, 25, 0)
$off = GUICtrlCreateButton("F7 = Off", 168, 8, 75, 25, 0)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $on
			start()
		Case $pause
			pause()
		Case $off
			ende()
	EndSwitch
WEnd


Func start()
	While 1
		If _IsPressed("01", $hDLL) Then
			Send("{left}")
			Sleep(10)
		EndIf
	WEnd
EndFunc   ;==>start

Func pause()
	While True
		Sleep(100)
		If _IsPressed("75") Then Return ;F6
	WEnd
EndFunc   ;==>pause


Func ende()
	Exit
EndFunc   ;==>ende


DllClose($hDLL)
MfG
06/14/2014 22:49 Malagah#6
Und wie mach ich das jetzt zu einem script ? der auch funktioniert