Amaranth's Super Simple Mouse System for Ace

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Shaz, Sep 6, 2013.

  1. Lantiz

    Lantiz Biterkid Veteran

    Messages:
    719
    Likes Received:
    1,069
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Now its my turn... is there a way to execute something when the run_path is done?

    I tried creating a Proc variable inside Game_CharacterBase, and override the update method so it would call the Proc after run_path, but didnt work at all...
     
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,939
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    When the run_path is done (for the player), if the event that was clicked on is still in reach, it will execute.


    What are you trying to do that is different from this?
     
  3. Lantiz

    Lantiz Biterkid Veteran

    Messages:
    719
    Likes Received:
    1,069
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Its not an event triggering route, I'm using the propper find_path method with coordinates.

    My goal is part of an ABS system, trying to require that the player gets closer to the enemy, in range of the skill, before casting the skill.
     
  4. astracat111

    astracat111 Astra Cat Veteran

    Messages:
    205
    Likes Received:
    112
    Location:
    New York City
    First Language:
    English
    To Shaz - 

    I was playing around with using the super simple mouse script today, and I really think that you should include this in the main topic or in the script commenting: 

    Mouse.pos[0] - Mouse x position

    Mouse.pos[1] - Mouse y position

    Mouse.trigger?[0] - Mouse left clicked once

    Mouse.trigger?[1] - Mouse right clicked once

    Mouse.pressed?[0] - Mouse left clicked and held down

    Mouse.pressed?[1] - Mouse right clicked and held down

    So that people can be encouraged to create mini-games, huds and custom content for this. 

    It took me a little while to figure that out as I'm still just learning ruby and rgss. 

    Then you can do this to add a hud button to the screen when you're running around the map scene:

    #Script for when mouse is hovered over object and clicks on the object.#You have to create an instance of @custom_sprite before using, but you get the general idea.class Scene_Mapalias update_custom_alias_goes_here_for_scene_map updatedef update update_custom_alias_goes_here_for_scene_map if ( Mouse.pos[0] > @custom_sprite.x && Mouse.pos[0] < (@custom_sprite.x + @custom_sprite.width) && Mouse.pos[1] > @custom_sprite.y && Mouse.pos[1] < (@custom_sprite.y + @custom_sprite.height) && Mouse.trigger?[0]) # Do stuff here when sprite object is clicked. endendendIf you explain this, I think more people will be inclined to try creating mini-games or huds that work with this.
     
    Last edited by a moderator: Aug 19, 2015
    cabfe likes this.
  5. Kes

    Kes Global Moderators Global Mod

    Messages:
    21,076
    Likes Received:
    10,709
    First Language:
    English
    Primarily Uses:
    RMVXA
    A small point about making mini-games that totally depend upon using the mouse - some players hate mouse and always chose the keyboard/arrows option.

    Just saying.
     
  6. astracat111

    astracat111 Astra Cat Veteran

    Messages:
    205
    Likes Received:
    112
    Location:
    New York City
    First Language:
    English
    I wouldn't disagree with you, but for those that would like to use the mouse to create a mini-game or a hud this information could be really helpful. Although I admit that, to those that have used rgss and ruby for a while, they will know how to look this information up, but to those that are kind of beginners at it it could be useful. 
     
  7. Lantiz

    Lantiz Biterkid Veteran

    Messages:
    719
    Likes Received:
    1,069
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Just to be clear, I wanted to trigger an action at the end of the path without using an event, an idea would be to add a custom Proc call when the player reach the path end (assuming success).

    BUT, a workaround of its sorts (that I didn't use, if someone cares) is to get the Mouse.grid position and create an event in runtime with a script call to do what you want with a player touch trigger, and then delete itself in the end.
     
  8. Shaz

    Shaz Veteran Veteran

    Messages:
    37,939
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    I just put the find_path into the move route of the event, and follow it by a loop that checks to see if the event's x and y position matches the destination. If it does, add a break loop; if it doesn't, add a Wait 5 frames so as not to hog the CPU and give it a chance to get there.


    The whatever needs to happen afterwards is added as event commands after the loop.
     
  9. optimum45

    optimum45 Veteran Veteran

    Messages:
    537
    Likes Received:
    65
    Location:
    Florida
    First Language:
    English
    Thank you for the wonderful mouse script.  It's become an integral part of my current work, and I was wondering if you could help me with an issue...

    [​IMG]

    The mouse seems to be mis-aligned to the south by around a half a tile.  If you could help me re-align it somehow, I would greatly appreciate it.  The only other script in the program that could possibly conflict with the mouse is the Yanfly Message System as a stand alone.  I've made very few modifications.
     
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    37,939
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Does it work properly if you disable the Yanfly script? I doubt it has much to do with it, as a message system and a menu system are two very different things.
     
  11. optimum45

    optimum45 Veteran Veteran

    Messages:
    537
    Likes Received:
    65
    Location:
    Florida
    First Language:
    English
    It didn't seem to make a difference.  I am running 640x480 format, and I suspect that has something to do with it, but other than that, I am at a loss.

    I'm to afraid to tinker with this one that deep.
     
  12. cabfe

    cabfe Cool Cat Veteran

    Messages:
    2,307
    Likes Received:
    2,405
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMVXA
    If you revert to 544x416 (just for testing), does the problem still occur?
     
  13. optimum45

    optimum45 Veteran Veteran

    Messages:
    537
    Likes Received:
    65
    Location:
    Florida
    First Language:
    English
    I just tried this and the problem still occurs on normal resolution.

    I thought I had it tracked down to an Extra Y command, but removing that did nothing either.

    Pasting it into a brand new project also yielded the same result, which was confusing.   :unsure:   The only changes in the script I made were to the iconset call numbers.  I'm not sure why it would happen.

    Edit:  I would also like to request knowledge of how to set either the Mouse Wheel to register Input.trigger Up and Down, and/or how to get it to trigger Up/Down after moving the mouse up or down a certain amount (or however).  One or both are for functionality with an event based menu system that accepts Input.trigger commands.
     
    Last edited by a moderator: Aug 23, 2015
  14. KaedeS

    KaedeS Villager Member

    Messages:
    8
    Likes Received:
    1
    First Language:
    Vietnamese
  15. cabfe

    cabfe Cool Cat Veteran

    Messages:
    2,307
    Likes Received:
    2,405
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMVXA
    The introduction to this script says "to fix the variables problem in RPG Maker VX"

    It doesn't talk about VX Ace, which this Mouse script is written for.

    Maybe this is the cause of the crash?
     
  16. Shaz

    Shaz Veteran Veteran

    Messages:
    37,939
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Yep, that's exactly it. That script is for VX, not Ace. The mouse script is for Ace. There isn't a VX version of this mouse script.


    If you're using VX, you might be able to find a mouse script from someone else. If you're using Ace, you shouldn't use that Game_Interpreter "fix" script because it'll mess up a whole lot more than the mouse system.
     
  17. sutorumie

    sutorumie I'm a whimsical girl. Veteran

    Messages:
    30
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    My apologies if this has already been asked somewhere (if so, I can't find it) but is it possible to change the default mouse icon in-game, be it with a script call or a variable?
     
  18. Shaz

    Shaz Veteran Veteran

    Messages:
    37,939
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    There is a list of icons to be used for each purpose.  You just give it a different icon index.
     
  19. sutorumie

    sutorumie I'm a whimsical girl. Veteran

    Messages:
    30
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    But the icons only change when hovering over an event. I need it to change forever. As in, the mouse icon that is always there, even when not hovering over an event (y'know, the default icon). Then I could change it at the beginning of the game based on which character the player decides to play as, just as I change the colors of the entire UI in general based on that. It'll look odd if the cursor is always blue when the player chose the character with the predominantly pink/red color scheme at the start, rather than the blue one.
     
    Last edited by a moderator: Sep 30, 2015
  20. Shaz

    Shaz Veteran Veteran

    Messages:
    37,939
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Um ...

    # Add/remove/change icon names here.  The icon name is what will be used in the# event <mouse ...> command to show a different mouse icon when hovering over# the event.  These MUST be in lower case here!ICON = {'arrow' => 386, 'talk' => 4, 'look' => 3, 'fight' => 116,        'touch' => 491, 'exit' => 121}DEFAULT_ICON = 'arrow'DEFAULT_ICON is 'arrow'

    Therefore change the icon index for 'arrow' in order to change the default icon
     
    Last edited by a moderator: Sep 30, 2015

Share This Page