need help with a script for a rhythm game

Ask gaming related questions (AHK v1.1 and older)
NpoymrnC
Posts: 1
Joined: 09 Dec 2018, 06:31

need help with a script for a rhythm game

09 Dec 2018, 08:44

Hello everyone~

Sorry if the subject's a bit too vague, I just don't know how to explain what I'm trying to do in one sentence.
So I have this script that basically forces you to alternate keys (F and J) while playing.
It stops you from pressing the same key twice (be it F or J), forcing you to constantly switch between the two ( j f j f j f j f )
It's basically a tool to help people learn a specific style of playing where you alternate every key all the time, never pressing the same key twice.
This is what it looks like:

Code: Select all

CurrentKey := 0

*j::
if (CurrentKey = 0) {
    SetKeyDelay -1
    Send {Blind}{j Down}
    CurrentKey := 1
}
return

*j up::
SetKeyDelay -1
Send {Blind}{j Up}
return

*f::
if (CurrentKey = 1) {
    SetKeyDelay -1
    Send {Blind}{f Down}
    CurrentKey := 0
}
return

*f up::
SetKeyDelay -1
Send {Blind}{f Up}
return
The problem is, there are 2 types of notes in the game, a small note and a big one. And in order to hit the big note you need to press F and J at the same time (FJ/JF)
And so sometimes you get patterns like so "small BIG small" that in the full alternator playstyle should be played by either pressing "f FJ/JF j" or "j FJ/JF f" but the script doesn't allow you to do so and forces you to either play it as "f J f" or "j F j"

So I wondering if there's any way to fix this, maybe make it so that when you press F and J at the same time (FJ/JF) the script skips or ignores it and just keeps working from where it's left off.
For example you press "f", and then when you press FJ/JF the script ignores it and continues the way it would've continued if you didn't press FJ/JF, so the next button that should be pressed would be "j" allowing you to play patterns like "small BIG small" just fine.

I'm sorry if any of this is a confusing, the code I have so far wasn't written by me, I think I understand it after going over it a couple of times but I've no idea how to add something like what I've described above.
Maybe there's a different way one could make playing big notes possible but I couldn't come up with anything else.
Any help would be appreciated :3
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: need help with a script for a rhythm game

12 Dec 2018, 08:45

There is no such thing as two keys pressed at exactly the same time. One will always be slightly before the other.
What makes f FJ j valid but f f j j not valid? Is it the fact that with FJ, j is held before f is released?

ie if I understand you correctly, this is valid key sequence for f FJ j (d for down, u for up):
Fd Fu / Fd Jd Ju Fu / Jd Ju

But I understand that this should be invalid:
Fd Fu / Fd Fu Jd Ju / Jd Ju

In this instance, you would *need* to delay all output.

After Fd Fu, when Fd comes in, you need to wait for the next key (Either Fu, or Jd) before you know if this key was valid.

This complicates matters significantly, and is probably not feasible for your use-case, as you need to preserve the timing of the original input.

If I misunderstood, if you could explain things in the kind of terms I did, as to what should be valid, and what should be invalid, then I can maybe help you work out how to implement it.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 46 guests