TheDrifter

Veteran
Veteran
Joined
Apr 18, 2012
Messages
121
Reaction score
7
First Language
English
Primarily Uses
Greetings,

I recognize this is kind of an odd request, but I am looking for a script that allows the mouse wheel to be used for scrolling up or down menus.

No, I am not looking for a full mouse script for clicking stuff or anything, I am already using Shaz's Super Simple Mouse Script for that.

I just need one to enable the mouse wheel to count as the L or Up button when scrolling up, and to count as the R or Down button when scrolling down.

Up or Down are preferable for browsing menus in my opinion, since L & R can skip too many items at once, but I recognize it would be weird being able to walk up or down with the mouse wheel once you're on the map (I don't think this is an issue though). Other people who might find this script useful could also want the mouse wheel to be used for dashing.

I am currently using the Full Input Keyboard script by Cidiomar R. Dias Junior, which enables me to press the mouse wheel (Mouse 3 button) to dash, the left click for Confirm and right click for Back/Cancel. However I could not figure out how to implement the mouse wheel functionality with it. I will post my version of both scripts mentioned if it can be useful.

So that's it, I just need a script that enables the mouse wheel to count as either the Up or Down, or the L & R buttons for scrolling up and down menus.

Thank you very much for your help!

SUPER SIMPLE MOUSE SCRIPT v1.10 by Shaz

