Jump to content

While holding down a key


Recommended Posts

So, i'm making a lazy-man script for wow and it should basicly press down "1" when i've got the energy for it and while holding down a specific key, and that's the hard part.

$energy = PixelGetColor (120, 85)

If $engery = 0x969300 Then

send("1")

Sleep("500")

endif

thats what i've come up with. But to the problem, i want the script to run while i'm holding down a key.

Regards Lett.

Link to comment
Share on other sites

So, i'm making a lazy-man script for wow and it should basicly press down "1" when i've got the energy for it and while holding down a specific key, and that's the hard part.

$energy = PixelGetColor (120, 85)

If $engery = 0x969300 Then

send("1")

Sleep("500")

endif

thats what i've come up with. But to the problem, i want the script to run while i'm holding down a key.

Regards Lett.

I dont understand quite, so you want it to press 1 when that pixel is that color, but only if you are holding down a different key? or am i mixed up

Link to comment
Share on other sites

I dont understand quite, so you want it to press 1 when that pixel is that color, but only if you are holding down a different key? or am i mixed up

No, i want the script to run while i'm holding down another key lets say "F". I want the script to pixelsearch while i'm holding down "F".

Link to comment
Share on other sites

So, i'm making a lazy-man script for wow and it should basicly press down "1" when i've got the energy for it and while holding down a specific key, and that's the hard part.

$energy = PixelGetColor (120, 85)

If $engery = 0x969300 Then

send("1")

Sleep("500")

endif

thats what i've come up with. But to the problem, i want the script to run while i'm holding down a key.

Regards Lett.

Not sure what you mean when you are holding down a key. You mean , if you are ONLY holding down a key it will hit 1 when your energy is high enough?

Maybe using the numlock state to turn it on/off would be better. That way, if numlock was active the script would be sending 1's... and if numlock was off it would stop.

Opt("PixelCoordMode", 0) ; use coordinates relative to the WoW window.

Global Const $VK_NUMLOCK = 0x90

While 1
    If _GetNumLock() Then
        $energy = PixelGetColor(120, 85)
        If $energy = 0x969300 Then
            Send("1")
        EndIf
        Sleep("500")
    EndIf
WEnd

Func _GetNumLock()
    Local $ret
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_NUMLOCK)
    Return $ret[0]
EndFunc   ;==>_GetNumLock

If you really want to see if a certain key is being pressed before working, look at _IsPressed()

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

  • Moderators

You should download SciTe ... one of your variables is spelled wrong ($energy doesn't = $engery)

This should work, but untested.

HotKeySet('F', '_FPressed')

While 1
    Sleep(1000)
WEnd

Func _FPressed()
    Local $energy = ''
    While _IsPressed('46')
        $energy = PixelGetColor (120, 85)
        If $energy = 0x969300 Then
            Send('1')
            Sleep(500)
        Endif
        Sleep(10)
    WEnd
EndFunc

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Here is one for only working while the F key is pressed down like you said:

Opt("PixelCoordMode", 0) ; use coordinates relative to the WoW window.

While 1
    If _IsPressed('46') Then
        ConsoleWrite("Im working!")
        $energy = PixelGetColor(120, 85)
        If $energy = 0x969300 Then
            Send("1")
        EndIf
    EndIf
        Sleep("500")
WEnd

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
    ; $hexKey must be the value of one of the keys.
    ; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is.
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc   ;==>_IsPressed

EDIT: Bah smoke!

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...