^w5:HXZpwjUKxD2FCXu6Z>=szsB(8eLgcuXAhI51T2?O2:Cks2[qfy0bHZCnR%*%SYo8)7Kx<=y[Q^}%Oq&0#)G(l1V#zI[!0b@~D*/pCTloUbTH}4ZXyN:X Topic is solved

Ask gaming related questions (AHK v1.1 and older)
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

03 Sep 2021, 09:12

Code: Select all

F1::
SetTimer, Go, % (on := !on) ? 2 : "Off"
SoundBeep, 1000 + 500 * on ; OK to delete
Return
Go:
MouseMove, 9000, 0,, R
Return
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

03 Sep 2021, 09:52

Test it in Notepad. You can adjust the numbers if needed. A mouse does not turn. It can just move from one coordinate to another. This script moves the mouse to the right of its current location.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

03 Sep 2021, 10:07

I do not have a way to troubleshoot your game. What this script does: when you press F1, it moves the mouse to the right as fast as possible until you press F1 again.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

03 Sep 2021, 10:38

Code: Select all

F3::
SetTimer, Go, % (on := !on) ? 250 : "Off"
SoundBeep, 1000 + 500 * on ; OK to delete
Return
Go:
MouseMove, 100, 0,, R
Return
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

03 Sep 2021, 11:44

Teleporting is a game construct that AHK does not know. This script moves the mouse. Confirm that by testing it in Notepad.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

03 Sep 2021, 14:04

Describe what the script should do. Please include an example.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

04 Sep 2021, 06:55

The posted scripts will move the mouse if you press the hotkey first to start the action. When you try that in Notepad, does it work?
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

04 Sep 2021, 09:41

When you tested my script in Notepad, did it work?
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

04 Sep 2021, 11:11

I see no testing yet, just requests for more scripts and reading. If all of those statements are the same, you can simply put a single iteration of the command set into a short loop. That will save about 188,000 of the lines. The script is not especially helpful for a couple of reasons. The first is that the GetKeyState is assessed instantaneously when the script is run. The second is that key_shoot is undefined.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

04 Sep 2021, 12:18

Here is an example that you can adapt.

Code: Select all

#InstallKeybdHook
F3::
While GetKeyState(A_ThisHotkey, "P") {
 DllCall("mouse_event", "UInt", 2, "Int", 0, "Int", 0, "UInt", 0, "Int", 0)
 Sleep, 0
 DllCall("mouse_event", "UInt", 4, "Int", 0, "Int", 0, "UInt", 0, "Int", 0)
 SoundBeep, 1500
}
Return
These calls are not necessarily correct. I just copied them.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

05 Sep 2021, 07:05

MouseMove seems like a good option, no?
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

05 Sep 2021, 08:58

As you know, a mouse move is not a mouse drag. AHK does have a drag command. See MouseClickDrag.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

05 Sep 2021, 10:26

Sure. Here it is.

viewtopic.php?p=418861#p418861

Change F3 to F4.

Test in Notepad. Report the results from Notepad testing here.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

05 Sep 2021, 13:28

I thought that this question had been answered: "I want a script, when I press a key, it should turn the mouse straight to the right as fast as possible until I press that key again. Can you provide such a script?" Nonetheless, at the bottom of page 2, I have still failed to solve your problem. It's time for others to take over, to provide you with the answer. Best wishes.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

05 Sep 2021, 14:26

OK. I'm not sure if you are trying to block the mouse, but BlockInput might do it. You can try it.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

06 Sep 2021, 08:10

Here is a variant that may help. Test it in Notepad. What the script does: moves the mouse straight to the right at a certain speed until I press that key again when I press the F4 key as if I were just moving the mouse.

Code: Select all

#MaxThreadsPerHotkey 2
F4::
on := !on
BlockInput, MouseMove
While on
 MouseMove, 30, 0,, R
BlockInput, MouseMoveOff
Return
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

06 Sep 2021, 09:12

I tried. I hope that others will know a better way!
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

06 Sep 2021, 10:09

I'm glad that you have a solution. To add a hotkey, you can use the approach from my last post. Instead of the mouse move, you can insert your actions in a set of braces.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

06 Sep 2021, 10:28

You can use GetKeyState() to get a key's state. Example
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I want a script

06 Sep 2021, 10:40

I don't think that I can be helpful beyond the various examples and other notes that I have already posted. I see that your last script already contains the GetKeyState function. If your script does not work, then my advice is to shorten the script so that you can test just a few essential lines. After you have them working, you can expand from there. GetKeyState is an instantaneous check. Best of luck. In response to your post, entitled, "I want a script", below is a summary of the examples that I provided in this thread.

1. An example of how a hotkey can be used with "While" in a toggle manner.
2. An example of how a hotkey can be used with GetKeyState, so that you can hold a hotkey to repeat actions.
3. An example of how a hotkey can be used to toggle a timed routine to move the mouse.
4. An example of how to block manual mouse movements.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 46 guests