Hello
I don't know much about AHK I mainly use prebuilt scripts. I'm not sure it's possible but what I'm looking for is a script that would let me press a button let's say Y that when pressed it would give you the Y button but when pressed again if already pressed it would then give U then restart with Y. I'm looking to toggle a item on off in a Starfield. Y equips the item & U unequips the item.
Thanks
Need Help with possible script/toggle?
Re: Need Help with possible script/toggle?
Welcome to this AutoHotkey forum!
Code: Select all
#Requires AutoHotkey v2.0
$y:: {
Static f := 0
SetKeyDelay 25, 25
SendEvent f := f = 'y' ? 'u' : 'y'
}
Re: Need Help with possible script/toggle?
Hallo,
or array instead of ternary:
or array instead of ternary:
Code: Select all
#Requires AutoHotkey v2.0
$y:: {
Static f := 0
SetKeyDelay 25, 25
SendEvent ["u","y"][1+f:=!f]
}
Re: Need Help with possible script/toggle?
mikeyww wrote: ↑01 Apr 2024, 18:31Welcome to this AutoHotkey forum!
Code: Select all
#Requires AutoHotkey v2.0 $y:: { Static f := 0 SetKeyDelay 25, 25 SendEvent f := f = 'y' ? 'u' : 'y' }
HelloRohwedder wrote: ↑02 Apr 2024, 02:16Hallo,
or array instead of ternary:Code: Select all
#Requires AutoHotkey v2.0 $y:: { Static f := 0 SetKeyDelay 25, 25 SendEvent ["u","y"][1+f:=!f] }
Thank You! Question though both seem to work what's the difference between them?
Re: Need Help with possible script/toggle?
The code is the different part! The result is the same.
1: f is "y" or "u" (if not 0).
2: f is 0 or 1.
1: f is "y" or "u" (if not 0).
2: f is 0 or 1.
Re: Need Help with possible script/toggle?
I didn't want to make a new topic so I'll ask here. Is there a way to have a script that when pressed it would press the Xbox controller button Left Trigger + T and then T again on release of the Xbox Controller Left Trigger?
Re: Need Help with possible script/toggle?
No, AHK does not have the capability of simulating controller button presses. There are ways to achieve this that are quite involved. See this thread.
In the future, please don't add on to your (or others') existing threads with a different topic. Please start a new thread.
In the future, please don't add on to your (or others') existing threads with a different topic. Please start a new thread.
Who is online
Users browsing this forum: moltenchees and 9 guests