Sign in to follow this  
Followers 0
L3G3NdKillEr

send key problem for game

17 posts in this topic

i want to make keys for games with the help of autoits. for instance W = up arrow

i make this

hotkeyset("w", "up")

while 1

sleep(50)

wend

func up()

send("{up}")

endfunc

and problem is that it does'nt work fine. i make this for racing game and w for accelerator and is there any way to work this key perfectly.

i cannot change key from game.


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites



umm... when are u calling that function?

when is it going to exit from that infinite loop?

Share this post


Link to post
Share on other sites

#Include <Misc.au3>
hotkeyset("w", "up")

while 1
sleep(50)
wend

Func up()
While _IsPressed('57')
Send("{up}")
WEnd
EndFunc

I don't if this will help you at all... I just noticed that games recognize if you a hold a key down for a long time it will send it for a long time. HotkeySet would just call the function once... But maybe this will solve that problem.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

no problem is not completely solved. it just like that u press half trigger.

is there anyother way sooo tell........,

i apreciate........,


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

no problem is not completely solved. it just like that u press half trigger.

is there anyother way sooo tell........,

i apreciate........,

Try and see if it hold down the accelerator for 5 seconds.

Send("{up down}")
Sleep(5000)
Send("{up up}")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

yes it hold key for 5 sec. but its not work perfectly for me. i want it work like orignal keys means work like up and down key of keyboard.

Thanxx.

Edited by L3G3NdKillEr

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

#Include <Misc.au3>
hotkeyset("w", "up")
Hotkeyset("{ESC}", "_exit")

while 1
sleep(50)
wend

Func _exit()
     Exit
EndFunc

Func up()
     Send("{UP DOWN}")
     While _IsPressed('57')
          Sleep(10)
     WEnd
     Send("{UP UP}")
EndFunc

This is the mix of the two exemple Joon and Piano Man gave you. It's untested but try it.

Share this post


Link to post
Share on other sites

Try adjusting the SendKeyDownDelay option. I know some programs require a slightly longer delay, an anti-macro feature I suppose. Try using 10 ms, 15ms, etc.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

thanx all and i made this.

CODE
#Include <Misc.au3>

hotkeyset("w", "up")

HotKeySet("{numpad4}", "left")

HotKeySet("{numpad6}", "right")

Hotkeyset("{ESC}", "_exit")

while 1

sleep(50)

wend

Func _exit()

Exit

EndFunc

Func up()

Send("{UP DOWN}")

While _IsPressed('57')

Sleep(10)

WEnd

Send("{UP UP}")

EndFunc

func left()

send("{left Down}")

while _ispressed("{numpad4}")

sleep(10)

WEnd

send("{left up}")

EndFunc

func right()

send("{right down}")

while _ispressed("{numpad6}")

Sleep(10)

WEnd

Send("{right up}")

EndFunc

"w" works perfectly but other keys not work correctly. but otherwise thanx


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

thanx all and i made this.

CODE
#Include <Misc.au3>

hotkeyset("w", "up")

HotKeySet("{numpad4}", "left")

HotKeySet("{numpad6}", "right")

Hotkeyset("{ESC}", "_exit")

while 1

sleep(50)

wend

Func _exit()

Exit

EndFunc

Func up()

Send("{UP DOWN}")

While _IsPressed('57')

Sleep(10)

WEnd

Send("{UP UP}")

EndFunc

func left()

send("{left Down}")

while _ispressed("{numpad4}")

sleep(10)

WEnd

send("{left up}")

EndFunc

func right()

send("{right down}")

while _ispressed("{numpad6}")

Sleep(10)

WEnd

Send("{right up}")

EndFunc

"w" works perfectly but other keys not work correctly. but otherwise thanx

You're confusing send and _Ispressed. Look in the help and you will see that _IsPressed needs numbers, "{numpad6}" won't work it should be 66.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

ok i change to this but its also not work for me.

CODE
#Include <Misc.au3>

AutoItSetOption("SendKeyDownDelay", 15)

hotkeyset("w", "up")

HotKeySet("e", "left")

HotKeySet("r", "right")

Hotkeyset("{ESC}", "_exit")

while 1

sleep(50)

wend

Func _exit()

Exit

EndFunc

Func up()

Send("{UP DOWN}")

While _IsPressed('57')

Sleep(10)

WEnd

Send("{UP UP}")

EndFunc

func left()

send("{left Down}")

while _ispressed("{numpad4}")

sleep(10)

WEnd

send("{left up}")

EndFunc

func right()

send("{right down}")

while _ispressed("{numpad6}")

Sleep(10)

WEnd

Send("{right up}")

EndFunc


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

ok i change to this but its also not work for me.

CODE
#Include <Misc.au3>

AutoItSetOption("SendKeyDownDelay", 15)

hotkeyset("w", "up")

HotKeySet("e", "left")

HotKeySet("r", "right")

Hotkeyset("{ESC}", "_exit")

while 1

sleep(50)

wend

Func _exit()

Exit

EndFunc

Func up()

Send("{UP DOWN}")

While _IsPressed('57')

Sleep(10)

WEnd

Send("{UP UP}")

EndFunc

func left()

send("{left Down}")

while _ispressed("{numpad4}")

sleep(10)

WEnd

send("{left up}")

EndFunc

func right()

send("{right down}")

while _ispressed("{numpad6}")

Sleep(10)

WEnd

Send("{right up}")

EndFunc

What did you change?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Try that...

#Include <Misc.au3>

AutoItSetOption("SendKeyDownDelay", 15)
hotkeyset("w", "up")
HotKeySet("e", "left")
HotKeySet("r", "right")
Hotkeyset("{ESC}", "_exit")

while 1
    sleep(50)
wend

Func _exit()
    Exit
EndFunc

Func up()
    Send("{UP DOWN}")
    While _IsPressed('57')
        Sleep(10)
    WEnd
    Send("{UP UP}")
EndFunc

func left()
    send("{left Down}")
    While _ispressed("64")
        sleep(10)
    WEnd
    send("{left up}")
EndFunc

func right()
    send("{right down}")
    While _ispressed("66")
        Sleep(10)
    WEnd
    Send("{right up}")
EndFunc

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

ohhhhh sorry but its also does'nt work only one key work at a time


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

anyone plzzzzz help.......,


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

no its work in one script made this and thanks for gave me some ideas.. :)

#Include <Misc.au3>

AutoItSetOption("SendKeyDownDelay", 15)
hotkeyset("w", "up")
HotKeySet("e", "left")
HotKeySet("r", "right")
HotKeySet("u", "down")

while 1
    sleep(50)
wend

Func up()
    Send("{UP DOWN}")
    While _IsPressed('57')
        Sleep(10)
    WEnd
    Send("{UP UP}")
EndFunc

func left()
    send("{left Down}")
    While _ispressed('45')
        sleep(10)
    WEnd
    send("{left up}")
EndFunc

func right()
    send("{right down}")
    While _ispressed('52')
        Sleep(10)
    WEnd
    Send("{right up}")
EndFunc

Func down()
    send("{down Down}")
    While _IsPressed('55')
        sleep(10)
    WEnd
    send("{down Up}")
    EndFunc

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
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
Sign in to follow this  
Followers 0