#============================================================================# SUPER SIMPLE MOUSE SCRIPT# v1.10 by Shaz#----------------------------------------------------------------------------# This is a conversion of the XP Mouse script by Near Fantastica and# SephirothSpawn modified by Amaranth Games, to run under VX Ace.#----------------------------------------------------------------------------# To Install:# Copy and paste into a new slot in materials, below all other scripts#----------------------------------------------------------------------------# To Customize:# Add keyword icon index pairs to the ICON hash (below this documentation). # Each of the keywords can be used in an event comment to make the mouse# cursor change into that icon when hovering over the event.#----------------------------------------------------------------------------# To Use:# Add the following comment to an event page:# <mouse icon [x y] [name]># where icon is the keyword from the ICON hash below# x and y are the offsets to override player movement (optional)# name is the text to display next to the icon when hovering over the event (optional)## Examples:# <mouse fight># will change the cursor into the 'fight' icon when over the event# <mouse touch 0 1># will change the cursor into the 'touch' icon when over the event, and# make the player walk to the tile below the event when the mouse button is# clicked# <mouse talk Gloria># will change the cursor into the 'talk' icon and display the name Gloria# <mouse talk 0 2 Henry Smith># will change the cursor into the 'talk' icon and display the name Henry Smith,# and when the mouse button is clicked, the player will walk to the tile# two below the event (good to use for shops where there's a counter in between)## To force pathfinding on the player or an event, simply add a move route with# the player or event as the subject, with a Script command, and call# find_path(x, y) where x and y are the coordinates of the tile you want to move to# Examples:# Set Move Route (Player): Script: find_path(5, 8)# will make the player find a path to tile 5, 8# Set Move Route (This Event): Script: find_path(10, 5)# will make the event find a path to tile 10, 5## NOTE: The path will be ATTEMPTED. If there is no path TO that exact tile,# a path to an adjacent tile will be attempted. If no path is found there# either, no movement will occur.# If a route is found, the player or event will begin moving towards it. But# if their path is blocked while they are moving, movement will be cancelled.#----------------------------------------------------------------------------# Author's Notes:# This script should work with any RTP script.# I do not guarantee that it will work with ANY other script (especially anything# that overrides player or event movement, such as pixel movement scripts, or# custom window scripts).## Script OVERWRITES the following methods:# Game_Map.setup_starting_map_event# Game_Map.setup_autorun_common_event## If you have other scripts that ALIAS these methods, this mouse script should# be placed above them.#----------------------------------------------------------------------------# Terms:# Use in free and commercial games# Credit: Near Fantastica, SephirothSpawn, Amaranth Games, Shaz#----------------------------------------------------------------------------# Versions:# 1.0 - 6 Sept 2013 - initial release# 1.02 - 7 Sept 2013 - fixed crash when loading games saved prior to adding script# - fixed player gets stuck on impassable area on world map# when clicking while leaving air ship# 1.03 - 8 Sept 2013 - fixed actor moving to diagonal tile instead of adjacent# 1.04 - 10 Sept 2013 - fixed vehicle pathfinding on world map# - fixed event trigger when no path found# 1.05 - 14 Sept 2013 - tweaked accessing of tilemap offset# 1.06 - 3 Nov 2013 - disabled mouse movement when waiting for NPC move route# - fixed events not triggering after player finishes walking# 1.07 - 6 Nov 2013 - slow down mouse scrolling, and don't loop save files# 1.08 - 24 Nov 2013 - cater for YEA Core large resolution with too-small maps# - fixed early event activation bug introduced in 1.06# - replaced calc of Windows_Selectable boundaries with item_rect# - added ability to completely disable mouse# 1.09 - 21 Dec 2013 - fixed mouse re-enable when calling common events# 1.10 - 6 Apr 2014 - add interaction for top part of > 32pixel high event# - activate an event without walking up to it# (add <autoactivate> comment at top of event page)# - arrow keys override mouse movement when pathfinding# - ignore mouse in menus when using keyboard# - make player walk to counter opposite shopkeepers#============================================================================#============================================================================# SUPER SIMPLE MOUSE SCRIPT# Mouse Sprite#============================================================================ # 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 = {'sword' => 104, 'talk' => 3715, 'look' => 10982, 'fight' => 8420}DEFAULT_ICON = 'sword' class Sprite_Mouse < Sprite #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super self.z = 10100 self.ox = 4 update @dummy = Bitmap.new(32, 32) self.bitmap = Bitmap.new(32, 32) @enabled = true @ignored = false end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update return if !@enabled super if !SceneManager.scene.nil? if !Mouse.position.nil? mx, my = *Mouse.position if @cursor == DEFAULT_ICON self.x = mx unless mx.nil? else self.x = [mx, Graphics.width - self.bitmap.width].min unless mx.nil? end self.y = my unless my.nil? end if @scene != SceneManager.scene.class || Mouse.trigger? @scene = SceneManager.scene.class set_bitmap end end end #-------------------------------------------------------------------------- # * Set Bitmap #-------------------------------------------------------------------------- def set_bitmap(cursor = DEFAULT_ICON, text = nil) if @ignored cursor = DEFAULT_ICON text = nil end if @cursor != cursor || @text != text @cursor = cursor @text = text item_cursor = ICON[cursor] rect = Rect.new(item_cursor % 16 * 24, item_cursor / 16 * 24, 24, 24) if @text.nil? self.bitmap = Bitmap.new(24, 32) self.bitmap.blt(0, 0, Cache.system('Iconset'), rect) else w = @dummy.text_size(@text).width h = @dummy.font.size bitmap = Bitmap.new(26 + w, [32, h+2].max) bitmap.font.size = @dummy.font.size bitmap.font.shadow = true if self.x + 26 + w > Graphics.width bitmap.draw_text(0, 0, w, h, @text) bitmap.blt(w, 0, Cache.system('Iconset'), rect) else bitmap.blt(0, 0, Cache.system('Iconset'), rect) bitmap.draw_text(26, 0, w, h, @text) end self.bitmap = bitmap end end end #-------------------------------------------------------------------------- # * Update Event Cursors #-------------------------------------------------------------------------- def update_event_cursors # Remove mouse icon and text if we're off the grid if Mouse.grid.nil? set_bitmap return end # Set cursor and text according to event x, y = *Mouse.grid event = $game_map.lowest_mouse_event_xy(x, y) unless event.nil? && y < 410 if !event.mouse_icon.nil? || !event.mouse_text.nil? set_bitmap(event.mouse_icon, event.mouse_text) return end end # default bitmap if not over an event set_bitmap end #-------------------------------------------------------------------------- # * Enable Mouse #-------------------------------------------------------------------------- def enabled=(value) @enabled = value self.visible = value end #-------------------------------------------------------------------------- # * Mouse Enabled? #-------------------------------------------------------------------------- def enabled? @enabled end #-------------------------------------------------------------------------- # * Ignore Mouse #-------------------------------------------------------------------------- def ignored=(value) @ignored = value end #-------------------------------------------------------------------------- # * Mouse Ignored? #-------------------------------------------------------------------------- def ignored? @ignored endend $mouse = Sprite_Mouse.new #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Mouse Module#============================================================================ #==============================================================================# ** Mouse Module#------------------------------------------------------------------------------# by Near Fantastica and SephirothSpawn# adapted and converted to VX Ace by Shaz#==============================================================================module Mouse #-------------------------------------------------------------------------- # * Mouse to Input Triggers # key => Input::KeyCONSTANT (key: 0 - left, 1 - middle, 2 - right) #-------------------------------------------------------------------------- Mouse_to_Input_Triggers = {0 => Input::C, 1 => Input::B, 2 => Input::A} #-------------------------------------------------------------------------- # * API Declarations #-------------------------------------------------------------------------- GAKS = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i') GSM = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i') Cursor_Pos = Win32API.new('user32', 'GetCursorPos', 'p', 'i') Scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i') Client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i') Findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l') Readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l') ShowCursor = Win32API.new('user32', 'ShowCursor', 'i', 'l') #-------------------------------------------------------------------------- # * Module Variables #-------------------------------------------------------------------------- @triggers = [[0, 1], [0, 2], [0, 4]] @old_pos = 0 @pos_i = 0 @sys_cursor_visible = false #-------------------------------------------------------------------------- # * Mouse Grid Position #-------------------------------------------------------------------------- def self.grid return nil if @pos.nil? mx, my = SceneManager.scene.instance_variable_get:)@spriteset).tilemap_offset x = (@pos[0] + mx) / 32 y = (@pos[1] + my) / 32 return [x, y] end #-------------------------------------------------------------------------- # * Mouse Position #-------------------------------------------------------------------------- def self.position return @pos.nil? ? [0, 0] : @pos end #-------------------------------------------------------------------------- # * Mouse Global Position #-------------------------------------------------------------------------- def self.global_pos pos = [0, 0].pack('ll') return Cursor_Pos.call(pos) == 0 ? nil : pos.unpack('ll') end #-------------------------------------------------------------------------- # * Screen to Client #-------------------------------------------------------------------------- def self.screen_to_client(x=0, y=0) pos = [x, y].pack('ll') return Scr2cli.call(self.hwnd, pos) == 0 ? nil : pos.unpack('ll') end #-------------------------------------------------------------------------- # * Mouse Position #-------------------------------------------------------------------------- def self.pos gx, gy = global_pos x, y = screen_to_client(gx, gy) # Test boundaries begin if (x >= 0 && y >= 0 && x <= Graphics.width && y <= Graphics.height) return x, y else return -20, -20 end rescue return 0, 0 end end #-------------------------------------------------------------------------- # * Update Mouse Position #-------------------------------------------------------------------------- def self.update old_pos = @pos @pos = self.pos # Has mouse been moved? if old_pos != @pos Input.method = :mouse end # Which mouse to show - custom, or system? if $mouse.enabled? == @sys_cursor_visible @sys_cursor_visible = !@sys_cursor_visible ShowCursor.call(@sys_cursor_visible ? 1 : 0) end return if !$mouse.enabled? # Leaving / Entering Range? if old_pos != [-20, -20] && @pos == [-20, -20] # leaving range ShowCursor.call(1) elsif old_pos == [-20, -20] && @pos != [-20, -20] # entering range ShowCursor.call(0) end # Update Triggers for i in @triggers n = GAKS.call(i[1]) if [0, 1].include?(n) i[0] = (i[0] > 0 ? i[0] * -1 : 0) else i[0] = (i[0] > 0 ? i[0] + 1 : 1) end end end #-------------------------------------------------------------------------- # * Trigger? # id : 0:Left, 1:Right, 2:Center #-------------------------------------------------------------------------- def self.trigger?(id = 0) if pos != [-20, -20] return @triggers[id][0] == 1 end return false end #-------------------------------------------------------------------------- # * Repeat? # id : 0:Left, 1:Right, 2:Center #-------------------------------------------------------------------------- def self.repeat?(id = 0) return @triggers[id][0] > 0 && @triggers[id][0] % 5 == 1 end #-------------------------------------------------------------------------- # * Hwnd #-------------------------------------------------------------------------- def self.hwnd if @hwnd.nil? title = "\0" * 256 Readini.call('Game', 'Title', '', title, 255, '.\\Game.ini') title.delete!("\0") @hwnd = Findwindow.call('RGSS Player', title) ShowCursor.call(0) end return @hwnd end #-------------------------------------------------------------------------- # * Client Size #-------------------------------------------------------------------------- def self.client_size rect = [0, 0, 0, 0].pack('l4') Client_rect.call(self.hwnd, rect) return rect.unpack('l4')[2..3] endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Input#============================================================================ class << Input #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :method #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias :seph_mouse_input_update :update alias :seph_mouse_input_trigger? :trigger? alias :seph_mouse_input_repeat? :repeat? #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update $mouse.update Mouse.update seph_mouse_input_update # Are we using the mouse or the keyboard? @method = :keyboard if dir4 != 0 || dir8 != 0 end #-------------------------------------------------------------------------- # * Trigger? Test #-------------------------------------------------------------------------- def trigger?(constant) return true if seph_mouse_input_trigger?(constant) if $mouse.enabled? && !Mouse.pos.nil? if Mouse::Mouse_to_Input_Triggers.has_value?(constant) return true if Mouse.trigger?(Mouse::Mouse_to_Input_Triggers.index(constant)) end end return false end #-------------------------------------------------------------------------- # * Repeat? Test #-------------------------------------------------------------------------- def repeat?(constant) return true if seph_mouse_input_repeat?(constant) if $mouse.enabled? && !Mouse.pos.nil? if Mouse::Mouse_to_Input_Triggers.has_value?(constant) return true if Mouse.repeat?(Mouse::Mouse_to_Input_Triggers.index(constant)) end end return false endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Map#============================================================================ 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 class Game_Map #-------------------------------------------------------------------------- # * Detect/Set Up Starting Map Event #-------------------------------------------------------------------------- def setup_starting_map_event event = @events.values.find {|event| event.starting } event.clear_starting_flag if event @interpreter.setup(event.list, event.id, event.trigger_in?([0,1,2,3])) if event event end #-------------------------------------------------------------------------- # * Detect/Set Up Autorun Common Event #-------------------------------------------------------------------------- def setup_autorun_common_event event = $data_common_events.find do |event| event && event.autorun? && $game_switches[event.switch_id] end @interpreter.setup(event.list, 0, true) if event event end #-------------------------------------------------------------------------- # * Get ID of Lowest Mouse-enabled Event at Designated Coordinates #-------------------------------------------------------------------------- def lowest_mouse_event_xy(x, y) list = events_xy(x, y) + events_xy(x, y+1) list.sort! {|a, b| b.y - a.y} evt = nil list.each do |event| if (event.pos?(x, y) || (event.pos?(x, y+1) && event.height > 32)) && (evt.nil? || event.y > evt.y) evt = event break end end return evt endend class Scene_Map #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias shaz_mouse_scene_map_update update def update $mouse.update_event_cursors shaz_mouse_scene_map_update endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Event#============================================================================ module RPG class Event class Page #-------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------- attr_reader :mouse_icon attr_reader :mouse_text attr_reader :mouse_position attr_reader :mouse_autoactivate #-------------------------------------------------------------------- # * Build Stats #-------------------------------------------------------------------- def build_stats # Mouse icons (icon mandatory, others optional) # <mouse icon destx desty name> @mouse_icon = nil @mouse_text = nil @mouse_position = [0, 0] @mouse_autoactivate = false # look for mouse instructions list.each do |command| if [108, 408].include?(command.code) comment = command.parameters[0] case comment when /<mouse/i params = /<mouse (.*)>/i.match(comment)[1].split(' ') @mouse_icon = params.shift if params.size > 1 && params[0] =~ /\d+/ && params[1] =~ /\d+/ @mouse_position = [params.shift.to_i, params.shift.to_i] end if params.size > 0 @mouse_text = params.join(' ') end when /<autoactivate>/ @mouse_autoactivate = true end end #if end #do end #def end endend class Game_Event < Game_Character #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :mouse_icon attr_reader :mouse_text attr_reader :mouse_position attr_reader :mouse_autoactivate #-------------------------------------------------------------------------- # * Start Event #-------------------------------------------------------------------------- alias shaz_mouse_game_event_start start def start $game_player.start_event(@id) if !empty? shaz_mouse_game_event_start end #-------------------------------------------------------------------------- # * Clear Event Page Settings #-------------------------------------------------------------------------- alias shaz_mouse_game_event_clear_page_settings clear_page_settings def clear_page_settings shaz_mouse_game_event_clear_page_settings @mouse_icon = nil @mouse_text = nil @mouse_position = [0, 0] @mouse_autoactivate = false @height = 0 end #-------------------------------------------------------------------------- # * Set Up Event Page Settings #-------------------------------------------------------------------------- alias shaz_mouse_game_event_setup_page_settings setup_page_settings def setup_page_settings shaz_mouse_game_event_setup_page_settings @page.build_stats @mouse_icon = @page.mouse_icon @mouse_text = @page.mouse_text @mouse_position = @page.mouse_position @mouse_autoactivate = @page.mouse_autoactivate set_size endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Character#============================================================================ class Game_CharacterBase attr_reader :height # Height of character bitmap #-------------------------------------------------------------------------- # * Initialize Public Member Variables #-------------------------------------------------------------------------- alias shaz_mouse_game_characterbase_init_public_members init_public_members def init_public_members shaz_mouse_game_characterbase_init_public_members @height = 0 end #-------------------------------------------------------------------------- # * Change Graphics # character_name : new character graphic filename # character_index : new character graphic index #-------------------------------------------------------------------------- alias shaz_mouse_game_characterbase_set_graphic set_graphic def set_graphic(character_name, character_index) shaz_mouse_game_characterbase_set_graphic(character_name, character_index) set_size end #-------------------------------------------------------------------------- # * Set character width/height size #-------------------------------------------------------------------------- def set_size bw = Cache.character(@character_name).width bh = Cache.character(@character_name).height sign = @character_name[/^[\!\$]./] if sign && sign.include?('$') @width = bw / 3 @height = bh / 4 else @width = bw / 12 @height = bh / 8 end end #-------------------------------------------------------------------------- # * Detect Collision with Event #-------------------------------------------------------------------------- def collide_with_events?(x, y) $game_map.events_xy_nt(x, y).any? do |event| self != event && (event.normal_priority? || self.is_a?(Game_Event)) end end #-------------------------------------------------------------------------- # * Detect Collision with Vehicle #-------------------------------------------------------------------------- def collide_with_vehicles?(x, y) !self.is_a?(Game_Player) && ($game_map.boat.pos_nt?(x, y) || $game_map.ship.pos_nt?(x, y)) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias shaz_mouse_game_characterbase_update update def update run_path if @runpath shaz_mouse_game_characterbase_update end #-------------------------------------------------------------------------- # * Run Path #-------------------------------------------------------------------------- def run_path return if moving? @step = @map.nil? || @map[@x, @y].nil? ? 0 : @map[@x, @y] - 1 if @step < 1 clear_path else x, y = @x, @y dirs = [] dirs.push(6) if @map[@x+1, @y] == @step && passable?(@x, @y, 6) dirs.push(2) if @map[@x, @y+1] == @step && passable?(@x, @y, 2) dirs.push(4) if @map[@x-1, @y] == @step && passable?(@x, @y, 4) dirs.push(8) if @map[@x, @y-1] == @step && passable?(@x, @y, 8) while dirs.size > 0 dir = dirs.delete_at(rand(dirs.size)) move_straight(dir) break if x != @x || y != @y end # clear the path if we couldn't move clear_path if x == @x && y == @y end end #-------------------------------------------------------------------------- # * Find Path #-------------------------------------------------------------------------- def find_path(x, y) sx, sy = @x, @y @tx, @ty = x, y result = setup_map(sx, sy) @runpath = result[0] @map = result[1] @map[sx, sy] = result[2] if result[2] != nil end #-------------------------------------------------------------------------- # * Clear Path #-------------------------------------------------------------------------- def clear_path @map = nil @runpath = false end #-------------------------------------------------------------------------- # * Setup Map #-------------------------------------------------------------------------- def setup_map(sx, sy) map = Table.new($game_map.width, $game_map.height) update_counter = 0 map[@tx, @ty] = 1 old_positions = [[@tx, @ty]] new_positions = [] # if tile is impassable, but CAN move to adjacent tiles, use the adjacent tiles instead if (!passable?(@tx, @ty, 2) && !passable?(@tx, @ty, 4) && !passable?(@tx, @ty, 6) && !passable?(@tx, @ty, 8)) || $game_map.events_xy_nt(@tx, @ty).any? { |evt| evt.normal_priority? && evt != self } old_positions = [] # Can we move from the destination tile in any direction? if map_passable?(@tx, @ty, 2) map[@tx, @ty+1] = 1 old_positions.push([@tx, @ty+1]) end if map_passable?(@tx, @ty, 8) map[@tx, @ty-1] = 1 old_positions.push([@tx, @ty-1]) end if map_passable?(@tx, @ty, 4) map[@tx-1, @ty] = 1 old_positions.push([@tx-1, @ty]) end if map_passable?(@tx, @ty, 6) map[@tx+1, @ty] = 1 old_positions.push([@tx+1, @ty]) end # If not, can we at least move up to the destination tile? if old_positions.size == 0 if map_passable?(@tx-1,@ty,6) map[@tx-1,@ty] = 1 old_positions.push([@tx-1,@ty]) end if map_passable?(@tx+1,@ty,4) map[@tx+1,@ty] = 1 old_positions.push([@tx+1,@ty]) end if map_passable?(@tx,@ty-1,2) map[@tx,@ty-1] = 1 old_positions.push([@tx,@ty-1]) end if map_passable?(@tx,@ty+1,8) map[@tx,@ty+1] = 1 old_positions.push([@tx,@ty+1]) end end end # If there are any counters, can we move to the tile on the other side? if map_passable?(@tx-2,@ty,6) && $game_map.counter?(@tx-1,@ty) map[@tx-2,@ty] = 1 old_positions.push([@tx-2,@ty]) end if map_passable?(@tx+2,@ty,4) && $game_map.counter?(@tx+1,@ty) map[@tx+2,@ty] = 1 old_positions.push([@tx+2,@ty]) end if map_passable?(@tx,@ty-2,2) && $game_map.counter?(@tx,@ty-1) map[@tx,@ty-2] = 1 old_positions.push([@tx,@ty-2]) end if map_passable?(@tx,@ty+2,2) && $game_map.counter?(@tx,@ty+1) map[@tx,@ty+2] = 1 old_positions.push([@tx,@ty+2]) end depth = 2 depth.upto(100) { |step| break if old_positions[0].nil? @step = step loop do break if old_positions[0].nil? x, y = old_positions.shift return [true, map, @step-1] if x == sx && y == sy if map[x, y + 1] == 0 && passable?(x, y, 2) map[x, y + 1] = @step new_positions.push([x, y + 1]) end if map[x - 1, y] == 0 && passable?(x, y, 4) map[x - 1, y] = @step new_positions.push([x - 1, y]) end if map[x + 1, y] == 0 && passable?(x, y, 6) map[x + 1, y] = @step new_positions.push([x + 1, y]) end if map[x, y - 1] == 0 && passable?(x, y, 8) map[x, y - 1] = @step new_positions.push([x, y - 1]) end # Update graphics? (to reduce lag) update_counter += 1 if update_counter > 50 Graphics.update update_counter = 0 end end old_positions = new_positions new_positions = [] } return [false, nil, nil] endend 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) endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Player#============================================================================ class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Trigger Map Event # triggers : Trigger array # normal : Is priority set to [Same as Characters] ? #-------------------------------------------------------------------------- alias shaz_mouse_game_player_start_map_event start_map_event def start_map_event(x, y, triggers, normal) @started_events = [] shaz_mouse_game_player_start_map_event(x, y, triggers, normal) end #-------------------------------------------------------------------------- # * Start Event #-------------------------------------------------------------------------- def start_event(event_id) @started_events = [] if @started_events.nil? @started_events.push(event_id) end #-------------------------------------------------------------------------- # * Processing of Movement via Input from Directional Buttons #-------------------------------------------------------------------------- alias shaz_mouse_game_player_move_by_input move_by_input def move_by_input if Input.dir4 > 0 clear_path shaz_mouse_game_player_move_by_input else # Move by mouse input if !$game_message.busy? && !$game_message.visible && !@move_route_forcing && !@vehicle_getting_on && !@vehicle_getting_off && Mouse.trigger?(0) && !Mouse.grid.nil? && !$mouse.ignored? mx, my = *Mouse.grid # turn in direction if (@x - mx).abs >= (@y - my).abs set_direction(@x > mx ? 4 : 6) else set_direction(@y > my ? 8 : 2) end # find path @event = $game_map.lowest_mouse_event_xy(mx, my) if @event.nil? find_path(mx, my) elsif @event.mouse_autoactivate @event.start @started_events = [] clear_path else find_path(@event.x + @event.mouse_position[0], @event.y + @event.mouse_position[1]) end end end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias shaz_mouse_game_player_update update def update shaz_mouse_game_player_update update_pathfinding if !@event.nil? && !moving? end #-------------------------------------------------------------------------- # * Check event after pathfinding #-------------------------------------------------------------------------- def update_pathfinding if @map.nil? || @map[@x, @y] <= 1 dir = @x < @event.x ? 6 : @x > @event.x ? 4 : @y < @event.y ? 2 : @y > @event.y ? 8 : 0 # Face event and trigger it (only if not triggered by start_map_event) turn_toward_character(@event) if !@event.pos?(@x, @y) if !@started_events.include?(@event.id) && !@map.nil? && !in_airship? @event.start @started_events = [] end clear_path end end #-------------------------------------------------------------------------- # * Clear Path #-------------------------------------------------------------------------- def clear_path @event = nil super endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Interpreter#============================================================================ class Game_Interpreter #-------------------------------------------------------------------------- # * Event Setup #-------------------------------------------------------------------------- alias shaz_mouse_game_interpreter_setup setup def setup(list, event_id = 0, lock_player = false) shaz_mouse_game_interpreter_setup(list, event_id) @lock_player = lock_player end #-------------------------------------------------------------------------- # * Execute #-------------------------------------------------------------------------- alias shaz_mouse_game_interpreter_run run def run $mouse.ignored = true if @lock_player shaz_mouse_game_interpreter_run $mouse.ignored = false if @lock_player endend #============================================================================# SUPER SIMPLE MOUSE SCRIPT# Windows#============================================================================ class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias shaz_mouse_window_selectable_update update def update shaz_mouse_window_selectable_update process_mouse_handling if Input.method == :mouse end #-------------------------------------------------------------------------- # * Mouse Movement Processing #-------------------------------------------------------------------------- def process_mouse_handling return unless $mouse.enabled? && cursor_movable? # Add a delay to prevent too-fast scrolling @delay = @delay ? @delay + 1 : 0 return if @delay % 3 > 0 mx, my = *Mouse.position vx = self.viewport ? self.x - self.viewport.ox + self.viewport.rect.x : self.x vy = self.viewport ? self.y - self.viewport.oy + self.viewport.rect.y : self.y if mx.between?(vx, vx + self.width) && my.between?(vy, vy + self.height) mx -= vx mx -= padding my -= vy my -= padding my += oy for i in 0 ... item_max rect = item_rect(i) if mx.between?(rect.x, rect.x + rect.width) && my.between?(rect.y, rect.y + rect.height) last_index = @index select(i) if @index != last_index Sound.play_cursor end break end end end endend class Window_NameInput < Window_Selectable #-------------------------------------------------------------------------- # * Mouse Movement Processing #-------------------------------------------------------------------------- def process_mouse_handling return unless $mouse.enabled? # Add a delay to prevent too-fast scrolling @delay = @delay ? @delay + 1 : 0 return if @delay % 3 > 0 mx, my = *Mouse.position vx = (self.viewport ? self.x - self.viewport.ox + self.viewport.rect.x : self.x) + padding vy = (self.viewport ? self.y - self.viewport.oy + self.viewport.rect.y : self.y) + padding if mx.between?(vx, vx + self.width - padding * 2) && my.between?(vy, vy + self.height - padding * 2) mx -= vx my -= vy x = (mx > 5*32+16 ? mx-16 : mx) / 32 y = my / line_height last_index = @index @index = y * 10 + x Sound.play_cursor if @index != last_index end endend class Scene_File < Scene_MenuBase #-------------------------------------------------------------------------- # * Update Cursor #-------------------------------------------------------------------------- alias shaz_mouse_scene_file_update_cursor update_cursor def update_cursor shaz_mouse_scene_file_update_cursor process_mouse_handling if Input.method == :mouse end #-------------------------------------------------------------------------- # * Mouse Movement Processing #-------------------------------------------------------------------------- def process_mouse_handling return unless $mouse.enabled? # Add a delay to prevent too-fast scrolling @delay = @delay ? @delay + 1 : 0 return if @delay % 3 > 0 mx, my = *Mouse.position vx = @savefile_viewport.ox + mx vy = @savefile_viewport.oy + my last_index = @index new_index = vy / savefile_height if @index != new_index if new_index > @index cursor_down(false) else cursor_up(false) end Sound.play_cursor @savefile_windows[last_index].selected = false @savefile_windows[@index].selected = true end endend 
Full Input Keyboard script by Cidiomar R. Dias Junior

