Amaranth's Super Simple Mouse System for Ace

How soon do you need it? I'll take a look if I have time and you're not in a great hurry.


(Your request should really have gone into Classifieds - Requests, or, if you weren't offering payment, into RGSS3 Script Requests).
Could you add game switch mouse disable/enable?

I'm having difficulty controlling things like the player accidentally double-clicking (and thus skipping some scripted events) and so forth.
Hey Shaz, in regards to the following change in the changelog:

Now works with YEA Core Engine where the map is smaller than the screen size and is centered in the window; you should not see any differences if you are not using YEA's core script
I'm using an older version (one where the script is still is still in separate parts) and due to having made some modifications, it'd be simpler for me not to update the script and redo them. I was wondering if you could direct me to functions edited to fix the above. It would be much appreciated, thanks.
Could you add game switch mouse disable/enable?

I'm having difficulty controlling things like the player accidentally double-clicking (and thus skipping some scripted events) and so forth.
Sure. Go to the Sprite_Mouse.update method, and add this as the very first line:

enabled = $game_switches[id]where id is your switch id. Turn it on to enable the mouse, off to disable it. I haven't tested this, so let me know if you have issues. The problem with this is that each saved game or new game could/will have its own settings, but the mouse is global. So if you are loading different saved games or starting a new game, you could find the mouse turning on or off without you actually telling it what to do (because it's looking at the setting in the save file).
Hey Shaz, in regards to the following change in the changelog:

I'm using an older version (one where the script is still is still in separate parts) and due to having made some modifications, it'd be simpler for me not to update the script and redo them. I was wondering if you could direct me to functions edited to fix the above. It would be much appreciated, thanks.
Yep. The method you want to replace is Spriteset_Map.tilemap_offset (in the Mouse - Map script). Replace what you have there, with this:

Code:
class Spriteset_Map  #--------------------------------------------------------------------------  # * Tilemap Offset  #--------------------------------------------------------------------------  def tilemap_offset    if $imported && $imported["YEA-CoreEngine"]      [@tilemap.ox - @viewport1.rect.x, @tilemap.oy - @viewport1.rect.y]    else      [@tilemap.ox, @tilemap.oy]    end  endend
Go to the Sprite_Mouse.update method, and add this as the very first line: (snip)
Results in line 115 (the new line) NoMethodError (undefined method '[]' for nil:NilClass).

Tried it with $Game_Switches[] as well.
Of course, because the first time you launch your game, $game_switches doesn't exist.


Change it to this:

Code:
enabled = $game_switches[id] if $game_switches
This (line 262):    mx, my = SceneManager.scene.instance_variable_get🙂@spriteset).tilemap_offset

crashes with a NoMethodError when pressing any key while using Tsukihime's splash screen map (which runs before the title screen, which is also a map (via Acezon's map as title screen script)).

Is there any way to block it from either receiving that key event or at the least ignoring it while disabled?

Edit: Also, if I set it to enabled = true in the init and enabled = $game_switches[id] if $game_switches in the frame update -- it never actually respects the game_switch state.  I can turn it off and it'll happily keep running.
I love this script, but the mouse icon is showing about a square or two to the left of my events. How can I adjust it so it centers? I have many, many scripts in my game, including a mod to make the game window bigger and I think that’s why it’s doing this. I’m trying to make a sort of old style King’s Quest like game. Can you help with just getting that mouse icon to center when an event is clicked on?

Scripts that are probably affecting this:

I'm using Yanfly's Screen Resolution Mod

Full Screen Mod by Zeus81

Tidloc Message Windows

I have the mouse script above all the other game scripts.  My game window is about 600 x 800, I think.  It's pretty big. 
I don't provide support for issues that occur because of other scripts. Can you both please start new threads in RGSSx Script Support with your requests, and provide links to this thread AND to other scripts you're using?


I will LOOK at them, but I won't promise to spend much time trying to resolve them.


@Firgof, I will take a quick look at the switch/enable issue when I get some time.
I think I've found a bug >_>

I had a cutscene (set with Autorun) which worked perfectly fine. Either the keyboard or the mouse didn't allow the player to move.

But then, I added a Call Common Event at the beginning of my scene.

Now, the keyboard still doesn't allow movement, but when I use the mouse, the player moves.

I removed the Call Common Event line and it reverted back to normal.

