XP 스크립트

Near Fantastica씨의 마우스 스크립트입니다.  일부 스크립트에서 이 것을 필요로 합니다.  물론 다른 마우스 입력 스크립트와 혼용불가입니다. 


#==============================================================================
# ** Mouse Input Module
#------------------------------------------------------------------------------
# Near Fantastica
# Version 5
# 01.03.06
#------------------------------------------------------------------------------
# This module defines mouse input
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Mouse Input", "Near Fantastica", 5, "01.03.06")

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Mouse Input") == true

module Mouse
  @position
  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')
  Readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
  Findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
  #-------------------------------------------------------------------------- 
  def Mouse.grid
    return nil if @pos == nil
    offsetx = $game_map.display_x / 4
    offsety = $game_map.display_y / 4
    x = (@pos[0] + offsetx) / 32
    y = (@pos[1] + offsety) / 32
    return [x, y]
  end
  #-------------------------------------------------------------------------- 
  def Mouse.position
    return @pos == nil ? [0, 0] : @pos
  end
  #-------------------------------------------------------------------------- 
  def Mouse.global_pos
    pos = [0, 0].pack('ll')
    if Cursor_Pos.call(pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #-------------------------------------------------------------------------- 
  def Mouse.pos
    x, y = Mouse.screen_to_client(*Mouse.global_pos)
    width, height = Mouse.client_size
    begin
      if (x >= 0 and y >= 0 and x < width and y < height)
        return x, y
      else
        return nil
      end
    rescue
      return nil
    end
  end
  #-------------------------------------------------------------------------- 
  def Mouse.update
    @pos = Mouse.pos
  end
  #-------------------------------------------------------------------------- 
  def Mouse.screen_to_client(x, y)
    return nil unless x and y
    pos = [x, y].pack('ll')
    if Scr2cli.call(Mouse.hwnd, pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #-------------------------------------------------------------------------- 
  def Mouse.hwnd
    game_name = "" * 256
    Readini.call('Game','Title','',game_name,255,".\Game.ini")
    game_name.delete!("")
    return Findwindow.call('RGSS Player',game_name)
  end
  #-------------------------------------------------------------------------- 
  def Mouse.client_size
    rect = [0, 0, 0, 0].pack('l4')
    Client_rect.call(Mouse.hwnd, rect)
    right, bottom = rect.unpack('l4')[2..3]
    return right, bottom
  end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
561 기타 [신기술 체험] 오투잼 스크립트 7 file 백호 2009.02.22 1959
560 파티 [신기술 체험] 2p파티시스템(액알) 8 file 백호 2009.02.22 3193
559 기타 [신기술 체험] 솔로채팅창 17 file 백호 2009.02.22 2187
558 기타 [신기술 체험] RPGXP 3D 9 file 백호 2009.02.22 3633
557 전투 [신기술 체험]액션배틀1탄 6 file 백호 2009.02.22 2766
556 메뉴 Advanced Command Windows by Tsunokiette file 백호 2009.02.22 1307
555 기타 RM2K Facesets, Inn & Windowskin Colors by DerVVulfman@rmxp.org 1 file 백호 2009.02.22 866
554 스킬 SG_Skill Break by sandgolem (SDK호환) 백호 2009.02.22 772
553 아이템 SG_Item Break by sandgolem (SDK호환) 백호 2009.02.22 897
552 전투 SG_Attack Break by sandgolem (SDK호환) 백호 2009.02.22 813
551 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2591
550 스킬 Skill Requirements by SephirothSpawn (SDK호환) file 백호 2009.02.22 763
549 저장 Inn & Save Point System by SephirothSpawn (SDK호환) 1 file 백호 2009.02.22 810
548 전투 Stealing/Mugging/Scanning 6.0 Final by Trickster (SDK호환) file 백호 2009.02.22 885
» 키입력 Mouse Input Module v5 by Near Fantastica (SDK호환) 2 백호 2009.02.22 962
546 키입력 Keyboard Input Module v5 by Near Fantastica (SDK호환) 백호 2009.02.22 1075
545 키입력 전체키 입력 스크립트 v4 by Cybersam 5 file 백호 2009.02.22 1947
544 기타 Tetris Attack by trickster 1 file 백호 2009.02.22 986
543 기타 Monster Arena by trickster file 백호 2009.02.22 812
542 기타 Minesweeper(지뢰찾기) by SephirothSpawn (SDK호환) 3 file 백호 2009.02.22 1363
Board Pagination Prev 1 ... 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ... 52 Next
/ 52