Jump to content

Could someone help with this easy script please


Kimo
 Share

Recommended Posts

Kimo,

The simple answer is NO!

It is against forum rules to discuss game automation and this topic comes up repeatedly. You should have looked before posting lest incur the wrath of the mod's.

Look here: http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/

Link to comment
Share on other sites

Thanks for the quick response, it isnt a cheat or change, my w key is worn out and I have no other keys to bind so I was going to use this instead.

ahh :mellow: best self-preservation i ve ever seen :)

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Link to comment
Share on other sites

#include <Misc.au3>
While 1
    If Not (_IsPressed(87H) = 0) Then Send("{Asc 0x057}")
WEnd

W is now bound to F24. Have fun. This script can not be changed or else it won't work.

EDIT: IMPROVED Performance

EDIT: Bounded W to F24 for easier access

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Anyone have any other ideas on how to IMPROVE my scripts' performance. I was thinking making it do math like While 2+2 = 1+3.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Hi,

I used the example from _WinAPI_SetWindowsHookEx and modified it.

Good (maybe bad) is that it suppresses the key your pressing from being sent with the send key.

I did a similar thing for myself and the game Dead Space.

The game was hard set to w/a/s/d and wouldn't let me assign up/down/left/right keys for movement.

#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>

OnAutoItExitRegister("_Cleanup")

Global $sInKey = "Q", $sOutKey = "w"
Global $hKeyProc, $hHook, $iQuit

$hKeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hKeyProc), _WinAPI_GetModuleHandle(0))

While Not $iQuit
    Sleep(10)
WEnd

Func _KeyProc($nCode, $wParam, $lParam)
    Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
    If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)

    If $wParam = $WM_KEYDOWN Then
        Switch DllStructGetData($tKEYHOOKS, "vkCode")
            Case Asc($sInKey)
                Send($sOutKey)
                Return 1
            Case 27 ; Esc key
                $iQuit = 1
        EndSwitch
    EndIf
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc   ;==>_KeyProc

Func _Cleanup()
    If $hHook Then _WinAPI_UnhookWindowsHookEx($hHook)
    If $hKeyProc Then DllCallbackFree($hKeyProc)
EndFunc   ;==>Cleanup

Cheers

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...