• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Easy mouse functionality for Essentials

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
  • Update!

    I've changed most of this script, and replaced all the old mouse checks with efficient new ones. Don't worry though, I've retained legacy support, so you won't need to re-work your existing scripts. The most notable new features are:
    • Drawing rectangles using the $mouse.createRect function
    • Inactivity timer
    • New dragging methods with $mouse.drag_object?
    • New multi-functional $mouse.click? method
    All the scripts sections and functions are annotated, so be sure to read what's in the comments.
     
    5
    Posts
    8
    Years
    • Seen Jul 9, 2016
    I have copied your sprite, and paste it into my editor sprite but it is not working.
    there is no need to add code?
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • I have copied your sprite, and paste it into my editor sprite but it is not working.
    there is no need to add code?

    How am I supposed to decypher what you're trying to tell me? I.e. I have no idea what you're talking about.
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • Link: youtube.com/watch?v=lDTYNoBYkBc&feature=youtu.be . Help!

    If you can't follow simple instructions, then there is nothing I can (or want to) do to help you. Read the opening post of the EBS thread more carefully next time.
     
    296
    Posts
    9
    Years
  • Hi, Luka! This is probably my own personal mistake, but it seems that the functions $mouse.scroll_up? and $mouse.scroll_down? not work properly. I copied the RPG.Net.dll file in the root folder and verified that the script works properly (eg, using a test with a left or right click): the script works well (except for those two functions). There is anything wrong or is a bug? Thank you!
     
    2
    Posts
    8
    Years
    • Seen Apr 26, 2016
    Hi there, this script sounds great although when copying and pasting, I'm left with a blank script. I have tried scrolling around the page but that does not seem to show the script. the game is also unchanged as the script is pretty much not there.
     
    68
    Posts
    11
    Years
    • Seen Nov 12, 2023
    Hi,

    how can I save the position of my dragged Object with "$mouse.drag_object?(object)"?

    If I close the Scene and open it again, it has the old positon.

    Code:
    #===============================================================================
    # - Scene_Pokegear
    #-------------------------------------------------------------------------------
    # Modified By Harshboy
    # Modified by Peter O.
    # Also Modified By OblivionMew
    # Overhauled by Maruno
    #===============================================================================
    ItemHandlers::UseFromBag.add(:GEAR,proc{|item|
       pbLoadRpgxpScene(Scene_Pokegear.new)
       next 1 # Continue
    })
    ItemHandlers::UseInField.add(:GEAR,proc{|item|
       pbLoadRpgxpScene(Scene_Pokegear.new)
    })
    
    class Scene_Pokegear
      #-----------------------------------------------------------------------------
      # main
      #-----------------------------------------------------------------------------
      def main
    
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites={}
        @sprites["background"] = IconSprite.new(0,0)
        femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
        if $Trainer.isFemale? && femback
          @sprites["background"].setBitmap("Graphics/Pictures/pokegearbgf")
        else
          @sprites["background"].setBitmap("Graphics/Pictures/pokegearbg")
        end
        @sprites["Map"]=IconSprite.new(20,40,@viewport)    
        @sprites["Map"].setBitmap("Graphics/Pictures/pokegearMap")
        @sprites["Journey"]=IconSprite.new(0,10,@viewport)    
        @sprites["Journey"].setBitmap("Graphics/Pictures/pokegearJourney")
         Graphics.transition
         
        loop do
          
       $mouse.drag_object?(@sprites["Map"])
       $mouse.drag_object?(@sprites["Journey"]) 
          
          Graphics.update
          Input.update
          update_command
          if $scene != self
            break
          end
        end
        Graphics.freeze
        pbDisposeSpriteHash(@sprites)
      end
      #-----------------------------------------------------------------------------
      # update the command window
      #-----------------------------------------------------------------------------
      def update_command
        if Input.trigger?(Input::B)
          pbPlayCancelSE()
          $scene = Scene_Map.new
          return
        end
        
        if $mouse.leftClick?(@sprites["Map"]) 
            pbPlayDecisionSE()
            pbShowMap(-1,false)
          end
    
        end
        
    end
     
    296
    Posts
    9
    Years
  • Hi Luka! I hope you'll read this post, because I informed you while ago and I haven't received a feedback. I found a bug in your mouse script: in particular, I noticed that the WinAPI32 WheelDelta, always returns a value of zero and then the methods of the scroll wheel (scroll_up? and scroll_down?) Do not work.

    I hope that you like someone collaborate to help you improve your portentous scripts. :)
     
    Last edited:

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • Hi Luka! I hope you'll read this post, because I informed you while ago and I haven't received a feedback. I found a bug in your mouse script: in particular, I noticed that the WinAPI32 WheelDelta, always returns a value of zero and then the methods of the scroll wheel (scroll_up? and scroll_down?) Do not work.

    I hope that you like someone collaborate to help you improve your portentous scripts. :)

    I'll just leave you with this.

    P.S. using an unmodified version of the script that's up here.
     
    296
    Posts
    9
    Years
  • I'll just leave you with this.

    P.S. using an unmodified version of the script that's up here.
    First of all I thank you for having responded to me; however, even after seeing your video (showing the correct mousewheel scrolling) i'm not able to solve the problem. I try to explain in the best way possible and give all the necessary infos.

    - I have a good knowledge of programming, since I provided various supports to some members of the forum and I scripted several features in my project;
    - I downloaded the Rpg.NET.dll file (685 KB) and I moved it to the root folder of my project (in the same place of rubyscreen.dll and RGSS102E.dll);
    - I downloaded Your original script and I added it under the modules written by Peter O. (like Mouse and Input, both needed for your script);
    - Finally, I did a little test: in Scene_Map script section, in a clean 16.2 version of Pokémon Essentials, I wrote the following code, below the section where it monitors the key F5:

    Code:
    if $mouse.leftPress?
      Kernel.pbMessage("Mouse left button works properly")
    end
    if $mouse.scroll_up?
      Kernel.pbMessage("Mouse scrolling works properly")
    end

    While in the first case the message is displayed correctly, that is when you press the left mouse button, in the second case it doesn't appear, that is when I try to scroll the mouse wheel.

    To rule out the possibility that it was a peripherals issue, I tried four different mouses, including also a touch-pad.
    Therefore my question is: where am I doing wrong?
    I hope that You may give me a little help, given your vast programming knowledge. :)
     
    Last edited:

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • Therefore my question is: where am I doing wrong?
    I hope that You may give me a little help, given your vast programming knowledge. :)

    I wouldn't call it vast programming knowledge, I'd call it "above average" programming knowledge ;)

    Anyway, seems to be the case of the RNET dll not working without the rest of the original script. I've fiddled around with it, and added a forced initialization method to the mouse. I've tested it out in Essentials, standalone without the rest of the library scripts, and it should work now. Get the new script from the OP.

    Sorry for the hassle.
     
    296
    Posts
    9
    Years
  • I wouldn't call it vast programming knowledge, I'd call it "above average" programming knowledge ;)

    Anyway, seems to be the case of the RNET dll not working without the rest of the original script. I've fiddled around with it, and added a forced initialization method to the mouse. I've tested it out in Essentials, standalone without the rest of the library scripts, and it should work now. Get the new script from the OP.

    Sorry for the hassle.
    Don't worry, man. I know there are people that torment you with stupid or off-topic questions.

    Anyways, now it works properly (except for touchpads, but I don't care) ! I thank you so much for this release!
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • Anyways, now it works properly (except for touchpads, but I don't care) ! I thank you so much for this release!

    Idk, I'm scrolling just fine with Multi-Touch gestures. I don't have the little "scroll area" on the side of my trackpad, if that's what you're referring to. So I don't have the hardware to test that out. I'm also not sure if that's something OS reliant (I'm on Win 8.1).
     
    296
    Posts
    9
    Years
  • Idk, I'm scrolling just fine with Multi-Touch gestures. I don't have the little "scroll area" on the side of my trackpad, if that's what you're referring to. So I don't have the hardware to test that out. I'm also not sure if that's something OS reliant (I'm on Win 8.1).
    I'm sure you're right, because I have a touchpad with two little scroll areas: the first one is for horizontal scroll, while the other one is for vertical scroll.

    Edit:
    I probably found another bug: if you call the method hide, by using $mouse.hide, the mouse will disappears (as it should normally happen); however, if you subsequently call the method show, by using $mouse.show, the mouse won't appear.
     
    Last edited:

    #Not Important

    All hail the wishmaker
    910
    Posts
    4
    Years
  • I made this:
    Spoiler:
    For it
    x gets mouse x
    y gets mouse y
    xString gets mouse x as a string
    yString gets mouse y as a string
    getPos gets the mouse position
    getPosString gets the mouse position as a string
     
    Last edited:
    Back
    Top