it happen the revere! Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Jayyo92
Posts: 5
Joined: 06 May 2024, 11:20

it happen the revere!

06 May 2024, 11:31

hello everyone,
im tryng to execute this scripit but it happens the revere: the scrip is always running and it stops when Lshift is being held. i want it to be always stopped and enable it while LShift is being held.
thank you

Code: Select all

If Getkeystate ("LShift","P")
{
LButton::
Loop
{
SetMouseDelay 1
Click
If (GetKeyState("LButton", "P")=0)
Break
}
Return
}
Last edited by joedf on 06 May 2024, 11:41, edited 1 time in total.
Reason: fix [code] tags
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

Re: it happen the revere!

06 May 2024, 20:14

Welcome to this AutoHotkey forum!

The first line means nothing, because hotkeys defined by :: are not subject to control flow in that manner.

Code: Select all

#Requires AutoHotkey v1.1.33.11

+LButton::
While GetKeyState("LButton", "P")
 Send {LButton}
Return
Explained: Hotkey modifier symbols

If you are new to AHK, I recommend using its current version, which is v2, instead of this older deprecated version that is no longer developed.
Jayyo92
Posts: 5
Joined: 06 May 2024, 11:20

Re: it happen the revere!

10 May 2024, 12:53

Thank you Mikeyww.
im late i thought i would receive an emeail notification, just came here to check.

I currently have both versions and in fact I found this script and ran it using version 1.1
the script was originally written as follow and it worked perfectly (basically a mouse rapid trigger):

Code: Select all

Browser_Home::Suspend
LButton::
Loop
{
SetMouseDelay 1
Click
If (GetKeyState("LButton","P")=0)
Break
}


in this way i am activating or suspendig the script by pressing "home button" but the point is that i am not able to know(remember) if it is running or not. so now, i would just want the same script always active but with the condition to have LShift being pressed.

another option, that i would also prefere, is that the script is the same as the original one (run it or suspend it with "home button") but to add or remove a gui overlay (that i already have) when the script is running or when i press home button (dont know wich one will work better).

i tried with that following code it is working but the gui pops out one time and never go away even when script is suspended

Code: Select all

Browser_Home::
Suspend
Gui, +LastFound -Caption +AlwaysOnTop +ToolWindow -Border
Gui, % CLICKTHROUGH := "+E0x20"
Gui, Color, White
Gui, Add, Picture,, %A_ScriptDir%\Reminder.png
Gui, Show, x1200 y0 NoActivate
WinSet, TransColor, White
LButton::
Loop
{
SetMouseDelay 1
Click
If (GetKeyState("LButton","P")=0)
Break
}
Return


i am not that good in programming and new to AHK can you please share a script solution? appreciate it, thanks a lot


[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

Re: it happen the revere!

10 May 2024, 13:42

I would focus on fixing the first problem first. You can know whether your script is suspended via the "S" icon in the system tray. In any case, you could test the script that I posted to see whether it works.
User avatar
boiler
Posts: 17184
Joined: 21 Dec 2014, 02:44

Re: it happen the revere!

10 May 2024, 13:44

Since I was about to post this anyway...

Suspend only stops hotkeys from being active. It doesn't stop code from running or hide GUIs that are displayed. This seems like what you want, although I'm not sure.

Code: Select all

Gui, +LastFound -Caption +AlwaysOnTop +ToolWindow -Border
Gui, % CLICKTHROUGH := "+E0x20"
Gui, Color, White
Gui, Add, Picture,, %A_ScriptDir%\Reminder.png
Gui, Add, Text,, Hello
Gui, Show, x1200 y0 NoActivate
WinSet, TransColor, White
Toggle := 0

Browser_Home::
Suspend
if (Toggle := !Toggle)
	Gui, Cancel
else
	Gui, Show
Return

LButton::
Loop
{
SetMouseDelay 1
Click
If (GetKeyState("LButton","P")=0)
Break
}
Return
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

Re: it happen the revere!

10 May 2024, 13:50

Can also use A_IsSuspended if you like.

Code: Select all

Browser_Home::
Suspend
If A_IsSuspended
     Gui Hide
Else Gui Show
Return

LButton::
While GetKeyState("LButton", "P")
 Send {LButton}
Return
Jayyo92
Posts: 5
Joined: 06 May 2024, 11:20

Re: it happen the revere!

10 May 2024, 14:44

mikeyww wrote:
10 May 2024, 13:42
I would focus on fixing the first problem first. You can know whether your script is suspended via the "S" icon in the system tray. In any case, you could test the script that I posted to see whether it works.
i dont think i understood how i supposed to edit the script with your second script. ive repleced the LButton:: with your script and nothing is working now.
i know that i can see if it is suspended or nor via try icon but i need a gui since i need it while im playing in full screen.
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

Re: it happen the revere!  Topic is solved

10 May 2024, 15:03

Just my suggestion, but I recommend that instead of changing three different things, just make one change at a time. If you test my first script without changing it, you can determine whether the Shift + click works. After it works, the next change can be pursued.

What the script does:
I want it to be always stopped and enable it while LShift is being held.
Well, specifically, you would press Shift+LButton to trigger the hotkey. Releasing LButton then ends the subroutine.
Jayyo92
Posts: 5
Joined: 06 May 2024, 11:20

Re: it happen the revere!

10 May 2024, 16:24

@mikeyww
yes totally agree with this way of troubleshooting but i was talking about two different script and two different behaviour.
btw your script you gave works perfectly. thanks.

also the script given me by@boiler is working fine, the only problem is that when i the script is running with the gui being shoiwn it happens that the game is not more the primary active window and the mouse cursor appear so the game doesnt respond to the input
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

Re: it happen the revere!

10 May 2024, 17:26

To avoid activating the GUI, NoActivate would need to be used every time the GUI is shown.
Jayyo92
Posts: 5
Joined: 06 May 2024, 11:20

Re: it happen the revere!

11 May 2024, 03:08

@mikeyww
yep ive added for the "show" as well, works as it should be! thank you!!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: justsda89 and 28 guests