Author Id: 12616 Author Name: VGS Post Content: Tengo un problema con el script de mouse. Me aparece este error [IMG]http://s2.subirimagenes.com/imagen/previo/thump_84147881.png[/IMG] [IMG]http://s2.subirimagenes.com/imagen/previo/thump_84147902.png[/IMG] El script es este [SPOILER="Abrir"] #=============================================================================== # * Mouse Script for Pokemon Essentials # * By Crazyninjaguy # * [url]http://www.planetdev.net[/url] #=============================================================================== # If you like this script, please register on my site :') # [url]http://www.planetdev.net[/url] #=============================================================================== # Set this to true if you use the mouse module USE_MOUSE = true $width = 512 if FileTest.exist?("C:/Windows/clock.avi") $height = 778 else $height = 770 end module Resolution GetWindowPlacement = Win32API.new('user32','GetWindowPlacement',['l','p'],'l') GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics',['i'],'i') MoveWindow = Win32API.new('user32','MoveWindow',['l','i','i','i','i','l'],'l') FindWindowEx = Win32API.new('user32','FindWindowEx',['l','l','p','p'],'i') def self.windowloc(window) string = ' ' * 44 Resolution::GetWindowPlacement.call(window,string) windowdetails = string.unpack('L11') result = [] result.push((windowdetails[9] - windowdetails[7])) result.push((windowdetails[10] - windowdetails[8])) result.push(windowdetails[7]) result.push(windowdetails[8]) return result end end class Screen def self.center window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0) width,height = Resolution.windowloc(window)[0..1] screenwidth = Resolution::GetSystemMetrics.call(0) screenheight = Resolution::GetSystemMetrics.call(1) Resolution::MoveWindow.call(window,(screenwidth - width) / 2,(screenheight - height) / 2,width,height,1) end def self.resize2(width,height,x,y) window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0) screenwidth = Resolution::GetSystemMetrics.call(0) screenheight = Resolution::GetSystemMetrics.call(1) Resolution::MoveWindow.call(window,x,y,width,height,1) end def self.move(x,y) window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0) width,height = Resolution.windowloc(window)[0..1] screenwidth = Resolution::GetSystemMetrics.call(0) screenheight = Resolution::GetSystemMetrics.call(1) Resolution::MoveWindow.call(window,x,y,width,height,1) end def self.resize(width,height,center = true) window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0) screenwidth = Resolution::GetSystemMetrics.call(0) screenheight = Resolution::GetSystemMetrics.call(1) if center Resolution::MoveWindow.call(window,(screenwidth - width) / 2,(screenheight - height) / 2,width,height,1) else x,y = Resolution.windowloc(window)[2..3] Resolution::MoveWindow.call(window,x,y,width,height,1) end end def self.half(center = true) window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0) screenwidth = Resolution::GetSystemMetrics.call(0) screenheight = Resolution::GetSystemMetrics.call(1) if center Resolution::MoveWindow.call(window,(screenwidth - 326) / 2,(screenheight - 272) / 2,326,272,1) else x,y = Resolution.windowloc(window)[2..3] Resolution::MoveWindow.call(window,x,y,326,272,1) end end def self.default window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0) screenwidth = Resolution::GetSystemMetrics.call(0) screenheight = Resolution::GetSystemMetrics.call(1) Resolution::MoveWindow.call(window,(screenwidth - 646) / 2,(screenheight / 2) - 273,646,512,1) end end class MouseSprite def initialize @mouse = Sprite.new @mouse.bitmap = RPG::Cache.picture("Mouse.png") @mouse.z = 9999999 @mouse.x = 512 @mouse.zoom_x = 1 @mouse.zoom_y = 1 end def self.x return @mouse.x end def self.y return @mouse.y end def update case $ResizeFactor when 0.5 @mouse.x = Mouse.pos_x * 2 @mouse.y = Mouse.pos_y * 2 when 1.0 @mouse.x = Mouse.pos_x @mouse.y = Mouse.pos_y end end def cursor(filename) @mouse.bitmap = RPG::Cache.picture(filename) end def opacity(opacity) @mouse.opacity = opacity end def defaults @mouse.bitmap = RPG::Cache.picture("Mouse.png") @mouse.opacity = 255 @mouse.zoom_x = 2 @mouse.zoom_y = 2 end end module Mouse $mouse=MouseSprite.new @cursor_pos_get = Win32API.new('user32', 'GetCursorPos', 'p', 'i') @cursor_pos_set = Win32API.new('user32', 'SetCursorPos', 'ii', 'i') @cursor_show = Win32API.new('user32', 'ShowCursor', 'L', 'i') @window_find = Win32API.new('user32', 'FindWindowA', %w(p p), 'l') @window_c_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i') @window_scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i') @readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l') @key = Win32API.new("user32", "GetAsyncKeyState", 'i', 'i') Left_Click = 1 Right_Click = 2 Middle_Click = 4 MOUSE_BUTTONS = { Left_Click => 1, Right_Click => 2, Middle_Click => 4 } MOUSE_REPEAT = MOUSE_BUTTONS.clone MOUSE_REPEAT.keys.each { |k| MOUSE_REPEAT[k] = [false, false, 10]} @game_window = nil # Set game handle to nil @cursor_show.call(0) # Turn off system mouse def Mouse.click?(button) MOUSE_REPEAT[1] >= 1 end def Mouse.dbclick?(button) MOUSE_REPEAT[1] == 2 end def Mouse.pos(catch_anywhere = true) x, y = screen_to_client(screen_x, screen_y) width, height = client_size if catch_anywhere or (x >= 0 and y >= 0 and x < width and y < height) return x, y else return 0, 0 end end def Mouse.pos_set(x, y) x = [[x, 0].max, 640].min y = [[y, 0].max, 480].min x, y = client_to_screen(x, y) @cursor_pos_set.call(x, y) end def Mouse.pos_x x, y = pos return x end def Mouse.pos_y x, y = pos return y end def Mouse.screen pos = [0, 0].pack('ll') @cursor_pos_get.call(pos) return pos.unpack('ll') end def Mouse.screen_x pos = [0, 0].pack('ll') @cursor_pos_get.call(pos) return pos.unpack('ll')[0] end def Mouse.screen_y pos = [0, 0].pack('ll') @cursor_pos_get.call(pos) return pos.unpack('ll')[1] end def Mouse.client_size rect = [0, 0, 0, 0].pack('l4') @window_c_rect.call(Mouse.hwnd, rect) right, bottom = rect.unpack('l4')[2..3] return right, bottom end def Mouse.hwnd if @game_window.nil? game_name = "\0" * 256 @readini.call('Game','Title',,game_name,255,".\\Game.ini") game_name.delete!("\0") @game_window = @window_find.call('RGSS Player',game_name) end return @game_window end def Mouse.screen_to_client(x, y) return nil unless x and y pos = [x, y].pack('ll') if @window_scr2cli.call(hwnd, pos) != 0 return pos.unpack('ll') else return nil end end def Mouse.update $mouse.update MOUSE_BUTTONS.keys.each do |key| temp = MOUSE_REPEAT[key][0] key_pres = @key.call(MOUSE_BUTTONS[key]) != 0 key_trig = temp == key_pres ? 0 : (key_pres ? (MOUSE_REPEAT[key][2].between?(1, 9) ? 2 : 1) : -1) count = key_trig > 0 ? 0 : [MOUSE_REPEAT[key][2]+1, 20].min MOUSE_REPEAT[key] = [key_pres, key_trig, count] end end def Mouse.visible?(visible=true) if visible @cursor_show.call(-1) else @cursor_show.call(0) end end def Mouse.mouse_in_area?(*args) return false if Mouse.pos_x.nil? case $ResizeFactor when 0.5 args[0] = args[0] / 2 args[1] = args[1] / 2 args[2] = args[2] / 2 args[3] = args[3] / 2 end if args[0].is_a?(Rect) Mouse.pos_x >= args[0].x and Mouse.pos_y >= args[0].y and Mouse.pos_x <= args[0].x + args[0].width and Mouse.pos_y <= args[0].y + args[0].height else Mouse.pos_x >= args[0] and Mouse.pos_y >= args[1] and Mouse.pos_x <= args[0] + args[2] and Mouse.pos_y <= args[1] + args[3] end end end module Input class << self alias cng_input_update update def update cng_input_update Mouse.update end end end module Spacer def self.initialize @spacer = Sprite.new @spacer.bitmap = RPG::Cache.picture("Spacer") @spacer.y = 384 @spacer.z = 9999998 end def self.defaults @spacer.bitmap = RPG::Cache.picture("Spacer") @spacer.y = 384 @spacer.z = 9999998 @spacer.opacity = 255 @spacer.zoom_x = 1 @spacer.zoom_y = 1 end def self.opacity(n) @spacer.opacity = n end def self.x(x) @spacer.x = x end def self.y(y) @spacer.y = y end def self.zoom_x(zoomx) @spacer.zoom_x = zoomx end def self.zoom_y(zoomy) @spacer.zoom_y = zoomy end def self.dispose @spacer.dispose end end[/SPOILER] Por favor necesito que me ayuden :(