Code:
#==============================================================================# ** Input#-------------------------------------------------------------------------------# Created By Cidiomar R. Dias Junior# Originally posted at ## Terms of Use: Credit "Cidiomar R. Dias Junior"## Maintained on Hime Works#-------------------------------------------------------------------------------# ** Description## A module that handles input data from a gamepad or keyboard.# Managed by symbols rather than button numbers in RGSS3.#-------------------------------------------------------------------------------# ** Usage# # Scroll down to the configuration section. It is around line 185.# You can set up your key mappings there. Use the reference to get the names# of the keys.##===============================================================================module Input  #===============================================================================# Reference## Use this to determine which keys are available for mapping#===============================================================================  #--------------------------------------------------------------------------  # * Keymap in symbols  # To get a key from the keymap, you can use Input.key(sym) or Input:KEYMAP[sym]  # Or if you want to use a symbol in a input function, just pass the symbol  # as argument.  #--------------------------------------------------------------------------  KEYMAP = {    LBUTTON:             0x01,  RBUTTON:           0x02,    CANCEL:              0x03,  MBUTTON:           0x04,    XBUTTON1:            0x05,  XBUTTON2:          0x06,    BACK:                0x08,  TAB:               0x09,    CLEAR:               0x0c,  RETURN:            0x0d,    SHIFT:               0x10,  CONTROL:           0x11,    MENU:                0x12,  PAUSE:             0x13,    CAPITAL:             0x14,  KANA:              0x15,    KANA:                0x15,  KANA:              0x15,    JUNJA:               0x17,  FINAL:             0x18,    HANJA:               0x19,  HANJA:             0x19,    ESCAPE:              0x1b,  CONVERT:           0x1c,    NONCONVERT:          0x1d,  ACCEPT:            0x1e,    MODECHANGE:          0x1f,  SPACE:             0x20,    PRIOR:               0x21,  NEXT:              0x22,    END:                 0x23,  HOME:              0x24,    LEFT:                0x25,  UP:                0x26,    RIGHT:               0x27,  DOWN:              0x28,    SELECT:              0x29,  PRINT:             0x2a,    EXECUTE:             0x2b,  SNAPSHOT:          0x2c,    INSERT:              0x2d,  DELETE:            0x2e,    HELP:                0x2f,  N0:                0x30,    KEY_1:               0x31,  KEY_2:             0x32,    KEY_3:               0x33,  KEY_4:             0x34,    KEY_5:               0x35,  KEY_6:             0x36,    KEY_7:               0x37,  KEY_8:             0x38,    KEY_9:               0x39,  colon:             0x3a,    semicolon:           0x3b,  less:              0x3c,    equal:               0x3d,  greater:           0x3e,    question:            0x3f,  at:                0x40,    LETTER_A:            0x41,  LETTER_B:          0x42,    LETTER_C:            0x43,  LETTER_D:          0x44,    LETTER_E:            0x45,  LETTER_F:          0x46,    LETTER_G:            0x47,  LETTER_H:          0x48,    LETTER_I:            0x49,  LETTER_J:          0x4a,    LETTER_K:            0x4b,  LETTER_L:          0x4c,    LETTER_M:            0x4d,  LETTER_N:          0x4e,    LETTER_O:            0x4f,  LETTER_P:          0x50,    LETTER_Q:            0x51,  LETTER_R:          0x52,    LETTER_S:            0x53,  LETTER_T:          0x54,    LETTER_U:            0x55,  LETTER_V:          0x56,    LETTER_W:            0x57,  LETTER_X:          0x58,    LETTER_Y:            0x59,  LETTER_Z:          0x5a,    LWIN:                0x5b,  RWIN:              0x5c,    APPS:                0x5d,  asciicircum:       0x5e,    SLEEP:               0x5f,  NUMPAD0:           0x60,    NUMPAD1:             0x61,  NUMPAD2:           0x62,    NUMPAD3:             0x63,  NUMPAD4:           0x64,    NUMPAD5:             0x65,  NUMPAD6:           0x66,    NUMPAD7:             0x67,  NUMPAD8:           0x68,    NUMPAD9:             0x69,  MULTIPLY:          0x6a,    ADD:                 0x6b,  SEPARATOR:         0x6c,    SUBTRACT:            0x6d,  DECIMAL:           0x6e,    DIVIDE:              0x6f,  F1:                0x70,    F2:                  0x71,  F3:                0x72,    F4:                  0x73,  F5:                0x74,    F6:                  0x75,  F7:                0x76,    F8:                  0x77,  F9:                0x78,    F10:                 0x79,  F11:               0x7a,    F12:                 0x7b,  F13:               0x7c,    F14:                 0x7d,  F15:               0x7e,    F16:                 0x7f,  F17:               0x80,    F18:                 0x81,  F19:               0x82,    F20:                 0x83,  F21:               0x84,    F22:                 0x85,  F23:               0x86,    F24:                 0x87,  NUMLOCK:           0x90,    SCROLL:              0x91,  LSHIFT:            0xa0,    RSHIFT:              0xa1,  LCONTROL:          0xa2,    RCONTROL:            0xa3,  LMENU:             0xa4,    RMENU:               0xa5,  BROWSER_BACK:      0xa6,    BROWSER_FORWARD:     0xa7,  BROWSER_REFRESH:   0xa8,    BROWSER_STOP:        0xa9,  BROWSER_SEARCH:    0xaa,    BROWSER_FAVORITES:   0xab,  BROWSER_HOME:      0xac,    VOLUME_MUTE:         0xad,  VOLUME_DOWN:       0xae,    VOLUME_UP:           0xaf,  MEDIA_NEXT_TRACK:  0xb0,    MEDIA_PREV_TRACK:    0xb1,  MEDIA_STOP:        0xb2,    MEDIA_PLAY_PAUSE:    0xb3,  LAUNCH_MAIL:       0xb4,    LAUNCH_MEDIA_SELECT: 0xb5,  LAUNCH_APP1:       0xb6,    LAUNCH_APP2:         0xb7,  cedilla:           0xb8,    onesuperior:         0xb9,  masculine:         0xba,    guillemotright:      0xbb,  onequarter:        0xbc,    onehalf:             0xbd,  threequarters:     0xbe,    questiondown:        0xbf,  Agrave:            0xc0,    Aacute:              0xc1,  Acircumflex:       0xc2,    Atilde:              0xc3,  Adiaeresis:        0xc4,    Aring:               0xc5,  AE:                0xc6,    Ccedilla:            0xc7,  Egrave:            0xc8,    Eacute:              0xc9,  Ecircumflex:       0xca,    Ediaeresis:          0xcb,  Igrave:            0xcc,    Iacute:              0xcd,  Icircumflex:       0xce,    Idiaeresis:          0xcf,  ETH:               0xd0,    Ntilde:              0xd1,  Ograve:            0xd2,    Oacute:              0xd3,  Ocircumflex:       0xd4,    Otilde:              0xd5,  Odiaeresis:        0xd6,    multiply:            0xd7,  Oslash:            0xd8,    Ugrave:              0xd9,  Uacute:            0xda,    Ucircumflex:         0xdb,  Udiaeresis:        0xdc,    Yacute:              0xdd,  THORN:             0xde,    ssharp:              0xdf,  agrave:            0xe0,    aacute:              0xe1,  acircumflex:       0xe2,    atilde:              0xe3,  adiaeresis:        0xe4,    PROCESSKEY:          0xe5,  ae:                0xe6,    PACKET:              0xe7,  egrave:            0xe8,    eacute:              0xe9,  ecircumflex:       0xea,    ediaeresis:          0xeb,  igrave:            0xec,    iacute:              0xed,  icircumflex:       0xee,    idiaeresis:          0xef,  eth:               0xf0,    ntilde:              0xf1,  ograve:            0xf2,    oacute:              0xf3,  ocircumflex:       0xf4,    otilde:              0xf5,  ATTN:              0xf6,    CRSEL:               0xf7,  EXSEL:             0xf8,    EREOF:               0xf9,  PLAY:              0xfa,    ZOOM:                0xfb,  NONAME:            0xfc,    PA1:                 0xfd,  thorn:             0xfe,    ydiaeresis:          0xff  }  #===============================================================================# Configuration#===============================================================================  KEYMAP[:WIN]  = [KEYMAP[:LWIN], KEYMAP[:RWIN]]  #--------------------------------------------------------------------------  # * Default Keys, you can configure here instead of by pressing F1.  #--------------------------------------------------------------------------  UP    = [KEYMAP[:UP], KEYMAP[:LETTER_W]]  DOWN  = [KEYMAP[:DOWN], KEYMAP[:LETTER_S]]  LEFT  = [KEYMAP[:LEFT], KEYMAP[:LETTER_A]]  RIGHT = [KEYMAP[:RIGHT], KEYMAP[:LETTER_D]]  A     = [KEYMAP[:SHIFT], KEYMAP[:SPACE], KEYMAP[:MBUTTON], KEYMAP[:XBUTTON1], KEYMAP[:XBUTTON2]]  B     = [KEYMAP[:ESCAPE], KEYMAP[:LETTER_R], KEYMAP[:LETTER_Q], KEYMAP[:BACK], KEYMAP[:LETTER_X], KEYMAP[:RBUTTON]]  C     = [KEYMAP[:RETURN], KEYMAP[:LETTER_E], KEYMAP[:LETTER_Z], KEYMAP[:LBUTTON]]  X     = [KEYMAP[:KEY_3], KEYMAP[:LETTER_V]]  Y     = [KEYMAP[:LETTER_F], KEYMAP[:LETTER_C]]  Z     = [KEYMAP[:KEY_4], KEYMAP[:TAB], KEYMAP[:LETTER_P], KEYMAP[:PAUSE]]  L     = [KEYMAP[:KEY_1], KEYMAP[:PRIOR], KEYMAP[:HOME]]  R     = [KEYMAP[:KEY_2], KEYMAP[:NEXT], KEYMAP[:END]]  F5    = [KEYMAP[:F5]]  F6    = [KEYMAP[:F6]]  F7    = [KEYMAP[:F7]]  F8    = [KEYMAP[:F8]]  F9    = [KEYMAP[:F9]]  SHIFT = [KEYMAP[:SHIFT]]  CTRL  = [KEYMAP[:CONTROL]]  ALT   = [KEYMAP[:MENU]]#===============================================================================# Rest of script#===============================================================================  #--------------------------------------------------------------------------  # * Symbol version of default keys.  #--------------------------------------------------------------------------  SYM_KEYS = {    :UP       => UP,    :LEFT     => LEFT,    :DOWN     => DOWN,    :RIGHT    => RIGHT,    :A        => A,    :B        => B,    :C        => C,    :X        => X,    :Y        => Y,    :Z        => Z,    :L        => L,    :R        => R,    :F5       => F5,    :F6       => F6,    :F7       => F7,    :F8       => F8,    :F9       => F9,    :SHIFT    => SHIFT,    :CTRL     => CTRL,    :ALT      => ALT  }  #--------------------------------------------------------------------------  # * Key Codes Used in Events Conditional Branchs  #--------------------------------------------------------------------------  EventsKeyCodes = {     2 => :DOWN,     4 => :LEFT,     6 => :RIGHT,     8 => :UP,    11 => :A,    12 => :B,    13 => :C,    14 => :X,    15 => :Y,    16 => :Z,    17 => :L,    18 => :R  }    #--------------------------------------------------------------------------  # * Internal APIs to handle keyboard functions  #--------------------------------------------------------------------------  GetKeyboardState  = Win32API.new("user32.dll", "GetKeyboardState",  "I", "I")  MapVirtualKeyEx   = Win32API.new("user32.dll", "MapVirtualKeyEx", "IIL", "I")  ToUnicodeEx      = Win32API.new("user32.dll", "ToUnicodeEx", "LLPPILL", "L")  #----------  @language_layout  = Win32API.new("user32.dll", "GetKeyboardLayout", "L", "L").call(0)  DOWN_STATE_MASK   = (0x8 << 0x04)  DEAD_KEY_MASK  = (0x8 << 0x1C)  #-----  UNICODE_TO_UTF8   = Encoding::Converter.new(Encoding.list[2], Encoding.list[1])  #--------------------------------------------------------------------------  # * States of keys  #--------------------------------------------------------------------------  @state     = DL::CPtr.new(DL.malloc(256), 256)  @triggered = Array.new(256, false)  @pressed   = Array.new(256, false)  @released  = Array.new(256, false)  @repeated  = Array.new(256, 0)  #--------------------------------------------------------------------------  # * Singleton attrs of states  #--------------------------------------------------------------------------  class << self    attr_reader :triggered, :pressed, :released, :repeated, :state  end  #--------------------------------------------------------------------------  # * Get a key code by simbol  #--------------------------------------------------------------------------  def self.key(sym)    KEYMAP[sym] || 0  end  #--------------------------------------------------------------------------  # * Updates input data.  # As a general rule, this method is called once per frame.  #--------------------------------------------------------------------------  def self.update    GetKeyboardState.call(@state.to_i)    0.upto(255) do |key|      if @state[key] & DOWN_STATE_MASK == DOWN_STATE_MASK        @released[key] = false        @pressed[key]  = true if (@triggered[key] = !@pressed[key])        @repeated[key] < 17 ? @repeated[key] += 1 : @repeated[key] = 15      elsif !@released[key] and @pressed[key]        @triggered[key] = false        @pressed[key]   = false        @repeated[key]  = 0        @released[key]  = true      else        @released[key]  = false      end    end  end  #--------------------------------------------------------------------------  # * Checks the status of the directional buttons, translates the data into  # a specialized 4-direction input format, and returns the number pad  # equivalent (2, 4, 6, 8).  #  # If no directional buttons are being pressed (or the equivalent), returns 0.  #--------------------------------------------------------------------------  def self.dir4    return 2 if self.press?(DOWN)    return 4 if self.press?(LEFT)    return 6 if self.press?(RIGHT)    return 8 if self.press?(UP)    return 0  end  #--------------------------------------------------------------------------  # * Checks the status of the directional buttons, translates the data into  # a specialized 8-direction input format, and returns the number pad  # equivalent (1, 2, 3, 4, 6, 7, 8, 9).  #  #If no directional buttons are being pressed (or the equivalent), returns 0.  #--------------------------------------------------------------------------  def self.dir8    down = self.press?(DOWN)    left = self.press?(LEFT)    return 1 if down and left    right = self.press?(RIGHT)    return 3 if down and right    up = self.press?(UP)    return 7 if up and left    return 9 if up and right    return 2 if down    return 4 if left    return 6 if right    return 8 if up    return 0  end  #--------------------------------------------------------------------------  # * Determines whether the button corresponding to the symbol sym is  # currently being pressed.  #  # If the button is being pressed, returns TRUE. If not, returns FALSE.  #  #   if Input.press?(:C)  #      do_something  #   end  #--------------------------------------------------------------------------  def self.press?(keys)    if keys.is_a?(Numeric)      k = keys.to_i      return (@pressed[k] and !@triggered[k])    elsif keys.is_a?(Array)      return keys.any? {|key| self.press?(key) }    elsif keys.is_a?(Symbol)      if SYM_KEYS.key?(keys)        return SYM_KEYS[keys].any? {|key| (@pressed[key]  and !@triggered[key]) }      elsif (KEYMAP.key?(keys))        k = KEYMAP[keys]        return (@pressed[k] and !@triggered[k])      else        return false      end    end  end  #--------------------------------------------------------------------------  # * Determines whether the button corresponding to the symbol sym is  # currently being pressed again.  # "Pressed again" is seen as time having passed between the button being  # not pressed and being pressed.  #  # If the button is being pressed, returns TRUE. If not, returns FALSE.  #--------------------------------------------------------------------------  def self.trigger?(keys)    if keys.is_a?(Numeric)      return @triggered[keys.to_i]    elsif keys.is_a?(Array)      return keys.any? {|key| @triggered[key]}    elsif keys.is_a?(Symbol)      if SYM_KEYS.key?(keys)        return SYM_KEYS[keys].any? {|key| @triggered[key]}      elsif KEYMAP.key?(keys)        return @triggered[KEYMAP[keys]]      else        return false      end    end  end  #--------------------------------------------------------------------------  # * Determines whether the button corresponding to the symbol sym is  # currently being pressed again.  # Unlike trigger?, takes into account the repeated input of a button being  # held down continuously.  #  # If the button is being pressed, returns TRUE. If not, returns FALSE.  #--------------------------------------------------------------------------  def self.repeat?(keys)    if keys.is_a?(Numeric)      key = keys.to_i      return @repeated[key] == 1 || @repeated[key] == 16    elsif keys.is_a?(Array)      return keys.any? {|key| @repeated[key] == 1 || @repeated[key] == 16}    elsif keys.is_a?(Symbol)      if SYM_KEYS.key?(keys)        return SYM_KEYS[keys].any? {|key| @repeated[key] == 1 || @repeated[key] == 16}      elsif KEYMAP.key?(keys)        return @repeated[KEYMAP[keys]] == 1 || @repeated[KEYMAP[keys]] == 16      else        return false      end    end  end  #--------------------------------------------------------------------------  # * Determines whether the button corresponding to the symbol sym  # was released.  #  # If the button was released, returns TRUE. If not, returns FALSE.  #--------------------------------------------------------------------------  def self.release?(keys)    if keys.is_a?(Numeric)      return @released[keys.to_i]    elsif keys.is_a?(Array)      return keys.any? {|key| @released[key]}    elsif keys.is_a?(Symbol)      if SYM_KEYS.key?(keys)        return SYM_KEYS[keys].any? {|key| @released[key]}      elsif KEYMAP.key?(keys)        return @released[KEYMAP[keys]]      else        return false      end    end  end  #--------------------------------------------------------------------------  # * Gets the character that correspond to vk using the keyboard layout  #--------------------------------------------------------------------------  def self.get_character(vk)    c = MapVirtualKeyEx.call(vk, 2, @language_layout)    return "" if c < 32 && (c & DEAD_KEY_MASK != DEAD_KEY_MASK)    result = "\0" * 2    length = ToUnicodeEx.call(vk, MapVirtualKeyEx.call(vk, 0, @language_layout), @state, result, 2, 0, @language_layout)    return (length == 0 ? "" : result)  end  #--------------------------------------------------------------------------  # * Accents Table, to bo used in conversion from ASCII to UTF8  #--------------------------------------------------------------------------  AccentsCharsConv = {    "A" =>  ["A", "A", "A", "A", "A"],    "E" =>  ["E", "E", "E",  0,  "E"],    "I" =>  ["I", "I", "I",  0,  "I"],    "O" =>  ["O", "O", "O", "O", "O"],    "U" =>  ["U", "U", "U",  0,  "U"],    "C" =>  [ 0 , "C",  0 ,  0,  0 ],    "N" =>  [ 0 ,  0,  0 , "N",  0 ],    "Y" =>  [ 0 , "Y",  0 ,  0,  "?"],    "a" =>  ["a", "a", "a", "a", "a"],    "e" =>  ["e", "e", "e",  0 , "e"],    "i" =>  ["i", "i", "i",  0 , "i"],    "o" =>  ["o", "o", "o", "o", "o"],    "u" =>  ["u", "u", "u",  0 , "u"],    "c" =>  [ 0 , "c",  0 ,  0 ,  0 ],    "n" =>  [ 0 ,  0 ,  0 , "n",  0 ],    "y" =>  [ 0 , "y",  0 ,  0 , "y"],  }    # Letters that can have accent  PssbLetters   = "AEIOUCNYaeioucny"  # Accents, in ASCII, configured at runtime to avoid encoding troubles  Accents = [96.chr, 180.chr, 94.chr, 126.chr, 168.chr].join  NonCompatChars = [180, 168]  @last_accent = nil  #--------------------------------------------------------------------------  # * Get inputed string transcoded to UTF8  #--------------------------------------------------------------------------  def self.UTF8String    result = ""    31.upto(255) {|key|            if self.repeat?(key)              c = self.get_character(key)              if (cc = c.unpack("C")[0]) and NonCompatChars.include?(cc)                    result += cc.chr              else                    result += UNICODE_TO_UTF8.convertc if c != ""              end            end    }    return "" if result == ""    if @last_accent      result = @last_accent + result      @last_accent = nil    end    f_result = ""    jump    = false    for i in 0 ... result.length      c = result[i]      if jump        jump = false        next      end      if Accents.include?c        if (nc = result[i+1]) != nil          if PssbLetters.include?(nc)            if (ac = AccentsCharsConv[nc][Accents.indexc]) != 0              f_result << ac              jump = true            else              f_result << c              f_result << nc              jump = true            end          elsif Accents.include?(nc)            f_result << c            f_result << nc            jump = true          else            f_result << c            f_result << nc            jump = true          end        else          @last_accent = c        end      else        f_result << c      end    end    return f_result  endend 
 
