Key Rebinding options

Galdon2004

  • *
  • Posts: 318
So, I am working on an action platformer and am finding that no matter what I make the controls, a large number of players complain that they can't use them. I've tried adding aliases between popular control schemes, but it seems like things don't work if you have three aliases to the same key, and I can't do that for control schemes that have button overlap.

I am wondering if there is any way to set up a settings menu where the player can rebind the keys to their preference. I've searched on google but the closest thread I found was tagged obsolete.

Luyren

  • *
  • Posts: 2783
My cutscene resource pack includes a key config menu: https://luyren.itch.io/luyrens-cutscene-resource-pack
It works for both gamepads and keyboard, and it includes documentation files, as well as a configured menu in the sample game if you pay extra. Video tutorial on this aspect of the pack will take a few weeks to come out.

Rob made an extension for automatic gamepad binding: http://community.stencyl.com/index.php/board,9.0.html

And if you can manage your lists, you can do your own gamepad binding from this article: http://www.stencyl.com/help/view/gamepads/
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Galdon2004

  • *
  • Posts: 318
Thanks, I was able to use the article to set up a game pad; though that doesn't allow for keyboard rebinding. I bought the resource pack, but I am having difficulty setting it up. There are a very large number of options, and it is a bit overwhelming due to the sheer amount of information at once. I am currently stumped on seemingly the first part. Creating a game attribute to house the controls.  I understand the first part should be the name of the control; I do not know what I am looking for exactly for the gamepad input.

As well, I am assuming I put it into the list called control config game attribute map; but see it is already populated with each value being the same attribute name. So, should I be making one attribute that shares all controller types? Or make one for each controller? And how do I find the key exactly? It says to check the log, but I can't run the game due to the event's manager's entire "events" event being in red with an "Expected }" error.

Edit: Tried to take that event out temporarily, and it gave a new error with set controls having the "call controls" event contain a line "set Scrollbar Background Image to" having no value.  The sample game does compile so I checked and it has a bunch of blocks in that value, but if I try to paste it from the sample game, it does not paste in.

If relevant, I am on version 4.0.2 b10534

« Last Edit: May 29, 2020, 05:36:37 am by Galdon2004 »

Luyren

  • *
  • Posts: 2783
I'll make a video tutorial specifically about the controls part, but that will take a while still. You can reference the sample game to have some idea as to how it is setup in there, it has a pre-configured game attribute with Stencyl's default controls set. I also recommend you read the documentation file for the pack and for the sample game, they will provide extra information.

Quote
I understand the first part should be the name of the control; I do not know what I am looking for exactly for the gamepad input.
The second part are the gamepad input codes for that control. You can reference the Stencylpedia article on gamepads to learn about them and how to discover the code for each button. For example:
up|11/-axis 1
The control called "up" accepts the gamepad input codes "11" and "-axis 1", which are the Up d-pad and Up on the left analog sticks. Input codes appears to be universal for all controllers from what I've tested, but you have the option to create separate bindings for different controllers.

Quote
As well, I am assuming I put it into the list called control config game attribute map; but see it is already populated with each value being the same attribute name. So, should I be making one attribute that shares all controller types? Or make one for each controller?
If you use the dash key, it will use that game attribute for any controllers that aren't specified, so you don't need to make one for each controller (unless you want to). You can safely remove the other keys and just use the dash one.
Quote
And how do I find the key exactly? It says to check the log, but I can't run the game due to the event's manager's entire "events" event being in red with an "Expected }" error.
Again, if you just want one set of gamepad bindings, you don't need to worry about the gamepad name.
I just tested importing the pack on a new game, and everything is working properly. Only things that come to mind is if you deleted other behaviors of that pack that were dependencies, or if you are using a Stencyl build before 4.0.2, which mix up the custom blocks when importing resources and renders it pretty much unusable. What is the line of code you get in the error?


My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Galdon2004

  • *
  • Posts: 318
I've attached the two error messages. I currently have the game reverted to a backup so I can keep working on it while trying to troubleshoot. I am using 4.0.2, and I didn't delete any behaviors from the pack when I imported it. If it's relevant, I am using your utility pack and your misc behaviors pack, in case either of those cause conflicts.

When you say game pad, by the way, does that include keyboard?

Luyren

  • *
  • Posts: 2783
Oh boy. The Cutscene Pack already includes the miscellaneous pack within it, meaning you are getting duplicate resources when you import it. I'm pretty sure that's what's causing it. One way around it is to remove the misc pack and all its behaviors from your game (right click the resource pack, select remove and then "Erase Resources" or something to that effect), then importing the cutscene pack. I recommend you create a separate backup of your game to try that. You can then open two instances of Stencyl, with different versions of your game open, and copy over the settings of any behaviors of the misc pack you were already using.
EDIT: I don't think removing just the duplicates will solve the issue, hence this suggestion.

The utility pack is fine, you don't have to mess with those behaviors.

That explanation I posted is only for gamepad stuff. Keyboard is handled by the rest of the behavior, mainly through the "Controls List" attribute, in which you configrue all the controls you want to be able to change mid-game. You can even ignore the gamepad parameters in that list if you don't plan to have gamepad support.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Galdon2004

  • *
  • Posts: 318
