Amaranth's Super Simple Mouse System for Ace

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,246
Reaction score
264
First Language
English
Primarily Uses
I question your "breaking the move route" theory - it shouldn't matter where on the map they are.

F1 is handled by the engine, not the scripts. The F1 press never makes it through to the scripts. Arrow keys are handled by the scripts. That's why the arrow keys can be intercepted, and F1 can't.
Well that would explain why I can't find the event listener classes then... they're buried in the engine code :(

As for the move routes, I can only tell you what I observed - the "why" I don't know because I haven't really dug through your script. 

I plugged it in and it 'just works'; that's a good thing. Other than those two issues, and not having a decent arrow icon to choose (I'll have to check through graphic resources here and see if someone's done one), the mouse works perfectly:

'Hold to move' would be a nice addition if you ever upgrade it. At the end of the move route from the pathfinding, check if the mouse is still pressed, if it is, call up the pathfinding again: a nice recursive loop until the player unclicks the mouse.

Edit: The 'mouse in the menu' thing is more than an minor inconvenience, when you're trying to load a save game where you have more saves than fit on the screen it's very difficult to get to the one you want. It's hard to get the mouse out of the menu since it pretty much fills the whole screen. :(

It wouldn't be so bad if the mouse in the corner didn't make the thing scroll so fast...
 
Last edited by a moderator:

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,246
Reaction score
264
First Language
English
Primarily Uses
For anyone having problems with the mouse "super scrolling" when trying to save and load a game -

here's what I did to fix it:

#==============================================================================# ** Scene_File#------------------------------------------------------------------------------# This class performs common processing for the save screen and load screen.#==============================================================================class Scene_File < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing # # Turned off the mouse to stop the hideous scrolling beeping #-------------------------------------------------------------------------- def start super $mouse.enabled=false create_help_window create_savefile_viewport create_savefile_windows init_selection end #-------------------------------------------------------------------------- # * Termination Processing # # Turn the mouse back on for the game to function #-------------------------------------------------------------------------- def terminate super @savefile_viewport.dispose @savefile_windows.each {|window| window.dispose } $mouse.enabled=true end endI added two lines: the $mouse.enabled=false whenever the load or save screen appears and the $mouse.enabled=true to turn the mouse back on as soon as the game either starts or returns to the Title page.

This means your players will have to navigate the save/load screen using the arrow keys, but since it pops open to last save anyway, I don't think that's too much of an issue. Much less than what the mouse was doing, anyway. Looking into the 'hold mouse to move' now.

Plop the script down in the usual place - I put it at the very bottom, if you have other scripts working with this class you may have to place this above them. Try it till you find a place that works ;)

Edit: What's the purpose of the 410 in the code:

unless event.nil? && y < 501 # was 410 if !event.mouse_icon.nil? || !event.mouse_text.nil? set_bitmap(event.mouse_icon, event.mouse_text) return end endMy world map is 500x500, and this causes a crash as soon as you cross the 410 'threshold'.

Also, any progress on why keyboard commands aren't overriding a mouse move command?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
Mouser, I can't reproduce your problem where a path resumes after using the keyboard. Can you check that you have the clear_path call in the force_move_route method?


410 is a leftover from the map hud, I suspect. Just remove that second test and leave the line as unless event.nil?
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,246
Reaction score
264
First Language
English
Primarily Uses
Here's what I got:

class Game_Character < Game_CharacterBase #-------------------------------------------------------------------------- # * Force Move Route #-------------------------------------------------------------------------- alias shaz_mouse_game_character_force_move_route force_move_route def force_move_route(move_route) clear_path shaz_mouse_game_character_force_move_route(move_route) endendAre you taking the code straight from pastebin?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
yep.


You don't have any other scripts that rewrite that method, do you?
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,246
Reaction score
264
First Language
English
Primarily Uses
Nope - I put it in a clean new project - single map with some grass, still happens.

Edit: want me to pack up a mini - project and send it to you?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
yeah, might be the easiest way.
 

Jomarcenter

jomarcenter-MJM
Veteran
Joined
Apr 24, 2012
Messages
1,250
Reaction score
193
First Language
ENGLISH
Primarily Uses
RMMV
er ... what fading in and out problem? First time I've heard about it. There is nothing in the mouse script that changes the mouse icon opacity - unless you've added mods.
Wait My mistake One of your script (SIMPLE SPLASH SCREENS) is the problem with that fading in and out part.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
You should probably post it in the thread for THAT script then ;)
 

Leonardo Myst

Veteran
Veteran
Joined
Mar 13, 2014
Messages
42
Reaction score
17
First Language
English
Primarily Uses
Awesome script!

Thank you ever so much for sharing it!!

I just wonder if anyone's worked out a way to use it with tall sprites, like High Fantasy?

For stationary events, I can just put the interaction event one tile above the sprite event. That way, it'll trigger on a mouse click on the upper part of the npc.