Last edited by a moderator:

Seriel

Veteran
Veteran
Joined
Aug 16, 2014
Messages
3,013
Reaction score
504
First Language
English
Primarily Uses
Other
In that script, there was a key defined as 'Scroll' have you tried messing about with that to see if it works?
 

TheDrifter

Veteran
Veteran
Joined
Apr 18, 2012
Messages
121
Reaction score
7
First Language
English
Primarily Uses
In that script, there was a key defined as 'Scroll' have you tried messing about with that to see if it works?
Yes, that's actually the keyboard Key called "Scroll", not the mouse wheel.

Thanks for the input though, it could've been a possible detail for me to overlook.
 

Jet

Flying in a sky near you
Veteran
Joined
Mar 19, 2012
Messages
172
Reaction score
104
First Language
English
Primarily Uses
Honestly, I didn't test this very much, just that it seemed functions with Shaz's mouse or my own. It doesn't use the given input script because that doesn't have the functions required.

This snippet is technically mouse independent, and doesn't require any of the existing mouse scripts to function properly.

http://pastebin.com/raw.php?i=q4TcSE1h

It's adapted from a function I had in a previous version of my own mouse script, which was removed for issue I couldn't solve back then, but have since fixed now.
 
Last edited by a moderator:

TheDrifter

Veteran
Veteran
Joined
Apr 18, 2012
Messages
121
Reaction score
7
First Language
English
Primarily Uses
Very nice!

