Warframe: Send Ctrl + Space Topic is solved

Ask gaming related questions
Space_Ninja89
Posts: 6
Joined: 29 May 2018, 05:04

Warframe: Send Ctrl + Space

29 May 2018, 06:16

Hello and Thank you for reading
(English is my 3th language, so... a sorry ahead of times is in order. Sorry)
TL:DR at the bottom.

I have been a lurker for a few years until today!

My problem is the following:
In order to reduce strain on my left hand, i want to put two keys in one, the codes i have tried, they worked 90% of the time but the remaining 10% is the one that bugs me. This is the one that works most of the time.

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



It overwrites Space with LCtrl+Space. So I can keep the ability to chat as well as the script, also while Space is down, it keeps LCtrl down which is a welcomed accident. (yes i know i could use ~Space:: to keep its function, the problem is, it ends up sending Space AND Space down)

I have also tried with this and either LCtrl gets stuck down or Space Up:: end up sending a "Send {Space}"

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



I have the same problem with a Semi-Auto to Full Auto/Clicker script, the Left click is stuck down.

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

~$LButton::
While GetKeyState("LButton", "P") and (toggle = true){
Send, {Click}
Sleep, 100
}
return


What i suspect it is that the script doesn't finish completely, that is why i also tried with Blockinput, making it even worst.
Now, there is a way to fix the error, removing "Sleep" but it removes the point of the script.

I tried with SetKeydelay and Send instead of Sendinput it's even worst, it sends space in a loop.

Offtopic:
What is the difference between (and are they written correctly?):

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

SpaceIsDown::
Sendinput, {LCtrl Down}
Sendinput, {Space Down}
Return

SpaceIsUp::
Sendinput, {Space Up}
Sendinput, {LCtrl Up}
Return


TL:DR
So my question? Well, why does "Sleep" impact the script so much and is there a way around it? To have a delay between LCntrl and Space without Sleep nor SetKeyDelay?

And again Thank you very much for reading
User avatar
Nextron
Posts: 1209
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Warframe: Send Ctrl + Space

29 May 2018, 06:34

You're posting a lot of code fragments, but the main problem with all of them is the lack of a wildcard modifier. Hotkeys are only triggered when they match the logical modifier state (for example Control). Since you're setting in to a down state, your hotkeys will not match and no longer trigger. Prevent that by using for example ~*LButton::.
Secondly, using something like Send, {Click} releases all modifiers and represses them after. That's usually a good thing except in games. Prevent that by prepending {blind}: e.g: Send, {Blind}{Click}.
Thirdly; when using While, check the brackets as to which lines it should loop. As your indenting doesn't match the logics.

See if that fixes anything.
Space_Ninja89
Posts: 6
Joined: 29 May 2018, 05:04

Re: Warframe: Send Ctrl + Space

29 May 2018, 06:54

This was fast! Thank for taking the time.
I wrote a bunch of them in order to avoid the typical answer "have you tried (common erros)" next time ill keep in mind to only write the code with the problem.

I have tried the Wildcard * for the Space script and it dosent do anything towards the Sleep issue.
I didnt know that the position of the bracket had any affect on the code it was wrapping :O ill keep that in mind, thank you!
Space_Ninja89
Posts: 6
Joined: 29 May 2018, 05:04

Re: Warframe: Send Ctrl + Space

29 May 2018, 09:52

I think I managed to solve the issue

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



There is still a {Space Down}{Space Up} when Space:: is spammed or when it is held down for long, but there are no keys getting stuck anymore :dance:

Edit: T.05 Still gives me room for error leaving {Space Down}

Code: [Select all] [Download] GeSHi © Codebox Plus

013: SendInput,{LCtrl Down}
014: KeyWait,LCtrl,D, T.03 (0.02)
019: SendInput,{LCtrl Up}
020: SendInput,{Space Up}
021: Return (0.01)
015: SendInput,{Space Down}
016: Return (5.33)


I give up :(

Edit2:Cuz i dont know how formating works.
User avatar
Nextron
Posts: 1209
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Warframe: Send Ctrl + Space  Topic is solved

29 May 2018, 11:31

I think I finally understand the problem you were experiencing.
does this help?:

Code: [Select all] [Download] GeSHi © Codebox Plus

*Space::
SendInput, {Blind}{LCtrl Down}
Sleep, 50
If GetKeyState("Space", "P")
SendInput, {Blind}{Space Down}
return

*Space Up::
SendInput, {Blind}{Space Up}
SendInput, {Blind}{LCtrl Up}
return
Space_Ninja89
Posts: 6
Joined: 29 May 2018, 05:04

Re: Warframe: Send Ctrl + Space

29 May 2018, 17:19

This is by miles better than mine. Thanks you!
I managed to reproduce the error ONLY once after testing the code for an one hour or two.

Code: [Select all] [Download] GeSHi © Codebox Plus

013: SendInput,{Blind}{LCtrl Down}
014: Sleep,50 (0.05)
015: if GetKeyState("Space", "P")
016: SendInput,{Blind}{Space Down}
017: Return (10.28)


Nothing that a single tap to Space couldnt fix. Now i wanna understand where my logical errors are.
{blind}&* are necesary becouse im using Ctrl inside the Space script, right?

But why is this necesary?

Code: [Select all] [Download] GeSHi © Codebox Plus

If GetKeyState("Space", "P")
SendInput, {Blind}{Space Down}
return

Is it to avoid sending {Space Down} when the key is not physically down and getting it stuck?

Thank you very much for the help Nextron, you are a saviour :D
User avatar
Nextron
Posts: 1209
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Warframe: Send Ctrl + Space

29 May 2018, 17:37

Good to hear it helped. Your logic is correct. Furthermore, hotkeys can interrupt each other: When one hotkey is running and another is triggered. The running one will pause until the interrupting one finishes. That is why is is possible, the space up is sent before space down. The If GetKeyState("Space", "P") takes care of most occasions, but apparently it still managed to get interrupted just after it (the chance of being interrupted during the sleep of 50 ms is much greater that the time between the getkeystate and the sendinput which will likely be a fraction of a millisecond). If you put the Critical command on a new line between the sleep and getkeystate, that should be fixed too. As the hotkey will not be interruptible by hotkeys.
Space_Ninja89
Posts: 6
Joined: 29 May 2018, 05:04

Re: Warframe: Send Ctrl + Space

29 May 2018, 17:43

Critical inmplemented! Once again Thanks you

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 17 guests