Jump to content
Vlue

Basic Mouse System + Addons

Recommended Posts

Basic Mouse System + Addons v2.0
By V.M.

Introduction
Adds mouse functionality! Wheeee

Rewritten to actually make sense, thank you Tsuki~

Features
- What it says above!

How to Use
Plug and play!

Script
Convenient Pastebin: Here

FAQ
None yet (There most likely will be)

Credit and Thanks
- By V.M. of D.T
- Free to use in any non-commercial or commercial game with credit given
- Thanks to the well documented MSDN for the Win32API calls x.x

Author's Notes
Huff.. de luff...

Edited by Vlue

Share this post


Link to post
Share on other sites

Figure I might as well update this on this site. Final update for a bit, with all addons this script provide basic mouse functionality to every aspect of the game. Might not work with edited scenes, might work with edited scenes. You'll have to find out! With unedited scripts though, works. Probably a few bugs lurking around there, we shall find out. Enjoy.

Share this post


Link to post
Share on other sites

Excellent script Vlue!

At the moment, I'll stick with Jet Mouse System until you are able to make your script compatible with Yanfly's Battle Engine.

Share this post


Link to post
Share on other sites

For the scenes and stuff couldn't you just modify Window_Selectable class to provide basic mouse handling and tracking? Any sort of actual input from the user occurs within that class and any class that inherits from it.

 

Then we can just choose to enable or disable mouse tracking with a flag or something.

 

For the most part, if I left-click on an item, the intuitive behavior is that I am clicking OK, so by default if all windows have the left mouse-click mapped to trigger the OK handler then it should be fine.

 

A good place to put that is to alias Window_Selectable's process_handler method and the cursor update and just add the mouse OK there.

 