The script works great with lists of items and skills. However you cannot cycle through character pages like you can with L & R (keyboard keys Q and W by default).

Is this something that can be easily added?

Again, thank you very much for you help.
 

Jet

Flying in a sky near you
Veteran
Joined
Mar 19, 2012
Messages
172
Reaction score
104
First Language
English
Primarily Uses
It's probably something that someone else can add pretty easily, but I don't particularly want to delve into it, sorry. Anyone can feel free to work off my base though.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
If that script allows to catch the mouse scroll in the same way as keyboard presses then it would be pretty easy to modify the scripts to add the mouse scroll as a trigger to the page change.
 

Latest Threads

Latest Profile Posts

Can February March? No, but April May.
Alisa: Prophecy of the Falling Stars. Join Alisa, a quiet girl with a heart filled with love and hope, on her journey to prevent a calamity. My next RPG Maker music pack is my largest and most focused pack yet. It's a musical story that focuses on a young heroine named Alisa who has been assigned the ultimate task to prevent a calamity.

SnJj_O.png
Alien Worlds, Minecraft Blocks, Extend Options, Fine Speed Control, Art by Muggu | RPG Maker News #33

Rest in Peace vlog gun...
vloggunsmallface.png

Forum statistics

Threads
111,164
Messages
1,058,885
Members
144,408
Latest member
Bretzel68440
Top