So, I'm not sure if I understand your instructions. So, before I try it, I want to clarify; so I should make a new version of the game from the backup, so I have two versions of the game. Remove Misc from the new one, then install Cutscene into it. Then re-implement the behaviors I was using that came from Misc using the first version as a reference?

Also, am I understanding correctly that the behavior will automatically handle the keyboard then, and the global attribute is for the gamepad? Or is there anything else in the behavior I need to set up for the keyboard. I am planning for gamepad controls as well but since I will also be exporting to web format I need to be able to allow key rebinding on the keyboard.

Luyren

  • *
  • Posts: 2783
So, I'm not sure if I understand your instructions. So, before I try it, I want to clarify; so I should make a new version of the game from the backup, so I have two versions of the game. Remove Misc from the new one, then install Cutscene into it. Then re-implement the behaviors I was using that came from Misc using the first version as a reference?
Yes, that's the idea. This should get rid of the errors you encountered, and should make it easier for you to reconfigure everything.
Quote
Also, am I understanding correctly that the behavior will automatically handle the keyboard then, and the global attribute is for the gamepad? Or is there anything else in the behavior I need to set up for the keyboard. I am planning for gamepad controls as well but since I will also be exporting to web format I need to be able to allow key rebinding on the keyboard.
Keyboard and the main body of the menu is handled in the Controls List attribute. You'll have to configure that to do anything with this behavior regardless. The use of extra game attributes is only required for gamepad support. You still have to configure your controls in Stencyl as usual.
The behavior creates game attributes on its own for storing some information for the controls. It's the attributes that refer to global values. You can just use the default names for those.
The rest of the attributes handle sound, navigation, layout and options.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Galdon2004

  • *
  • Posts: 318
I am having difficulty with the new versions of the behaviors. player control behavior stops the protagonist from moving again. I remember I had to tweak it before to make it work, but I am having trouble finding the old thread on that. The search function finds some of my oldest posts but none of my newer ones...

Edit: I think I figured the issue out and have it back to "stable" but with nothing set up. I ran the game but the log does not display anything when I press controller buttons. So, I have no idea what to set the global list variable values to. Would it be easier to use your behavior just for they keyboard and use the stencyl blocks for editing the gamepad? If so, how would I set it up just with the keyboard?

My attempts to tinker on my own are not going great so far, unfortunately. I'm a fairly visual learner so the text instructions seem not to give me a good idea of what things will look like when they are working and how to get them there.

« Last Edit: May 29, 2020, 10:31:32 pm by Galdon2004 »

Luyren

  • *
  • Posts: 2783
I am having difficulty with the new versions of the behaviors. player control behavior stops the protagonist from moving again. I remember I had to tweak it before to make it work, but I am having trouble finding the old thread on that. The search function finds some of my oldest posts but none of my newer ones...
There's a video on the behaiors of the misc pack, if you still need extra help: https://www.youtube.com/watch?v=5BROU617SRE&t=4s
Quote
Edit: I think I figured the issue out and have it back to "stable" but with nothing set up. I ran the game but the log does not display anything when I press controller buttons. So, I have no idea what to set the global list variable values to. Would it be easier to use your behavior just for they keyboard and use the stencyl blocks for editing the gamepad? If so, how would I set it up just with the keyboard?
You have to follow the Stencylpedia article to learn the gamepad input codes: http://www.stencyl.com/help/view/gamepads/
Add an event somewhere and use this, and keep note of what button corresponds to what code.

Quote
My attempts to tinker on my own are not going great so far, unfortunately. I'm a fairly visual learner so the text instructions seem not to give me a good idea of what things will look like when they are working and how to get them there.
I do have a video on this specific behavior planned. I'm unable to work on videos for a while longer though, so that will still take some time, and I apologize for that.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Galdon2004

  • *
  • Posts: 318
I got the game pad set up with blocks. Still haven't figured out your behavior though. I may have to just wait for the video to come out, as It's a bit overwhelming and text descriptions aren't seeming to work for me. I sometimes just have to see the process of making something work to understand it.

If you don't mind a small amount of constructive criticism; while your stuff works well once I understand it, I feel that perhaps you might put a little bit too much into single behaviors at times. For example this "Set Controls" behavior contains the initial setup for controls, setting up the menu, menu navigation, and setting new controls all in one package, so I need to understand all of it and implement all of it correctly before any of it works. If there was one behavior for setting up the controls, one for menu creation/navigation, and one for rebinding controls, I think it would be a lot easier to digest going into it blind.

Luyren

  • *
  • Posts: 2783
Appreciate the criticism and I see where you are comming from, but I believe that's not viable. Set Controls is a behavior from my kit that I isolated to include in this pack. The kit itself has about 12 other menu behaviors, all in this style. If I separate each of those into behaviors with just pieces of it as you suggested, you'll then have 36 behaviors just for those, which I think would be way more confusing. Not to mention the dependencies with other pieces of code and how they interact with each other would be more difficult to manage.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.