Virtual Buttons and DPad

Discussion in 'JS Plugin Releases (RMMV)' started by Aloe Guvner, Apr 18, 2018.

  1. aroha

    aroha Villager Member

    Messages:
    6
    Likes Received:
    1
    First Language:
    Chinese
    Primarily Uses:
    RMMV
    Then I found another problem. When I use the transfer, sometimes it will automatically go straight ahead.
    2019-05-02 22-30-17_20190502224003.gif
     

    Attached Files:

  2. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @aroha Yup, I'm aware of that bug. It was reported here and here and here and here.

    I've made the fix for that bug as mentioned here, it's available on a separate branch in Github that you can download if you want. I haven't "released" it yet because I'm still adding a few more features and testing. Testing takes a lot of time. If you'll allow me some time, I'm planning to release it this weekend :cool:
     
  3. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    All - Big update here - I'm pretty sure I've fixed every bug and added every requested feature. I did a lot of testing, so hopefully the new features didn't break anything.

    Note: If you installed this plugin prior to v2.0.0, it had a different name (ALOE_MobileUI). If you download the new one (ALOE_VirtualButtons), install it and playtest before removing the old one. It will copy the plugin parameters for you automatically. The playtest will automatically open the Console with further information and instructions.

    v2.0.0 (May 4 2019)
    • Clears input state on transfer to mitigate stuck DPad input bug
    • Improves clearing of input state each frame to mitigate bug
    • Fix bug where the DPad would not clear the direction after a parallel event checking for a input direction triggered a Show Choices event command
    • Buttons hidden via plugin command will stay hidden until the show plugin command
    • Key buttons can trigger common events
    • Option to use a "hot" image that shows when the button is pressed
    • Delay parameter to fade-in
    • Plugin command option to show all buttons
    • Plugin command option to hide all buttons
    • Plugin command to change button opacity
    • Add plugin parameter to toggle whether the buttons are hidden during dialogue
     
    Eliaquim likes this.
  4. jkweath

    jkweath Goes Fast Veteran

    Messages:
    196
    Likes Received:
    159
    First Language:
    English
    Primarily Uses:
    N/A
    @Aloe Guvner Woo, the update! Love all the new added features.

    I'm having another problem now involving the DPad. Key buttons and DPad Map movement work perfectly as intended (and I'm pretty sure the stuck input state thing is fixed now), but in any menu scene, i'm only able to press (or hold) a DPad direction once before pressing that direction permanently stops working for menu scenes.

    If it helps, I just tried testing this in a blank testing project and had the same result. I tested it once by copying my settings over from the older MobileUI plugin and once by starting from blank settings and also had the same result.

    Edit: For clarity, all keyboard controls still work, but DPad directional input (whether by clicking with the mouse or touch-screen control, I tested both) stops working in menus after the first press of a direction.
     
    Last edited: May 5, 2019
  5. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    That's really interesting, I remember testing the menus as well and didn't notice anything like that. Although there could've been certain settings that I didn't test.

    Unfortunately, I'm out of town for work for the week so I won't be able to look at it until the weekend.
     
  6. jkweath

    jkweath Goes Fast Veteran

    Messages:
    196
    Likes Received:
    159
    First Language:
    English
    Primarily Uses:
    N/A
    I *think* I figured out what's causing it (take what I say with a grain of salt because EVERYTHING I know about javascript is about fiddling with code until I get it to work somehow - in other words I have no idea what I'm talking about)

    It seems like defining _lastInput as an array and then pushing movements to that array somehow caused the issue I described. I only assume this because I basically replaced the DirectionalPad code from your new version with the code from your older version which solved the problem.

    However, this causes the "stuck map movement" bug to re-appear. I managed to fix this by adding the clearDpadInput function you added into the game's performTransfer function (instead of adding it to Game_Map.prototype.setup) like so:


    Code:
    Game_Player.prototype.performTransfer = function() {
        if (this.isTransferring()) {
            this.setDirection(this._newDirection);
            if (this._newMapId !== $gameMap.mapId() || this._needsMapReload) {
                $gameMap.setup(this._newMapId);
                this._needsMapReload = false;
            }
            this.locate(this._newX, this._newY);
            this.refresh();
            this.clearTransferInfo();
            ALOE.clearDpadInput();
        }
    };

    Not 100% sure this works yet but I've been testing it and haven't had the bug happen so far.
    I hope this helps!
     
    Aloe Guvner likes this.
  7. farhannfdl

    farhannfdl student Member

    Messages:
    1
    Likes Received:
    0
    Location:
    Indonesian
    First Language:
    Indonesian
    Primarily Uses:
    RMMV
    @Aloe Guvner excuse me. I just use rmmv now, and Im still blind. can you give me a demo to your plugin (this) ? because I so much interested with it but I don't know how to use it. I've tried this. I use RMMV 1.4.0
    upload_2019-5-7_4-33-28.png
    upload_2019-5-7_4-34-15.png
    upload_2019-5-7_4-34-36.png
    I use yanfly picture common for calling scene_menu and when the menu open I wanna use your plugin to select menu, back, etc. thanks before. I hope you replied it :)
     

    Attached Files:

  8. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
  9. jigida70

    jigida70 Villager Member

    Messages:
    11
    Likes Received:
    1
    First Language:
    English
    I am using this plugin with Mog's Chrono Engine, and everything seems to work just fine. Except, that I cannot figure out how to get a menu button on the Item subscreen. When I test it on touchscreen, I am unable to back out of the screen. What scene_ should I be using to put a button on a subscreen? Can I have a button that appears on every screen?
     
  10. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Normally, Scene_Item. But if Mog has changed what scene the items are in, then I'm not sure. You'd have to ask someone familiar with that plugin or look through the plugin to see if Mog named the scene something else.

    That could be a good idea, added a Feature Request.
     
    jigida70 likes this.
  11. jigida70

    jigida70 Villager Member

    Messages:
    11
    Likes Received:
    1
    First Language:
    English
    Thank you.

    I did figure it out.
    upload_2019-5-13_18-3-22.png

    ScreenshotVirtualButtons.jpg


    I just have one more issue. If I try to push a directional button and a key button at the same time, it goes to the menu (because double touch goes to menu). Is there a work around on this?
     

    Attached Files:

    Last edited: May 14, 2019
  12. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Released patch version 2.0.1:
    • Fix bug with DPad movement in menus

    Per @jkweath 's suggestions, added and tested those fixes, and it works now. I can only guess that because by tracking the DPad directions in an array, there was an issue with a 'pass by reference' somewhere. Using a string instead works, so I don't really feel like identifying the true root cause.

    This is due to how MV was coded to handle input, as you noticed, double-touch does the same thing as pressing 'esc' or right-click. You can look at the "TouchInput._onTouchStart" function inside rpg_core.js to see how it calls _onCancel when there is more than 1 touch.

    This plugin won't change the internals of how MV handles touch input, the purpose of this plugin is to create buttons that can be touched. Some additional explanation here.
     
  13. TenTranVN

    TenTranVN Veteran Veteran

    Messages:
    110
    Likes Received:
    16
    First Language:
    Vietnam
    Primarily Uses:
    RMMV
    Nice plugin and it will be better if the developer adds multi-touch functionality in the future
     
  14. calcalx

    calcalx Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    english
    Primarily Uses:
    RMMV
    Hey, I absolutely love your plugin.. its easily the cleanest one out there. All its missing is multi touch. Is this something you could do? I will be happy to donate :)
     
  15. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Regarding multi-touch, I'll say it again:

    • This plugin creates a user interface. It does not modify the core mechanics of how MV handles touch
    • If you have another plugin already that enables multi-touch, and you have a compatibility issue, you can describe that issue and I'll do my best to make it compatible
     
  16. Kest

    Kest The Ecstasy of Gold Veteran

    Messages:
    147
    Likes Received:
    24
    First Language:
    English
    Hello and thanks for the plugin! This looks like it will come in handy but I did run across a few issues, so added a feature request to your github.
     
  17. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    672
    Likes Received:
    234
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Hi! @Aloe Guvner

    Is there a way that when i use the plugin command to hide or show the buttons, they stay permanent when switching maps(I mean only the transitions between Scene_Map to Scene_Map)?

    Because when i use it to hide, and then change the map, they appear again even if i don't use the show command.
    Also, if i hide them and open the menu, then i close, they appear again in the scene_map.

    Making them appear again between Scene Transitions is ok for me, it also great!
    But, if there is a way to make that not happening only between Scene_Map to Scene_Map...

    First i though to achieve this making the plugin command permanent. For example:
    If i hide only the DPAD, it will be hide in all scenes, even different ones.

    I made a parallel event with the commands to hide in there. But if i change maps, they would still appear and desappear quickly.

    Thanks for the implementation of opacity! ^^

    [EDITT]
    I manage to change the code and acomplish what i want!
    Can forget about what i say ^^
     
    Last edited: Jun 5, 2019
  18. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,561
    Likes Received:
    978
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @Kest I see the feature request, it's a good idea. I have to think about the best way to implement it, many HUDs use "eval" for the condition every frame - using eval 60x per second is really slow so I'd like to think of a better way.
     
    Kest likes this.
  19. huangpeifeng

    huangpeifeng Warper Member

    Messages:
    3
    Likes Received:
    0
    How to display different buttons in different map ID?
     
  20. Bilalichwa

    Bilalichwa Villager Member

    Messages:
    21
    Likes Received:
    4
    First Language:
    Indonesia
    Primarily Uses:
    RMMV
    how to disable touch mode and on D-pad mode when Window_EventItem (Select item)
     

Share This Page