It seems to be the case with any Common event. At least I tried with another one completely different with the same result.

Actually I tried with a minimal setting. An event that does a screen shake in Autorun (so I can see it's working). Whenever I add a Call Common Event at the beginning (a simple one, only played a SE) the mouse allowed movement. If I add the Play SE line directly in the Autorun instead of calling a Common event, it works.

I guess this should be easy to replicate, at least.
Thanks - I'll take a look at that.
I made it better adjusting the mouse position code lines and ranges, but it's so odd.  It seems to be very map dependent.  Like I can make it perfect on one map, then go to the next and it will be over too much on that map by a bit.  Not sure if it's anything to do with how the events are set, like by touch or action, or if it's how big the map is.  But it's definitely odd.  It might also be dependent on the facing of the event.  Like if you are supposed to be facing the event left, right, or whatever.  Anyway, I think what I did is workable for my game.  It looks better.   
It's not map dependent at all (well - there are issues if you have your map set to scroll in either or both directions). And it's not dependent on the events. Did you start a new thread and provide links to the scripts you're using? I can't even look at it if you don't. I won't provide compatibility assistance in this thread.
My maps do scroll, I think.  I'll have to look at that. 

Didn't start a new thread yet, because I'm not sure I need to.  I might end up leaving it as is since the game can be played with both keyboard and mouse.  But the mouse icon is at least a square off on some of the maps.  It's just odd.  My starting map, it's fine.  Every map after, it's off by a square.  The starting map is smaller than the other maps.  I do have a video up of the levels and it does show how I was struggling with the mouse, if you just want to see what's happening with it.
I could be wrong, but perhaps you have the same problem I had. 

I am using a script which changes the default screen resolution to 640 x 416, which means that each map has to be 21 tiles wide and 13 tiles high - even if the whole thing isn't filled, which it might not be for some.

I still had some maps at the default 17 x 13, and I had the same problem of the mouse being out by one tile.  See this thread http://forums.rpgmakerweb.com/index.php?/topic/19199-pathfinding-problem-with-shaz-mouse-system/

The solution was to re-size the maps and, if necessary, live with the fact that the map was smaller than the screen.  It wasn't an issue, because a lot of my interior maps are smaller than the screen anyway.
ksjp17, your problem was because you were using YEA and it MOVED smaller maps so they were centered in the screen. Since you resolved your problem by resizing the maps, at least one other person had the same issue, and I discovered it wasn't a big change to cater for this one script. So the latest version will handle maps that are smaller than the screen and resized because of Yanfly's script.


IF Carri hasn't downloaded the latest version yet, she should - that MAY solve the problems on maps that don't scroll. There are still issues on maps set to scroll in either direction or both, which I haven't resolved yet.
Yes, I have YEA code in my game, but it's the Screen Resolution mod by Esrever, Viewports/Map Fix for the modified dll.  I have the modded dll in my game.  It was to make my screen 800 x 600.  Esrever's script is based on the older version of YEA.   

I already have the latest version of the mouse script.  I did move it over by one and I made it better than in my video, but the range is going over into nearby events.  If I have events that are close to it, it makes it hard to find them.  I have a journal on a table and then letters next to that.  Both are clickable events, but I found trying to find both with the mouse was a bit hard.  And the same thing happened on another map where two events were kind of close.

I do notice that the size of the maps definitely matters.  I have all different sized maps, some of them the mouse icon will be better, others, it goes out of the area again.  The small adjustment I made fixed the placement of the mouse icon on the first two maps.  Get to the third map, it's one over again. 
If you start a new thread and link to the scripts, I MAY have time to take a look at it for you.
Okay.  I have an insane amount of scripts in my game.  I had to hack it like crazy just to get it to where it's at now.  I'll do the separate post and list what I've got.

New thread is here:

http://forums.rpgmakerweb.com/index.php?/topic/20785-problems-with-shaz-mouse-system-and-larger-screens/
I tried another test with the Common Event bug :

If I put the Calls in a parallel event and start them with a switch inside my autorun, I can have both the Common Event and the mouse moves blocked.

So it is really when the Call Common Event is set inside the Autorun that it breaks it.

At least, there is a workaround.

Original thread: https://forums.rpgmakerweb.com/threads/amaranths-super-simple-mouse-system-for-ace.17829/