• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Toggle Run/Walk Button

Rayd12smitty

Shadow Maker
  • 645
    Posts
    12
    Years
    • Seen Feb 21, 2016
    Hi everyone. I was playing Soul Silver today, and suddenly had an inspiration. One of my favorite parts of HGSS was the toggle run/walk button. Does anyone know how to add that into essentials? I would like it to be toggled on and off by hitting the "a" button if possible. Thanks in advance
     
    Notes that 'A' in Default Essentials matchs 'Z' in keyboard. Change ZZZ for one switch number. Untested.

    In Scene_Map, before line 'if Input.trigger?(Input::F5)' add:

    Code:
    if Input.trigger?(Input::A)
      $game_switches[ZZZ]=!$game_switches[ZZZ]
    end

    In Walk_Run change the line 'return Input.press?(Input::A) &&' to 'return $game_switches[ZZZ] &&'.
     
    Ok. I don't want to change what any buttons do, just add one. I won't use 'a' then. I think I understand what to do, just no how to add a button. The button could be anything, could you show me how to make, say "p" do it?

    Sorry for all the trouble and thanks

    Ok. I don't want to change what any buttons do, just add one. I won't use 'a' then. I think I understand what to do, just no how to add a button. The button could be anything, could you show me how to make, say "p" do it?

    Sorry for all the trouble and thanks
     
    Last edited:
    'X' in Default Essentials matchs 'A' in keyboard, so change 'Input::A' to 'Input::X'. I guess that 'Input::P' may works for 'P'.

    To see/change the button/keyboard configuration press F1 during game. This isn't a debug feature, so other players also can use it.
     
    I thought I'd include a brief explanation of controls here, to avoid confusion. Note that I'm going to use the words "button" and "key" to mean separate things.

    Consider a Sega Genesis controller. There are the directional buttons, and three more buttons called A, B and C. These are the buttons that the scripts in Essentials refer to. C is the "confirm/use" button, B is the "back/cancel/menu" button, and A is the "run/other" button. There are several other available buttons, such as the X, Y and Z buttons (currently unused), plus ones like F5, L and R (which are all used).

    Now look at a keyboard. At the bottom left are the keys Z, X and C. These correspond to the controller's A, B and C buttons respectively. So if you press the Z key on your keyboard, the game translates this into Input::A.

    Where is this translation done? In the script section PokemonControls, in def self.buttonToKey. This method lists all the available buttons, and then matches them to one (or more) keys on a keyboard. For example:

    Code:
          [COLOR=Blue]when[/COLOR] Input::A
            [COLOR=Blue]return[/COLOR] [[COLOR=DarkRed]0x5A[/COLOR],[COLOR=DarkRed]0x10[/COLOR]] [COLOR=Green]# Z, Shift[/COLOR]
          [COLOR=Blue]when[/COLOR] Input::B
            [COLOR=Blue]return[/COLOR] [[COLOR=DarkRed]0x58[/COLOR],[COLOR=DarkRed]0x1B[/COLOR]] [COLOR=Green]# X, ESC [/COLOR]
          [COLOR=Blue]when[/COLOR] Input::C
            [COLOR=Blue]return[/COLOR] [[COLOR=DarkRed]0x43[/COLOR],[COLOR=DarkRed]0x0d[/COLOR],[COLOR=DarkRed]0x20[/COLOR]] [COLOR=Green]# C, ENTER, Space[/COLOR]
    As FL mentioned, the X button (the A key on the keyboard) is currently unused. To make the A key on the keyboard toggle running, you would use Input::X. It would be convenient, since it's the key directly above the one used for running.
     
    I thought I'd include a brief explanation of controls here, to avoid confusion. Note that I'm going to use the words "button" and "key" to mean separate things.

    Consider a Sega Genesis controller. There are the directional buttons, and three more buttons called A, B and C. These are the buttons that the scripts in Essentials refer to. C is the "confirm/use" button, B is the "back/cancel/menu" button, and A is the "run/other" button. There are several other available buttons, such as the X, Y and Z buttons (currently unused), plus ones like F5, L and R (which are all used).

    Now look at a keyboard. At the bottom left are the keys Z, X and C. These correspond to the controller's A, B and C buttons respectively. So if you press the Z key on your keyboard, the game translates this into Input::A.

    Where is this translation done? In the script section PokemonControls, in def self.buttonToKey. This method lists all the available buttons, and then matches them to one (or more) keys on a keyboard. For example:

    Code:
          [COLOR=Blue]when[/COLOR] Input::A
            [COLOR=Blue]return[/COLOR] [[COLOR=DarkRed]0x5A[/COLOR],[COLOR=DarkRed]0x10[/COLOR]] [COLOR=Green]# Z, Shift[/COLOR]
          [COLOR=Blue]when[/COLOR] Input::B
            [COLOR=Blue]return[/COLOR] [[COLOR=DarkRed]0x58[/COLOR],[COLOR=DarkRed]0x1B[/COLOR]] [COLOR=Green]# X, ESC [/COLOR]
          [COLOR=Blue]when[/COLOR] Input::C
            [COLOR=Blue]return[/COLOR] [[COLOR=DarkRed]0x43[/COLOR],[COLOR=DarkRed]0x0d[/COLOR],[COLOR=DarkRed]0x20[/COLOR]] [COLOR=Green]# C, ENTER, Space[/COLOR]
    As FL mentioned, the X button (the A key on the keyboard) is currently unused. To make the A key on the keyboard toggle running, you would use Input::X. It would be convenient, since it's the key directly above the one used for running.

    Curious about this, using this as a base would it be possible to implement more buttons than RMXP normally allows? Like, say...

    when Input::D
    return [HEX,HEX] # BUTTON, BUTTON
     
    Yep, you can add in new inputs as you desire, and assign them to whichever keyboard keys you want. You'll also need to define your new input as a number at the top of module Input (see around line 20).

    I haven't tried it myself, but it seems like it should work.
     
    Yep, you can add in new inputs as you desire, and assign them to whichever keyboard keys you want. You'll also need to define your new input as a number at the top of module Input (see around line 20).

    I haven't tried it myself, but it seems like it should work.

    I tired it with some alt keys before it does work.
     
    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NameError

    Message: uninitialized constant Game_Player::ZZZ

    Walk_Run:26:in `pbCanRun?'

    Walk_Run:69:in `update'

    Scene_Map:85:in `miniupdate'

    Scene_Map:83:in `loop'

    Scene_Map:95:in `miniupdate'

    Messages:145:in `pbUpdateSceneMap'

    Messages:1517:in `pbMessageDisplay'

    Messages:1005:in `pbMessage'

    Messages:649:in `command_101'

    Interpreter:304:in `execute_command'



    This exception was logged in

    C:\Users\USUARIO\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------



    Essentials V15.1 would one stop?

    thank you
     
    Last edited:
    Back
    Top