Sign in to follow this  
Followers 0
AzKay

How do I make the script not end until I exit it?

22 posts in this topic

WinActivate("Gunz Launcher")

HotKeySet("!{ESC}", "ExitGunz")
HotKeySet("{F2}", "ForwardDash")
HotKeySet("{1}", "LeftDash")
HotKeySet("{3}", "RightDash")
HotKeySet("{2}", "BackDash")

Func ExitGunz ()
Opt("SendKeyDownDelay", 10)
Send("!{F4}")
EndFunc

Func ForwardDash ()
Opt("SendKeyDownDelay", 10)
Send("{W 2}")
EndFunc

Func LeftDash ()
Opt("SendKeyDownDelay", 10)
Send("{A 2}")
EndFunc

Func RightDash ()
Opt("SendKeyDownDelay", 10)
Send("{D 2}")
EndFunc

Func BackDash ()
Opt("SendKeyDownDelay", 10)
Send("{S 2}")
EndFunc

Ok, Ive got this, everytime I run it, it Ends, but I dont want it to end unless I end it.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



needs a loop

While 1

Sleep(20)

Wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Add

while 1
sleep(10)
Wend

After the HotKeys

Edit - Beaten again.

Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

...and I was ready to post a loop with Sleep(111)

Edit: BTW, HotKeys interrupt Sleeps - so it really does not matter how long of a sleep you use, but too short of a sleep can impact the CPU cycles consumed during the idling loop. [There, now maybe that post was worth something :-)]

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks for the quick help ^^


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Thanks for the quick help ^^

Ok, another problem, when I run the script, I test it in Scite, example

I run the script

I click on the text box

I press "2" which is one of the hotkeys, but its meant to then "Send" the "S" key twice.

But it isnt, its just sending the number "2"


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

All of the number and letter keys have an output character

use F-Keys.... F1, F2, F3... etc

or Ctrl-Alt-1, Ctrl-Alt-2...etc

and there is no problem


NEWHeader1.png

Share this post


Link to post
Share on other sites

Are you using the numpad numbers or the regular numbers as they are different.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

HotKeySet("2", "BackDash")

not

HotKeySet("{2}", "BackDash")


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Ahh, ok.

@BigDod

Regular


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

You can also do this:

Send("WW")

@Others,

Does the help file suggest the {} are needed or best for a string?


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

You can also do this:

Send("WW")

@Others,

Does the help file suggest the {} are needed or best for a string?

I am pretty sure....No

however when making send commands with multiple letters, its probably safer to use the "raw" method

Send("WW", 1)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Ok, I tested it in a text box, works fine, it sends the right keys, everythings fine...But, when i use the hotkeys In-Game, they dont do anything, its supposed to

example DashForward is the w key twice, because w is to walk forward, on the game, if you want to dash, you press it twice...

but its not doing anything...Any ideas?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I am pretty sure....No...

Thanks.

...and since I've hijacked yet another thread...

What did you mean by:

All of the number and letter keys have an output character...

???

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

if you press most F-Keys, there is no character output to the screen

same with most control shift/Alt keys

( they maybe a hotkey)

with letters and numbers there is an actual output to the screen

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Have you seen behavior other than that described in the help file?

When you set a hotkey, AutoIt captures the keypress and does not pass it on to the active application...

Edit: Or am I still not understanding "output to the screen".

Exceptions: http://www.autoitscript.com/forum/index.php?showtopic=26920

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Wha? im getting confused, does this have anything to do with the question i asked about 4 posts ago?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Plato... you are correct

it does lock the "output"

i never used letters or numbers for hot keys ( directly) for the main reason of wanting full use of the keyboard letter/numbers for writting....

and not getting a letter/number and the hotkey/send

( i really thought i tested this before)

HotKeySet("a", "Sendit")


Run("notepad.exe")
WinWaitActive("")


While 1
    Sleep(10)
WEnd

Func Sendit()
    Send("test")
EndFunc

sorry for the mis-direction

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Wha? im getting confused, does this have anything to do with the question i asked about 4 posts ago?

Sorry for the confusion. That is what I meant by "...and since I've hijacked yet another thread..." you can ignore all of the banter below that post (or you could learn from it - it is related). You got your answer in post #10 (meaning that your script should work fine as is - you can keep the {} around your characters if you wish) - the rest is just FYI for you and us having a discussion about HotKeySet (in your thread - sorry again).

@Valuater,

No problem, I just could not reconcile the help file with that statement and thought that I did not understand the statement. I've spent a lot of time with CapsLock and ScrollLock due to that bug report... so all of this is fresh (but confused) in my mind.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Its still not working though, the script is working fine, but not ingame, i go into the game, run the script, but nothing happens.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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