Mouse System Ex

Discussion in 'JS Plugin Releases (RMMV)' started by Galenmereth, Oct 24, 2015.

    Tags:
  1. Krimer

    Krimer Veteran Veteran

    Messages:
    135
    Likes Received:
    101
    Location:
    Kiev, Ukraine
    First Language:
    Ukrainian
    Great plugin! Thanks!

    Is it possible to add something like event Drag & Drop function?
     
    #21
  2. willoneill

    willoneill Veteran Veteran

    Messages:
    53
    Likes Received:
    12
    Location:
    Toronto
    First Language:
    English
    Primarily Uses:
    N/A
    Hi Galenmereth,

    Great plugin! I'm having trouble, though. I'm trying to use your plugin to make a GUI of sorts, basically putting button sprites on the screen outside of the player-movable area, and using 'click_activate!' so that when players click on that button, the event there is triggered.

    However, it doesn't seem to work. When I click on it, not only does the event not trigger, but it just makes the player attempt to move to it even though they can't. Basically, it seems to be conflicting with the fact that left-clicking is also for player movement.

    Any idea what I'm doing wrong?! 

    Thanks in advance. :)
     
    #22
  3. Dallas Robinson

    Dallas Robinson Villager Member

    Messages:
    45
    Likes Received:
    1
    First Language:
    English
    Hello, i just got your plug-in working ad it's great! I do have a question though. Is there an option for 'display this text on mouse hover'? So say I have an event that uses a button graphic and when you click it it it activates something. I'm trying to get it that when you hover your mouse over the button live text displays over the event saying " wanna push the button?"

    I'm i looking in the wrong place or is that not in this plug-in?
     
    #23
  4. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    While it is possible, I think the mechanics involved would be so complex that it would be better to make a custom scene / window system for this instead. It'd be a bit too much like forcing a square peg down a round hole :)

    It should activate the event without the player moving to it, although if the event moves or you misclick it, the character might still move. Are you using the latest version of the plugin and the correct notetags? :)

    Showing text when hovering is not in the plugin at the moment, but it's something I've been considering adding as an addon to it.
     
    #24
  5. willoneill

    willoneill Veteran Veteran

    Messages:
    53
    Likes Received:
    12
    Location:
    Toronto
    First Language:
    English
    Primarily Uses:
    N/A
    Hey Glenmereth,

    Good news! I figured out what my problem was. I don't think many people will run into it, but it highlights an interesting(?) issue in MV, so I'll explain.

    Basically, I d/l'd the latest version of your plugin from the raw Pastebin in Safari on Mac. For whatever reason, Safari saved it as a 'webarchive' file, and though I immediately changed the extension to .js and thought that would be the end of it, it wasn't.

    Basically, saving it as a 'webarchive' must have invalidated it as a .js file somehow, but this is the interesting part: Although the script was now not functional at all, it still showed up in my RPGM MV plugin list as being there. I could turn it on and off, change parameters, etc. even though it wasn't actually working or doing anything at all. So it seems like RPGM MV just indexes whatever is in the folder, it doesn't do anything to see if the plugin is actually broken or not.

    And for anyone who thinks they might be having a similar problem, I knew that I had installed it correctly (by re-downloading and *not* saving as a webarchive and renaming) because upon startup the plugin will automatically create a subdirectory for custom cursors and prompt you about it. Soon as that happened, I knew that my previous installation hadn't been a real working installation at all. :)

    Thanks again for a great plugin!
     
    #25
    Galenmereth likes this.
  6. Khaldriel

    Khaldriel A Last Guardian Veteran

    Messages:
    36
    Likes Received:
    7
    First Language:
    English
    Another excellent plugin.

    I was wondering if an offset option could be added for the mouse cursors.
    Looking at this example:
    [​IMG]
    The red point is where the "clicking" is detected right now, but if we wanted to use this type of cursors (for minigames and other things), it doesn't work well as the clicking should be where the green point is (the center).
    Could it be possible to change the "clicking point" with an offset or something similar?

    Thanks for making all these awesome plugins!
     
    #26
  7. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    @Khaldriel: Ah, that is indeed a very useful feature. Lo and behold:
     
     
    Updated to version 1.7.0
     

    Changes:

     
    #27
    Luiiferu and Khaldriel like this.
  8. Khaldriel

    Khaldriel A Last Guardian Veteran

    Messages:
    36
    Likes Received:
    7
    First Language:
    English
    And.... you're awesome! 

    This plugin adds a lot of utility for making UIs, minigames or entire systems based on mouse interaction, which is really good now that MV supports it natively, making this plugin a must for everyone.

    I sent you an email to your contact email a few days ago with some suggestions for this system, I don't know if you received, but basically it was about having some more Mouse Event Activation methods (RMB and holding LMB/RMB). Just throwing it out there in case you want to expand it even more. 

    Thanks a lot for all the work you're putting on all your plugins, it is really appreciated.
     
    #28
    Galenmereth likes this.
  9. willoneill

    willoneill Veteran Veteran

    Messages:
    53
    Likes Received:
    12
    Location:
    Toronto
    First Language:
    English
    Primarily Uses:
    N/A
    Just want to say how much I agree with this. The real implications of this plugin for making things that go way beyond traditional RPGs in RPGM are staggering, and I hope that you do continue to expand its functionality of it along these lines (More options for hovering, RMB functions, etc.) as well.

    It's really great work.
     
    #29
    Khaldriel likes this.
  10. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    Thank you very much, both of you :) Yeah I do plan on expanding on it so don't worry about that. I did get your email the other day @Khaldriel, I just haven't gotten around to answering. But I've taken note and I'm going to experiment to see how best to implement more functionality like that.
     
    #30
    Khaldriel likes this.
  11. Khaldriel

    Khaldriel A Last Guardian Veteran

    Messages:
    36
    Likes Received:
    7
    First Language:
    English
    That's awesome to hear. 

    I'm here again to report a bug. Well, I think it's a bug.

    When using a custom cursor and playing on a window, if you take the cursor out of the window and then go back inside of it, the custom cursor it's not shown, instead the windows arrow takes its place (going to fullscreen with F4 and then going to window mode again solves it, until you again take the cursor out of the window).

    I think it's a bug but in any event I thought I should post it here just in case I'm doing something wrong.

     
     
    #31
  12. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    That is actually a bug with nwjs, the self-contained browser and server executable MV runs on locally. What you'll notice is that if you rescale the window a bit larger, at some point it works as intended. And like you saw, in fullscreen it's also working.

    The technical details of the bug is that nwjs doesn't fire some of the window events (mouse leave and re-entry) at certain window sizes due to the documents "chrome" being scaled wrong internally. There's an official outstanding bug report on it which so far remains untouched.

    I'll keep digging to see if there's anything I can do about it though :)
     
    #32
    Khaldriel and Luiiferu like this.
  13. Khaldriel

    Khaldriel A Last Guardian Veteran

    Messages:
    36
    Likes Received:
    7
    First Language:
    English
    Yeah, I was sure it was a bug but I didn't know if it was your plugin or not.

    Another little thing I've noticed it's that when you go fullscreen, the cursors remain at the same size while everything else scales up. This looks weird (as the cursor looks sharp while the rest gets a little blurry) and it could cause issues with minigames or systems that rely on visual indicators such as cursors.
    Is there a way to make it so that we can specify how much to scale it up when the game it's being played at fullscreen? Or maybe to have 2 images of each cursor, one for windowed mode (normal size) and one for the fullscreen (scaled up by ourselves directly on the image)?

    Anyway, you're doing an awesome work with MV. Thanks again, really.
     
     
    #33
  14. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    Yeah I've been seeing this too and it's been annoying me in the normal MV resolution when scaled up to near-double. I'm afraid there's no way to automatically resize the cursors on the fly, but I could make it use scaled versions if available when the game screen is scaled up in fullscreen. I might actually even be able to dynamically create these double scaled images for you. I'll look into it :)
     
    #34
    Khaldriel likes this.
  15. Khaldriel

    Khaldriel A Last Guardian Veteran

    Messages:
    36
    Likes Received:
    7
    First Language:
    English
    I think the easiest solution would be to have 2 images for each cursor, something like: "cursor_x2_y2_wm" and "cursor_x2_y2_fsm", so when we go from window to fullscreen it automatically switches to the one with the "_fsm" at the end.

    Mainly because you don't know which resolution they're using (the scaling isn't always the same, sometimes things get scaled a lot more depending on the resolution they're using), and even if you knew the starting resolution and how much to scale, it's more work for you to do that I think than just doing the switching method.
    With that the user would know exactly how much to scale the second image to fit the rest of the scaling.

    But yeah, you're the one that knows these things better so I know you'll make it work in an awesome and simple way.

    Aside from that litle detail, the rest is working perfectly well.
     
    #35
  16. Bernkastel

    Bernkastel Veteran Veteran

    Messages:
    75
    Likes Received:
    15
    First Language:
    English
    Just tested out and it works great! Is there a way to make it so I can switch between item catagories without going back? like, between weapon, armor and items without pushing esc or right click first?
     
    #36
  17. Emje-noeg

    Emje-noeg :v Veteran

    Messages:
    31
    Likes Received:
    4
    Location:
    Demak, Indonesia
    First Language:
    Indonesia
    So may I suggest that you can show  texts (not predetermined from plugin config) when you hover an event?

    The plugin give anything I'm hope for, except this one :D
     
    #37
  18. Radis3D

    Radis3D Just a Devilz Veteran

    Messages:
    172
    Likes Received:
    33
    Location:
    Surabaya, East Java, Indonesia
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    thank you for the nice plugin..

    will it support loop animated cursor?

    ex: 1 file (say it cursor_talk) with 3 frame.. :3
     
    #38
  19. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    That is sadly a bit out of scope for this plugin as that functionality is down to the internals of how the default inventory scene and windows work. However this is something I might do as a separate plugin sometime, as I think that'd be a much more pleasant mouse and touch experience for players.

    I'm looking into making an addon plugin for this effect. I don't have an ETA on it yet, as there's so much on my plate at the moment.

    I'm looking into this. The custom cursors uses CSS to change the cursor into the images, to make it have as close to zero input lag as possible. Animated .gif images are not supported reliably, but there might be something I could do with multiple images / an image strip. I have it on my list, and I'll keep you updated.
     
    #39
    RyanBram and Radis3D like this.
  20. estriole

    estriole Veteran Veteran

    Messages:
    1,030
    Likes Received:
    334
    First Language:
    indonesian
    can i request something... first of all... here's the code :

    TouchInput._checkForEventUnderMouse

        /**    * Perform check for event under mouse and perform functions depending on parsed notetag properties    */    TouchInput._checkForEventUnderMouse = function(pageX, pageY) {        this._curEventPageX = pageX;        this._curEventPageY = pageY;        if (TDDP_MouseSystemEx.conditionsValidForMouseHoverCheck()) {            var x = $gameMap.canvasToMapX(Graphics.pageToCanvasX(pageX));            var y = $gameMap.canvasToMapY(Graphics.pageToCanvasY(pageY));            var _events = $gameMap.eventsXy(x, y);            if (_events.length > 0) {                var game_event = _events[_events.length - 1]; // Get topmost event                if (game_event.TDDP_MS.hoverIcon) {                    TouchInput._updateCursorIcon(game_event.TDDP_MS.hoverIcon);                    if (TDDP_MouseSystemEx.hideCursor) TDDP_MouseSystemEx._hideMouseCursor();                } else {                    TouchInput._hideCursorIcon();                };                if (game_event.TDDP_MS.hoverActivate && !$gameMessage.isBusy()) {                    game_event.start();                };                if (game_event.TDDP_MS.hideCursor) {                    TDDP_MouseSystemEx._hideMouseCursor();                };                if (game_event.TDDP_MS.customOffsetX && game_event.TDDP_MS.customOffsetY) {                    TouchInput.cursorIcon.customOffsetX = game_event.TDDP_MS.customOffsetX;                    TouchInput.cursorIcon.customOffsetY = game_event.TDDP_MS.customOffsetY;                };                if (TDDP_MouseSystemEx.useCustomCursor) {                    if (game_event.TDDP_MS.customCursor) {                        TDDP_MouseSystemEx._showCustomCursor(game_event.TDDP_MS.customCursor);                    } else {                        TDDP_MouseSystemEx._showCustomCursor();                    }                };                if (game_event.TDDP_MS.hoverSwitch) {                    var key = [$gameMap._mapId, game_event._eventId, game_event.TDDP_MS.hoverSwitch.key]                    $gameSelfSwitches.setValue(key, game_event.TDDP_MS.hoverSwitch.val === 'true')                };                return game_event;            }        }        TouchInput._hideCursorIcon();        TDDP_MouseSystemEx._showMouseCursor();        return false;    };
    and

    TouchInput._activateClickEvents

        TouchInput._activateClickEvents = function(x, y) {        var found_click_event = false;        if (SceneManager.isCurrentSceneStarted() && $gameMap !== null && $dataMap !== null && !$gameMessage.isBusy()) {            var x = $gameMap.canvasToMapX(x);            var y = $gameMap.canvasToMapY(y);            var _events = $gameMap.eventsXy(x, y);            if (_events.length > 0) {                var game_event = _events[_events.length - 1];                if (game_event.TDDP_MS.clickActivate) {                    game_event.start();                    found_click_event = true;                };                if (game_event.TDDP_MS.clickSwitch) {                    var key = [$gameMap._mapId, game_event._eventId, game_event.TDDP_MS.clickSwitch.key]                    $gameSelfSwitches.setValue(key, game_event.TDDP_MS.clickSwitch.val === 'true');                    found_click_event = true;                };            }        }        return found_click_event;    }
    can you replace this lines in those two functions:

     var _events = $gameMap.eventsXy(x, y);to call your own function instead calling $gameMap function

     var _events = this.getyoureventfunctionhere();inside your function then you place the

      return $gameMap.eventsXy(x, y);
    the reason is i try making a compatibility patch with my EST - EVENT SIZE AND TRIGGERS... but i don't want to alias $gameMap.eventsXy...

    since it used LOTS of time by many function and keeping track of the bug could be a disaster...

    so if you do that... i can alias that method and pass extra events that have it's extra trigger coordinate clicked / hovered by mouse.

    currently i have to overwrite the whole method... and i dislike overwriting because if some time you update the code... the compatibility patch

    could broke :D .

    btw in my overwriting i changed a little bit...:

    1) i set if there's event beneath the top most event... it's hover icon still shown...

    2) i also activate all when clicking / hovering events instead of just the top most event... reason? because when we use keyboard and talk

    to coordinate... all event there executed.

    still cannot do that on leave activate though. since it only pass 1 event >.<.

    maybe you could implement that above as an option in your script instead ? :D .

    current overwriting patch with above changed (not released) (in case you want to try it... you can download my plugin and place the patch below it)

    for reference.

    Code:
    // new method to pass event extra triggersGame_Map.prototype.check_events_trigger = function(x, y) {    var Extra_Trigger = [];  var passage_map = [];  var event_list = [];  $gameMap.events().forEach(function(ev){    Extra_Trigger = [];    passage_map = $gameSystem._est_custom_passage_map[$gameMap._mapId][ev._eventId]    if(ev.size_trigger() && passage_map != undefined && JSON.stringify(passage_map) != [])      for(sz of passage_map) Extra_Trigger.push(JSON.parse(sz));    if(JSON.stringify(ev.getExtraFixTrigger()) != [])      for(ft of ev.getExtraFixTrigger()) Extra_Trigger.push(ft);    if(JSON.stringify(ev.getExtraDynamicTrigger()) != [])      for(ft of ev.getExtraDynamicTrigger()) Extra_Trigger.push([ev.x+ft[0],ev.x+ft[1]]);    for (var trg in Extra_Trigger)      if (JSON.stringify(Extra_Trigger[trg]) == JSON.stringify([x,y])) event_list.push(ev);  });  return event_list;};if (TDDP_MouseSystemEx){    TouchInput._activateClickEvents = function(x, y) {        var found_click_event = false;        if (SceneManager.isCurrentSceneStarted() && $gameMap !== null && $dataMap !== null && !$gameMessage.isBusy()) {            var x = $gameMap.canvasToMapX(x);            var y = $gameMap.canvasToMapY(y);            var _events = $gameMap.eventsXy(x, y);            var _xtrigger = $gameMap.check_events_trigger(x,y);            _xtrigger.forEach(function(ev){              if (_events.indexOf(ev) < 0) _events.push(ev);              }); // end _xtrigger foreach            _events.forEach(function(game_event){              if (game_event.TDDP_MS.clickActivate) {              found_click_event = true;              game_event.start();              }              if (game_event.TDDP_MS.clickSwitch) {                var key = [$gameMap._mapId, game_event._eventId, game_event.TDDP_MS.clickSwitch.key]                $gameSelfSwitches.setValue(key, game_event.TDDP_MS.clickSwitch.val === 'true');                found_click_event = true;              };            }); // end _event foreach        }        return found_click_event;    };    TouchInput._checkForEventUnderMouse = function(pageX, pageY) {        this._curEventPageX = pageX;        this._curEventPageY = pageY;        if (TDDP_MouseSystemEx.conditionsValidForMouseHoverCheck()) {            var x = $gameMap.canvasToMapX(Graphics.pageToCanvasX(pageX));            var y = $gameMap.canvasToMapY(Graphics.pageToCanvasY(pageY));            var _events = $gameMap.eventsXy(x, y);            var _xtrigger = $gameMap.check_events_trigger(x,y);            _xtrigger.forEach(function(ev){              if (_events.indexOf(ev) < 0) _events.push(ev);              }); // end _xtrigger foreach            for (var i = 0; i <= _events.length-1; i++)  {                var game_event = _events[i]; // changed to iterate all events                if (game_event.TDDP_MS.hoverIcon) {                    TouchInput._updateCursorIcon(game_event.TDDP_MS.hoverIcon);                    if (TDDP_MouseSystemEx.hideCursor) TDDP_MouseSystemEx._hideMouseCursor();                } else { //changed hide cursor icon only executed at end of the loop if no prior event cursor icon                    if (!this.cursorIcon.iconIndex && (i == _events.length -1)) TouchInput._hideCursorIcon();                };                if (game_event.TDDP_MS.hoverActivate && !$gameMessage.isBusy()) {                    game_event.start();                };                if (game_event.TDDP_MS.hideCursor) {                    TDDP_MouseSystemEx._hideMouseCursor();                };                if (game_event.TDDP_MS.customOffsetX && game_event.TDDP_MS.customOffsetY) {                    TouchInput.cursorIcon.customOffsetX = game_event.TDDP_MS.customOffsetX;                    TouchInput.cursorIcon.customOffsetY = game_event.TDDP_MS.customOffsetY;                };                if (TDDP_MouseSystemEx.useCustomCursor) {                    if (game_event.TDDP_MS.customCursor) {                        TDDP_MouseSystemEx._showCustomCursor(game_event.TDDP_MS.customCursor);                    } else {                        TDDP_MouseSystemEx._showCustomCursor();                    }                };                if (game_event.TDDP_MS.hoverSwitch) {                    var key = [$gameMap._mapId, game_event._eventId, game_event.TDDP_MS.hoverSwitch.key]                    $gameSelfSwitches.setValue(key, game_event.TDDP_MS.hoverSwitch.val === 'true')                };                if (i == _events.length -1) return game_event; // returning the last event (topmost)            }        }        TouchInput._hideCursorIcon();        TDDP_MouseSystemEx._showMouseCursor();        return false;    };}// END COMPATIBILITY PATCH;
     
    #40

Share This Page