But on moving npc's, I can't figure out a way to get it to work. The player is left having to click the feet/legs.

I should probably ask this in a new thread but I figured I'd ask here first to see if someone has already figured out a work-around.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
I've already done a fix for tall sprites. I'm not putting it in yet, because there are a couple of other issues I want to resolve as well.


Hopefully I'll have an update with a number of fixes/enhancements by the end of the coming weekend :)
 

Leonardo Myst

Veteran
Veteran
Joined
Mar 13, 2014
Messages
42
Reaction score
17
First Language
English
Primarily Uses
Thanks for the quick response, Shaz!

I'll be keeping an eye out for it!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
I have posted a new version of the mouse script to pastebin.

Back up your current mouse script before applying the new one, in case you need to revert.
If you have made changes to your version of the script, you will need to reapply them.



In this new and improved version:
 

  • The mouse will react to the top part of sprites higher than 32 pixels.
     
  • You can activate an event without having to walk up to it.  Add the following comment to an event:
    <autoactivate>
    and when you click on it, it will start straight away, and the player will not walk up to it.
     
  • When player is following a path after a mouse click, if you use the arrow keys, the path will be cancelled.
     
  • In the menus, when you use the arrow keys, the position of the mouse will be ignored (no more needing to move the mouse out of the window or being forced to use the mouse for menus when in fullscreen).
     
  • Player will walk to the counter on the opposite side of a shopkeeper.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,354
Reaction score
12,856
First Language
English
Primarily Uses
RMMV
Good idea. done.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,337
Reaction score
2,505
First Language
French
Primarily Uses
RMVXA
Wonderful!

I've quickly tested the new 1.10 version with my taller sprites and so far noticed no unwanted side effects.

This feels so much more natural now not to click on people's feet anymore in order to talk to them!

Only remaining thing on my wish list is to be able to use the mouse wheel in the menus to scroll up&down. :)
 

Dark Gaia

Disgruntled Writer
Veteran
Joined
Mar 29, 2012
Messages
211
Reaction score
121
First Language
English
Primarily Uses
Hi Shaz,

I'm looking into maybe including this in the upcoming Steam release of Legionwood 2, but I've encountered a small issue. I originally intended to release the game with this system, but the issue prevented me from ultimately using the system, and I'd love to know how I can fix it, if possible.

The issue seems to be with the pathfinding. Basically, what happens is that the pathfinding overrides the Set Move Route command during cutscenes if they're triggered by an event that the player walks through. If using the keyboard, the event functions normally (ie. the player will walk into the tile with the "Touched by Player" trigger in it, the cutscene triggers and the player's movement is halted. If a Set Move Route occurs, the player is moved as expected). With the mouse system, something rather irritating occurs instead -- unless the player's path ends on the exact tile, your pathfinding system overrides the event. The event still triggers as usual, but the system still tries to complete the current path, continuing to move while the event is in progress.

Needless to say, this kind of breaks the cutscenes, as the player may be in a completely different tile when the Set Move Route command fires. Is it possible to make the pathfinding system stop functioning if the player happens to trigger an event while moving through a tile? No matter what I do to the event (even putting a "Halt Player Movement" command in), the pathfinding still takes over and won't allow the event to play until the player has stopped moving. This makes triggering events by having the player walk over a certain tile useless.

Any help would be appreciated, as I love how simple this mouse system is, this one issue aside.
 
Last edited by a moderator:

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,337
Reaction score
2,505
First Language
French
Primarily Uses
RMVXA
@Dark Gaia:

I had the same issue and solved it.

You can force the player to stop on this specific Player Touch event by adding this script call:

$game_player.clear_path

This way, both the keyboard and the mouse control will have the player stop there and the event will trigger normally.
 

Dark Gaia

Disgruntled Writer
Veteran
Joined
Mar 29, 2012
Messages
211
Reaction score
121
First Language
English
Primarily Uses
Thanks for that. I also found that adding a "Set Move Route" that makes the player Wait for 1 frame does the trick too.
 

brandos

Veteran
Veteran
Joined
May 25, 2013
Messages
147
Reaction score
31
First Language
German
Primarily Uses
I'm using this script to fix pics on maps to improve the graphics a little bit

but 1.10 seems to disable the effect.

 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

It's raining non stop since yesterday. The sound of the rain is so soothing.
I really miss the old style disney animated movies. I guess the last one was The Princess and the Frog from 2009. Now I am trying to collect every single one I can get on BD or DVD.
What I've seen from the MZ tiles looks pretty inconsistent, bleh. Every plant seems to be drawn in a different style.
Recently posted a demo of my game online. Now I have no idea what to do with myself o_O What is the reason for my existence now...
I'm feeling a lot better this week. Some of the rules in my country for isolation changed a little, so I was able to see friends in person again, which was a huge relief. Thanks everyone for giving me some sympathy last week when I was having a rough time!

Forum statistics

Threads
99,287
Messages
963,880
Members
130,899
Latest member
Densuki
Top