• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
[v12+] Set the Controls Screen

Resource [v12+] Set the Controls Screen 1.1.2

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
-FL- submitted a new resource:

Set the Controls Screen - Creates a "Set the controls" screen.

gif.gif
screen.png

Creates a "Set the controls" screen on pause menu, allowing the player to map the actions to the keys in keyboard, ignoring the values defined on F1. You can also define the default controls.

Tested on Essentials v20.1. More versions on link. If this script isn't working on latest...

Read more about this resource...
 

wrigty12

Tester-Coder Hybrid
Member
Joined
Jul 24, 2022
Posts
549
Thank you!! I was wanting something like this for quite some time!
 

Specimen1334

Rookie
Member
Joined
Aug 2, 2022
Posts
4
Hi, this is a great idea, I have been wanting something like this for a while.
However I have run into an issue and have thus far been unable to solve it.
When I change up, down, left and right, to WASD. It doesn't work, it still uses the arrows to move, but does let me use WASD for menu selections.
I have tried editting it within the script, but clearly am missing something because it hasn't been working.
Thanks.
 

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
Hi, this is a great idea, I have been wanting something like this for a while.
However I have run into an issue and have thus far been unable to solve it.
When I change up, down, left and right, to WASD. It doesn't work, it still uses the arrows to move, but does let me use WASD for menu selections.
I have tried editting it within the script, but clearly am missing something because it hasn't been working.
Thanks.
I forgot to override dir4 and dir8 methods. These methods are used on player movement and town map cursor movement, respectively. Thanks for reporting!

I released a new version with this issue fixed.
 

wrigty12

Tester-Coder Hybrid
Member
Joined
Jul 24, 2022
Posts
549
I played around to add a bit more to this, and I have suggestions if you wanted to add them:
  • Have the option to switch to WASD mode (I created a second list of defaults, and a new button next to the Defaults button to do this for my game)
  • Allow adding this to the default Options menu in-game (I had to hack together something to work in the Options code, so there is probably a cleaner way to do it if you tried yourself)
 

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
Have the option to switch to WASD mode (I created a second list of defaults, and a new button next to the Defaults button to do this for my game)
Hmmm, since you can create a second "down", a second "left" and so on, having both things at same time this is still relevant?

Allow adding this to the default Options menu in-game (I had to hack together something to work in the Options code, so there is probably a cleaner way to do it if you tried yourself)
Good one! Actually, I did this for my game in 2014 XD

Is there a way to call the script in the Options Menu in v20.1?
I gonna take a look soon!
 

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
Allow adding this to the default Options menu in-game (I had to hack together something to work in the Options code, so there is probably a cleaner way to do it if you tried yourself)
[/LIST]
Is there a way to call the script in the Options Menu in v20.1?
I didn't found a cleaner way. My workaround:

On my script, comment/remove the

Code:
Expand Collapse Copy
MenuHandlers.add(:pause_menu, :controls, {
  "name"      => _INTL("Controls"),
  "order"     => 75,
  "effect"    => proc { |menu|
    pbPlayDecisionSE
    open_set_controls_ui(menu)
    next false
  }
})

On UI_Options script section:

Change 'return @options.length + 1' to 'return @options.length + 2'.

Change 'optionname = (index == @options.length) ? _INTL("Close") : @options[index].name' to

Code:
Expand Collapse Copy
    optionname = case index
      when @options.length+1; _INTL("Close")
      when @options.length;   _INTL("Controls")
      else; @options[index].name
    end

Change 'return if index == @options.length' to 'return if index >= @options.length'.

Change 'description = _INTL("Close the screen.")' to

Code:
Expand Collapse Copy
      if @sprites["option"].index==@options.length
        description = _INTL("Set the Controls.")
      else  
        description = _INTL("Close the screen.")
      end

Change 'break if @sprites["option"].index == @options.length' to

Code:
Expand Collapse Copy
          break if @sprites["option"].index == @options.length+1
          open_set_controls_ui if @sprites["option"].index == @options.length
.
 

Gardenette

Cooltrainer
Member
Joined
May 30, 2022
Posts
156
Hi there,

Love the script. I was wondering if you knew how to bring back gamepad functionality. Apparently gamepads work in base essentials. I took out this script and tried a gamepad, and it did indeed work. I popped this script back in, and all of a sudden the gamepad isn't registered.

I'm in v19.1
 

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
Hi there,