class Window_Selectable < Window_Base

 def process_handling
   return unless open? && active
   return process_ok       if ok_enabled?        && (Input.trigger?(:C) || Mouse.lclick?)
   return process_cancel   if cancel_enabled?    && (Input.trigger?(: || Mouse.rclick?)
   return process_pagedown if handle?(:pagedown) && Input.trigger?(:R)
   return process_pageup   if handle?(:pageup)   && Input.trigger?(:L)
 end
end

 

Then for the window cursor (eg: current index) it would move up/down/left/right based on the mouse's position, somehow.

 

I would probably even go as far as to straight-out map Input::C to left-mouse in order to take care of all of the Input.trigger?(:C) conditions.

 

That basically gives you free compatibility with every script out there that doesn't overwrite basic input and is a very simple implementation.

 

It's the window's job to figure out where to go based on where your mouse is, not your job as the developer to tell the window how to move.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Hello. The Jet Mouse System has the same problem as this one, which is that the cursor is drawn about one tile to the left from which it actually stays or clicks. Why is that?

Share this post


Link to post
Share on other sites

Hmm, shouldn't be drawn too far left, I'll look into it.

 

Stack too deep. Make sure there is only one copy each of the script/addons.

Share this post


Link to post
Share on other sites

Rewrote this script in a manner that makes tons more sense. Which cut it down by 700 lines and should work alongside other scripts provided they stick to using the Window classes that are built in. Other then that, there isn't too big a difference from the previous version. We'll find out if anything isn't working though, you all are usually quite up on that! :3

Share this post


Link to post
Share on other sites

i create my window using window_command as superclass. but the process_cancel cannot 'trigger' at all.

 

also some suggestion. mouse click comment tag to activate event function would be useful.

 

this script advantage than new jet mouse script is this script... don't use pathfinding (only direct move_straight) which better in my point of view. since new jet mouse script will have 'some' lag when clicking on 'unpassable' coordinate (in low spec computer/laptop at least). also his mouse script will have issues with returning to title then load the game again while direct move_straight didn't have that issues.

Share this post


Link to post
Share on other sites

Non-commercial only? I know others of your scripts have said this, but you've said it was fine for commercial use.

Share this post


Link to post
Share on other sites

i create my window using window_command as superclass. but the process_cancel cannot 'trigger' at all.

 

also some suggestion. mouse click comment tag to activate event function would be useful.

 

this script advantage than new jet mouse script is this script... don't use pathfinding (only direct move_straight) which better in my point of view. since new jet mouse script will have 'some' lag when clicking on 'unpassable' coordinate (in low spec computer/laptop at least). also his mouse script will have issues with returning to title then load the game again while direct move_straight didn't have that issues.

Is it just process_cancel that doesn't work? Everything else does?

And yah, mouse click event activation from afar would be neat, I'll look into it.

Non-commercial only? I know others of your scripts have said this, but you've said it was fine for commercial use.

Basic Mouse System has always been free for non-commercial use but requiring a paid license for commercial use. If I have said different elsewhere, let me know and I will honor that, but I don't recall it.

Share this post


Link to post
Share on other sites

yes it's only process cancel that don't work. i could pm you the script (window and scene) if you want. it's my est - phone menu engine. i try to modify it to support mouse :D.

 

also if you create mouse click event activation function. aside from a far range activation... please also add option to only activate that event IF the player next to the event.

 

now we can move with mouse but cannot activate event. :D. it would be not too nice if we still need keyboard in some games. :D.

Share this post


Link to post
Share on other sites

Yah best way for me to troubleshoot it is if I could see it.

You can use the mouse to activate events when you are beside them! I guess I really didn't document that, just right click on an event that's beside you, it will activate that event instead of calling menu. I designed the script so you could play the entire game with just the mouse. To some degree.

Share this post


Link to post
Share on other sites

 

i create my window using window_command as superclass. but the process_cancel cannot 'trigger' at all.

 

also some suggestion. mouse click comment tag to activate event function would be useful.

 

this script advantage than new jet mouse script is this script... don't use pathfinding (only direct move_straight) which better in my point of view. since new jet mouse script will have 'some' lag when clicking on 'unpassable' coordinate (in low spec computer/laptop at least). also his mouse script will have issues with returning to title then load the game again while direct move_straight didn't have that issues.

Is it just process_cancel that doesn't work? Everything else does?

And yah, mouse click event activation from afar would be neat, I'll look into it.

>Non-commercial only? I know others of your scripts have said this, but you've said it was fine for commercial use.

Basic Mouse System has always been free for non-commercial use but requiring a paid license for commercial use. If I have said different elsewhere, let me know and I will honor that, but I don't recall it.

 

I was talking about the button input thingy. Where you could use any key on the keyboard to toggle a switch. You said on the post that it was non-commercial, and in the script it said it was for commercial use. I just wanted to verify.

Share this post


Link to post
Share on other sites

@vlue: apparently the script doesn't recognize if we don't set the :cancel handler. jet mouse script can work maybe because he alias the Input module.

which make the Input recognize 'left click' same as 'INPUT::C' and 'right click' as 'INPUT::B'. and by pressing 'INPUT::B' it will call process cancel if no changes made in the class.

it's this part

 

 

 

 class << Input
 
   alias jet5888_press? press?
   def press?(arg)
     if arg == Input::C
       return true if Mouse.press?(1)
     elsif arg == Input::B
       return true if Mouse.press?(2)
     end
     jet5888_press?(arg)
   end
   
   alias jet5888_repeat? repeat?
   def repeat?(arg)
     if arg == Input::C
       return true if Mouse.click?(1)
     elsif arg == Input::B
       return true if Mouse.click?(2)
     end
     jet5888_repeat?(arg)
   end
   
   alias jet5888_trigger? trigger?
   def trigger?(arg)
     if arg == Input::C
       return true if Mouse.click?(1)
     elsif arg == Input::B
       return true if Mouse.click?(2)
     end
     jet5888_trigger?(arg)
   end
end

 

 

 

btw i have modified my script to include :cancel handler for every window (added it in the superclass if the window didn't have handler it will automatically add the ok and cancel handler). and now it working. so i guess it's my side that at fault.

 

ps: for everyone that have same problem. make sure you have both :ok and :cancel handler for every window you have.

Edited by estriole

Share this post


Link to post
Share on other sites

Updatde the pastebin so you can set up come basic clickable icons on an an overlay, using image files stored in system~

Share this post


Link to post
Share on other sites

There are no plans for it. Aside from the fact I don't quite know how to handle WM_TOUCH messages in Ruby, I don't have an available touch screen to even test if it's working.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted