• 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.

Control Voltor Flip Minigame with mouse

11
Posts
5
Years
  • Hi! This script allow you to play the Voltor Flip Minigame using the mouse and its keys. First, you need to know how this will work:
    • Left-clicking on a tile will flip it (or mark a memo on it).
    • Right-clicking anywhere will ask to leave.
    • Left-clicking on the left buttons will trigger them.
    • You can still use the keyboard to play.
    If you hadn't done any changes in this script, the easiest way to implement it is by copying this code and replacing the def getInput in line:
    Spoiler:


    In case you'd done too many changes, it's more worth it to do step by step all I've done.
    First, below the def getInput add these lines:
    Code:
    #  def getInput
        mousepos = Mouse::getMousePos() rescue [-1,-1] #!# Control with mouse
        click = Input.triggerex?(Input::LeftMouseKey)
        triggerc = Input.trigger?(Input::C)
    Now, cut all the code between elsif Input.trigger?(Input::C) and the next condition elsif ... (excluding the last line) and move it to the last line of the method, above pbDrawImagePositions ... (make sure you haven't copied other condition).

    Then, in the same condition, replace elsif Input.trigger?(Input::C) by this:
    Code:
        #elsif Input.trigger(Input::C)
        elsif triggerc || click #!# Control with mouse Input.trigger?(Input::C)
          index = click ? [((mousepos[0]-128)/64.0).floor,(mousepos[1]/64).floor] : @index
          return if click && (index[0] < 0 || index[1] < 0)

    Now, since this copied line down to the end of the method, replace all @index by index (tip: use Cntrl+H, but don't use 'replace all'). If you don't know exactly how this should remain, look at the 'spoiler' code.

    After, find elsif Input.trigger?(Input::B) and add in that same line this:
    Code:
     || (click && (10...118)===mousepos[0] && (332...372)===mousepos[1]) || Input.triggerex?(Input::RightMouseKey) #!# Control with mouse

    Lastly, find elsif Input.trigger?(Input::CTRL) and, again, add to the line this code:
    Code:
     || (click && (14...114)===mousepos[0] && (200..316)===mousepos[1]) #!# Control with mouse

    And now you've done! Enjoy playing this game more comfortably!
     
    Back
    Top