Love the script. I was wondering if you knew how to bring back gamepad functionality. Apparently gamepads work in base essentials. I took out this script and tried a gamepad, and it did indeed work. I popped this script back in, and all of a sudden the gamepad isn't registered.

I'm in v19.1
The MKXP-Z gamepad API changed recently (so it isn't even implemented on Essentials) and the old documentation vanished. Without the old doc, I don't know how to call the controller API.

So, only for v21 maybe, or when I find the old doc.
 

Gardenette

Cooltrainer
Member
Joined
May 30, 2022
Posts
156
How would I return the key that is bound to a control? For example, I have a button that speeds up the game, the Q button by default. When I mention in the game how to change the game speed, I want to return "Press (whatever button you set) to change the game speed."

So if the player changed the button from Q to R, I want to be able to do a message that says "Push the R key to change the game speed."
 

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
How would I return the key that is bound to a control? For example, I have a button that speeds up the game, the Q button by default. When I mention in the game how to change the game speed, I want to return "Press (whatever button you set) to change the game speed."

So if the player changed the button from Q to R, I want to be able to do a message that says "Push the R key to change the game speed."
Good question.
Code:
Expand Collapse Copy
$PokemonSystem.game_controls.find{|c| c.control_action=="Cancel"}.key_name
Gets the first key name with action "Cancel".
Code:
Expand Collapse Copy
$PokemonSystem.game_controls.find_all{|c| c.control_action=="Cancel"}.map{|c| c.key_name})
Gets an array with key names with action "Cancel".
 

Gardenette

Cooltrainer
Member
Joined
May 30, 2022
Posts
156
Good question.
Code:
Expand Collapse Copy
$PokemonSystem.game_controls.find{|c| c.control_action=="Cancel"}.key_name
Gets the first key name with action "Cancel".
Code:
Expand Collapse Copy
$PokemonSystem.game_controls.find_all{|c| c.control_action=="Cancel"}.map{|c| c.key_name})
Gets an array with key names with action "Cancel".
Works perfectly <3 thank you!
1669036740215.png


text = _INTL("{1} Speed: {2}",$PokemonSystem.game_controls.find{|c| c.control_action=="Change Game Speed"}.key_name,$GameSpeed.to_s)
 

Terra

Novice
Member
Joined
Apr 15, 2023
Posts
15
sorry, i'm very new to scripts in general and would like to ask how do you add a new changeable control to the list? for example, the move description viewer from enhanced UI
 

-FL-

Pokémon Island Creator
Member
Joined
Aug 28, 2022
Posts
307
sorry, i'm very new to scripts in general and would like to ask how do you add a new changeable control to the list? for example, the move description viewer from enhanced UI
No problem! I gonna do an example with AUX1 key, with default key set as "V". Before line
Code:
Expand Collapse Copy
ControlConfig.new("Ready Menu", "D")
add
Code:
Expand Collapse Copy
ControlConfig.new("Details Viewer", "V"),

Before line
Code:
Expand Collapse Copy
# AUX1 and AUX2 unused
add:
Code:
Expand Collapse Copy
when Input::AUX1
  return $PokemonSystem.game_control_code("Details Viewer")

Before line
Code:
Expand Collapse Copy
hash["Ready Menu"  ] = _INTL("Open Ready Menu, with registered items and available field moves.")
add:
Code:
Expand Collapse Copy
hash["Details Viewer"  ] = _INTL("Here goes the description")

After doing this, you main need to reset the commands to default ones (confirm the "default" item on controls screen) if you wish to update the save controls.

If AUX1 and AUX2 aren't enough for you and you want to add more, do this: Before this script (like at top), add a module input with the new constants. I will use AUX3 and SOME_OTHER_NAME in my example:

Code:
Expand Collapse Copy
module Input
  AUX3 = 40
  SOME_OTHER_NAME = 41
end
I choose 40 and 41 as values, since I know that others like 13 are already taken. You can continue at 42 and so on.

I don't know what button enhanced UI uses for move description viewer, but you need to change it to Input::AUX1 (like other inputs) OR use the Enhanced UI input rather than AUX1.
 
Last edited:

Alpha Zetanium XYZ

Novice
Member
Joined
Jul 25, 2022
Posts
10
hello, I just wanna ask how can I add this to the options menu? (where you select the text's speed or change your text dialog graphics)
 
Back
Top