Jump to content

Newbie looking for some advice


Recommended Posts

I have Practically just started trying programing, I know some basics, but I'm really lost in most of the language, not really the syntax, but more of the meaning of the words. (its feels like you know the rules of the road, but you don't know how to drive a car)

in any case

I'm trying to write a script that will macro a key stroke, and effectively double it, so if I were to hit "a" I would then see (in notepad for example) "aa"

(yes this is for a game, I'm not the fastest of fingers and I have a hard time double tapping my movement keys to sprint)

I'm not trying to do this to every key however, just Wasd, so i wrote a func for each of them

but here is were I'm stuck, firstly how do I make my scrip detect that i have pressed "a", and secondly how to make it respond to the key stroke, with the func I have written

All that I know is what I have done by trial and errored by looking at other scripts, so that I could discover what pieces of script do. In that light I'm not necessarily looking for a block of code, but I'm looking for something that will help me understand as well

I'm also looking for any (free) resource that I could use to learn more

Link to comment
Share on other sites

Anytime anyone refers to: *Click* it means he/she thinks this thread is going to get locked, as when mod's lock a thread, there post is usually like this:

*Click*

Some little help with your question.

HotKeySet("a", "MyFunc")
Do
Sleep(20)
Until ProcessExists("randomnotworkignproccess.moo")

Func MyFunc()
Send("aa")
EndFunc
Edited by R6V2
Link to comment
Share on other sites

Thank you for being helpful :)

some times i wish people could be helpful instead of just writing... click... kinda makes me mad when all a person has to say is that, i mite be able to help, but I'm not going to, so instead I'll be an annoyance.

btw: is it your place to judge weather or not it will be "clicked" guess what its not, so keep your damn opinion to your self unless you can be constructive.

Edited by Krinje
Link to comment
Share on other sites

Some little help with your question.

HotKeySet("a", "MyFunc")
Do
Sleep(20)
Until ProcessExists("randomnotworkignproccess.moo")

Func MyFunc()
Send("aa")
EndFunc
When you Send() and "a" it will trigger the HotKeySet() for "a", causing a recursive loop that crashes your script. To avoid that, the handling function must disable the HotKeySet(), Send() the key(s), then reenable the HotKeySet():
Func MyFunc()
     HotKeySet("a", "")
     Send("aa")
     HotKeySet("a", "MyFunc")
EndFunc

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

and thank you to :)

but it seems that

HotKeySet("a", "")

is giving me an error when i test it

"error unknown function name"

obviously this way of disabling the hotkeyset is not working, should i use a function name that exists but dose nothing? or is there a better way to disable a the hotkeyset temporarily?

Edited by Krinje
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...