@Sakurra It seems perhaps the way keymapping works wasn't properly explained (mostly by me, ofc)
🙏
I understood. But the instructions for the notepad/.js thing were
only for the keymapping part. Remember I had said this whole thing occurs in two parts: first mapping the key to a "name" (AKA a string), and
then linking that
string to a function (i.e. calling the common event). You cannot
directly connect the common event to the shift key with a single script call - you must connect it to the
"name" that you have mapped the shift key to, in a separate line of code. That isn't anyone's decision, it's just how these JS functions work.
That's why this -
- won't work, no matter what code you put in there to call the common event. It's like trying to fit a square peg into a round hole, so to speak. The "string" between the single-quotes is not, and cannot be, a function (such as calling a common event). On its own, without being referenced by a separate script call, it does nothing. It basically just "names" the shift key, and this name can be anything you want - it's literally just something to refer to the key by in the second step.
The
second script call (e.g. Input.isPressed('<string>')) is where you would check if the key associated with that name/string is being pressed. You would use this second script call in a conditional branch, so that if it returns true (i.e. the player is pressing the key),
then you would have it call Common Event 22 as a result, in the way you normally would. That's where the parallel common event would come in, to constantly run this check, to "catch" every time the player presses it and then respond by calling Common Event 22. Without a parallel common event, there is no way to check for the button press
and use the result of that check to call a common event.
Personally, I don't know any JavaScript way around this that you could use in the notepad route. To be clear, I know
there is a way to do it all within a plugin (the notepad/.js thing is the equivalent of making a simple plugin), because clearly people have done it, as more complex plugins that do this
do exist (such as the two linked in this thread). I just don't know how to do the crucial second step with code like that, because there's more to it than just putting a single "Input.isPressed('<string>')" script call, on its own, into the notepad. Believe me, I tried, and I even tried to manually write out a conditional branch to replace the parallel common event altogether, too - but it doesn't work. It just requires more scripting complexity than I currently possess the knowledge to figure out.
So unless somebody else finds this thread who does know how to find the correct code to make this second step happen, then you'll have to either do the parallel common event thing, or use that one free plugin. Because just trying to wedge the "$gameTemp.reserveCommonEvent(22)" script call into random parts of the code almost certainly isn't gonna do anything (unless you get
extremely lucky and put it in the right spot by pure coincidence), sadly.
Side note:
Right, getting lost amidst all this I kept forgetting that the shift key
is one of the keys that's already keymapped by default (to the string 'shift'). So for this particular key, you
wouldn't have to do the first keymapping step at all, because the shift key already has a string you can reference it by in the second step (but all the keymapping stuff is still relevant for if you ever wanted to give a different key, that
isn't already keymapped by default, a custom function).
But yes, in
this particular case with the shift key, Trihan is right, there's no need to map it first. But we're still left with the crucial second step of actually having it call the common event, of which all my points above are still valid.
I hope this made any more sense than my previous explanations. I'm not the greatest (nor most concise) at explaining complicated things
😅 And it doesn't help that I've only barely dipped my toes into JS, and that this discussion took a turn toward way more JS-heavy stuff haha~
I hope somebody comes along who does know how to script all of this and can help you! But if that doesn't happen, then the parallel event thing and the free plugin are still perfectly valid options to settle for that will work.