设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1362|回复: 1
打印 上一主题 下一主题

[已经过期] 求鼠标脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
22 小时
注册时间
2012-10-28
帖子
9
跳转到指定楼层
1
发表于 2012-12-1 17:57:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 zhshh 于 2012-12-1 18:03 编辑

能用的
最好能行走,点击NPC,最起码要能选择各种选择或菜单的功能
直接发过来我的邮箱(按了是用Microsoft Office Outlook 2003发)
直接用电子邮箱发
[email protected]
就行

Lv3.寻梦者

双子人

梦石
0
星屑
3195
在线时间
3618 小时
注册时间
2009-4-4
帖子
4154

开拓者

2
发表于 2012-12-1 18:43:58 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  5. $敌人选框扩大 = 20
  6. $角色选框扩大 = 30

  7. #==============================================================================
  8. # API调用
  9. #==============================================================================
  10. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  11. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  12. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  13. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  14. $Window_HWND = $GetActiveWindow.call
  15. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  16. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  17. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  18. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  19. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  20. #$Window_HWND = $FindWindow.call(nil, 'mousetry')

  21. module Mouse   
  22. LEFT = 0x01
  23. RIGHT = 0x02

  24. def self.init(sprite = nil)
  25. #   $HookStart.call($Window_HWND)
  26.    $ShowCursor.call(0)
  27.    
  28.    @show_cursor = false
  29.    
  30.    @mouse_sprite = Sprite.new
  31.    @mouse_sprite.z = 99999
  32.    @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/001-Weapon01.png')
  33.    #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))

  34.    @left_press = false
  35.    @right_press = false
  36.    @left_trigger = false
  37.    @right_trigger = false
  38.    @left_repeat = false
  39.    @right_repeat = false
  40.    @click_lock = false
  41.    
  42.    update
  43. end
  44. def self.exit
  45.    @mouse_sprite.bitmap.dispose
  46.    @mouse_sprite.dispose
  47.    @show_cursor = true
  48. #    $HookEnd.call
  49.    $ShowCursor.call(1)
  50. end
  51. def self.mouse_debug
  52.    return @mouse_debug.bitmap
  53. end
  54. def self.update
  55.    left_down = $GetKeyState.call(0x01)
  56.    right_down = $GetKeyState.call(0x02)
  57.    
  58.    @click_lock = false
  59.    mouse_x, mouse_y = self.get_mouse_pos
  60.    if @mouse_sprite != nil
  61.      @mouse_sprite.x = mouse_x
  62.      @mouse_sprite.y = mouse_y
  63.    end
  64.    if left_down[7] == 1
  65.      @left_repeat = (not @left_repeat)
  66.      @left_trigger = (not @left_press)
  67.      @left_press = true
  68.    else
  69.      @left_press = false
  70.      @left_trigger = false
  71.      @left_repeat = false
  72.    end
  73.    if right_down[7] == 1
  74.      @right_repeat = (not @right_repeat)
  75.      @right_trigger = (not @right_press)
  76.      @right_press = true
  77.    else
  78.      @right_press = false
  79.      @right_trigger = false
  80.      @right_repeat = false
  81.    end
  82. end
  83. def self.get_mouse_pos
  84.    point_var = [0, 0].pack('ll')
  85.    if $GetCursorPos.call(point_var) != 0
  86.      if $ScreenToClient.call($Window_HWND, point_var) != 0
  87.        x, y = point_var.unpack('ll')
  88.        if (x < 0) or (x > 10000) then x = 0 end
  89.        if (y < 0) or (y > 10000) then y = 0 end
  90.        if x > 640 then x = 640 end
  91.        if y > 480 then y = 480 end
  92.        return x, y
  93.      else
  94.        return 0, 0
  95.      end
  96.    else
  97.      return 0, 0
  98.    end
  99. end
  100. def self.press?(mouse_code)
  101.    if mouse_code == LEFT
  102.      if @click_lock
  103.        return false
  104.      else
  105.        return @left_press
  106.      end
  107.    elsif mouse_code == RIGHT
  108.      return @right_press
  109.    else
  110.      return false
  111.    end
  112. end
  113. def self.trigger?(mouse_code)
  114.    if mouse_code == LEFT
  115.      if @click_lock
  116.        return false
  117.      else
  118.        return @left_trigger
  119.      end
  120.    elsif mouse_code == RIGHT
  121.      return @right_trigger
  122.    else
  123.      return false
  124.    end
  125. end
  126. def self.repeat?(mouse_code)
  127.    if mouse_code == LEFT
  128.      if @click_lock
  129.        return false
  130.      else
  131.        return @left_repeat
  132.      end
  133.    elsif mouse_code == RIGHT
  134.      return @right_repeat
  135.    else
  136.      return false
  137.    end
  138. end
  139. def self.click_lock?
  140.    return @click_lock
  141. end
  142. def self.click_lock
  143.    @click_lock = true
  144. end
  145. def self.click_unlock
  146.    @click_lock = false
  147. end
  148. end
  149. module Input
  150. if @self_update == nil
  151.    @self_update = method('update')
  152.    @self_press = method('press?')
  153.    @self_trigger = method('trigger?')
  154.    @self_repeat = method('repeat?')
  155. end
  156. def self.update
  157.    @self_update.call
  158.    Mouse.update
  159. end
  160. def self.press?(key_code)
  161.    if @self_press.call(key_code)
  162.      return true
  163.    end
  164.    if key_code == C
  165.      return Mouse.press?(Mouse::LEFT)
  166.    elsif key_code == B
  167.      return Mouse.press?(Mouse::RIGHT)
  168.    else
  169.      return @self_press.call(key_code)
  170.    end
  171. end
  172. def self.trigger?(key_code)
  173.    if @self_trigger.call(key_code)
  174.      return true
  175.    end
  176.    if key_code == C
  177.      return Mouse.trigger?(Mouse::LEFT)
  178.    elsif key_code == B
  179.      return Mouse.trigger?(Mouse::RIGHT)
  180.    else
  181.      return @self_trigger.call(key_code)
  182.    end
  183. end
  184. def self.repeat?(key_code)
  185.    if @self_repeat.call(key_code)
  186.      return true
  187.    end
  188.    if key_code == C
  189.      return Mouse.repeat?(Mouse::LEFT)
  190.    elsif key_code == B
  191.      return Mouse.repeat?(Mouse::RIGHT)
  192.    else
  193.      return @self_repeat.call(key_code)
  194.    end
  195. end
  196. end
  197. class Window_Selectable
  198. if @self_alias == nil
  199.    alias self_update update
  200.    @self_alias = true
  201. end
  202. def update
  203.    #self.cursor_rect.empty
  204.    self_update
  205.    if self.active and @item_max > 0
  206.      index_var = @index
  207.      tp_index = @index
  208.      mouse_x, mouse_y = Mouse.get_mouse_pos
  209.      mouse_not_in_rect = true
  210.      for i in 0...@item_max
  211.        @index = i
  212.        update_cursor_rect
  213.        top_x = self.cursor_rect.x + self.x + 16
  214.        top_y = self.cursor_rect.y + self.y + 16
  215.        bottom_x = top_x + self.cursor_rect.width
  216.        bottom_y = top_y + self.cursor_rect.height
  217.        if (mouse_x > top_x) and (mouse_y > top_y) and
  218.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  219.          mouse_not_in_rect = false
  220.          if tp_index != @index
  221.            tp_index = @index
  222.            $game_system.se_play($data_system.cursor_se)
  223.          end
  224.          break
  225.        end
  226.      end
  227.      if mouse_not_in_rect
  228.        @index = index_var
  229.        update_cursor_rect
  230.        Mouse.click_lock
  231.      else
  232.        Mouse.click_unlock                 
  233.      end
  234.    end
  235. end
  236. end
  237. class Window_NameInput
  238. if @self_alias == nil
  239.    alias self_update update
  240.    @self_alias = true
  241. end
  242. def update
  243.    #self.cursor_rect.empty
  244.    self_update
  245.    if self.active
  246.      index_var = @index
  247.      mouse_x, mouse_y = Mouse.get_mouse_pos
  248.      mouse_not_in_rect = true
  249.      for i in (0...CHARACTER_TABLE.size).to_a.push(180)
  250.        @index = i
  251.        update_cursor_rect
  252.        top_x = self.cursor_rect.x + self.x + 16
  253.        top_y = self.cursor_rect.y + self.y + 16
  254.        bottom_x = top_x + self.cursor_rect.width
  255.        bottom_y = top_y + self.cursor_rect.height
  256.        #
  257.        if (mouse_x > top_x) and (mouse_y > top_y) and
  258.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  259.          mouse_not_in_rect = false
  260.          break
  261.        end
  262.      end
  263.      if mouse_not_in_rect
  264.        @index = index_var
  265.        update_cursor_rect
  266.        Mouse.click_lock
  267.      else
  268.        Mouse.click_unlock
  269.      end
  270.    end
  271. end  
  272. end
  273. class Window_InputNumber
  274. if @self_alias == nil
  275.    alias self_update update
  276.    @self_alias = true
  277. end
  278. def update
  279.    #self.cursor_rect.empty
  280.    self_update
  281.    mouse_x, mouse_y = Mouse.get_mouse_pos
  282.    if self.active and @digits_max > 0
  283.      index_var = @index
  284.      mouse_not_in_rect = true
  285.      for i in 0...@digits_max
  286.        @index = i
  287.        update_cursor_rect
  288.        top_x = self.cursor_rect.x + self.x + 16
  289.        bottom_x = top_x + self.cursor_rect.width
  290.        #
  291.        if (mouse_x > top_x) and (mouse_x < bottom_x)
  292.          mouse_not_in_rect = false
  293.          break
  294.        end
  295.      end
  296.      if mouse_not_in_rect
  297.        @index = index_var
  298.        update_cursor_rect
  299.        Mouse.click_lock
  300.      else
  301.        Mouse.click_unlock
  302.      end
  303.    end
  304.    if @last_mouse_y == nil
  305.      @last_mouse_y = mouse_y
  306.    end
  307.    check_pos = (@last_mouse_y - mouse_y).abs
  308.    if check_pos > 10
  309.      $game_system.se_play($data_system.cursor_se)
  310.      place = 10 ** (@digits_max - 1 - @index)
  311.      n = [url=home.php?mod=space&uid=27178]@Number[/url] / place % 10
  312.      @number -= n * place
  313.      n = (n + 1) % 10 if mouse_y < @last_mouse_y
  314.      n = (n + 9) % 10 if mouse_y > @last_mouse_y
  315.      @number += n * place
  316.      refresh
  317.      @last_mouse_y = mouse_y
  318.    end
  319. end
  320. end
  321. class Scene_File
  322. if @self_alias == nil
  323.    alias self_update update
  324.    @self_alias = true
  325. end
  326. def update
  327.    mouse_x, mouse_y = Mouse.get_mouse_pos
  328.    Mouse.click_lock
  329.    idx = 0
  330.    for i in @savefile_windows
  331.      top_x = i.x + 16
  332.      top_y = i.y + 16
  333.      bottom_x = top_x + i.width
  334.      bottom_y = top_y + i.height
  335.      if (mouse_x > top_x) and (mouse_y > top_y) and
  336.         (mouse_x < bottom_x) and (mouse_y < bottom_y)
  337.        i.selected = true
  338.        if @file_index != idx  
  339.          @file_index = idx
  340.          $game_system.se_play($data_system.cursor_se)
  341.        end            
  342.        Mouse.click_unlock
  343.      else
  344.        i.selected = false
  345.      end
  346.      idx += 1
  347.    end
  348.    self_update
  349. end
  350. end
  351. class Arrow_Enemy
  352. if @self_alias == nil
  353.    alias self_update update
  354.    @self_alias = true
  355. end
  356. def update
  357.    mouse_x, mouse_y = Mouse.get_mouse_pos
  358.    idx = 0
  359.    for i in $game_troop.enemies do
  360.      if i.exist?
  361.        top_x = i.screen_x - self.ox
  362.        top_y = i.screen_y - self.oy
  363.        bottom_x = top_x + self.src_rect.width
  364.        bottom_y = top_y + self.src_rect.height
  365.        if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
  366.           (mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
  367.          if @index != idx
  368.            $game_system.se_play($data_system.cursor_se)
  369.            @index = idx
  370.          end
  371.        end
  372.      end
  373.      idx += 1
  374.    end
  375.    self_update
  376. end
  377. end
  378. class Arrow_Actor
  379. if @self_alias == nil
  380.    alias self_update update
  381.    @self_alias = true
  382. end
  383. def update
  384.    mouse_x, mouse_y = Mouse.get_mouse_pos
  385.    idx = 0
  386.    for i in $game_party.actors do
  387.      if i.exist?
  388.        top_x = i.screen_x - self.ox
  389.        top_y = i.screen_y - self.oy
  390.        bottom_x = top_x + self.src_rect.width
  391.        bottom_y = top_y + self.src_rect.height
  392.        if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
  393.           (mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
  394.          if @index != idx
  395.            $game_system.se_play($data_system.cursor_se)
  396.            @index = idx
  397.          end
  398.        end
  399.      end
  400.      idx += 1
  401.    end
  402.    self_update
  403. end
  404. end
  405. class Game_Player
  406. if @self_alias == nil
  407.    alias self_update update
  408.    @self_alias = true
  409. end
  410. def update
  411.    mouse_x, mouse_y = Mouse.get_mouse_pos
  412.    if Mouse.trigger?(Mouse::LEFT)
  413.      unless $game_system.map_interpreter.running? or
  414.             @move_route_forcing or $game_temp.message_window_showing
  415.        @mouse_sta = 1
  416.        trg_x = (mouse_x + $game_map.display_x / 4) / 32
  417.        trg_y = (mouse_y + $game_map.display_y / 4) / 32
  418.        find_path = Find_Path.new
  419.        @paths = find_path.find_player_short_path(trg_x, trg_y)
  420.        @paths_id = 0
  421.      end
  422.    end
  423.    if @mouse_sta != nil and @mouse_sta == 1
  424.      unless moving? or $game_system.map_interpreter.running? or
  425.             @move_route_forcing or $game_temp.message_window_showing
  426.        if @paths_id != nil and @paths != nil and @paths_id <= @paths.size
  427.          case @paths[@paths_id]
  428.          when 6
  429.            @last_move_x = true
  430.            move_right
  431.            @paths_id += 1
  432.            @direction = 6
  433.          when 4
  434.            @last_move_x = true
  435.            move_left
  436.            @paths_id += 1
  437.            @direction = 4
  438.          when 2
  439.            @last_move_x = false
  440.            move_down
  441.            @direction = 2
  442.            @paths_id += 1
  443.          when 8
  444.            @last_move_x = false
  445.            move_up
  446.            @direction = 8
  447.            @paths_id += 1
  448.             
  449.          when 1
  450.            @last_move_x = false
  451.            move_lower_left
  452.            @direction = 1
  453.            @paths_id += 1
  454.          when 3
  455.            @last_move_x = false
  456.            move_lower_right
  457.            @direction = 3
  458.            @paths_id += 1
  459.          when 7
  460.            @last_move_x = false
  461.            move_upper_left
  462.            @direction = 7
  463.            @paths_id += 1
  464.          when 9
  465.            @last_move_x = false
  466.            move_upper_right
  467.            @direction = 9
  468.            @paths_id += 1
  469.          end
  470.        else
  471.          @mouse_sta = 0
  472.        end
  473.      end
  474.    end
  475.    self_update
  476. end
  477. end
  478. Mouse.init
  479. END { Mouse.exit }

复制代码
我这次先发给您。

记住,提问区发“求XXX脚本”是违反版规的。
如果需要脚本请到http://www.66rpg.com/搜索
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-1-10 02:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表