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

Project1

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

[已经过期] 谁能帮我把这个鼠标脚本的鼠标行走功能去掉?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
86 小时
注册时间
2013-3-23
帖子
40
跳转到指定楼层
1
发表于 2013-8-3 21:35:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 zyl147852 于 2013-8-3 21:37 编辑

也就是让鼠标点击地图也不会移动了。
脚本:
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  5. $敌人选框扩大 = 30
  6. $角色选框扩大 = 20


  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. @show_cursor = false

  28. @mouse_sprite = Sprite.new
  29. @mouse_sprite.z = 99999
  30. @mouse_sprite.bitmap = Bitmap.new('Graphics/System/Pointer')
  31. #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))

  32. @left_press = false
  33. @right_press = false
  34. @left_trigger = false
  35. @right_trigger = false
  36. @left_repeat = false
  37. @right_repeat = false
  38. @click_lock = false

  39. update
  40. end
  41. def self.exit
  42. @mouse_sprite.bitmap.dispose
  43. @mouse_sprite.dispose
  44. @show_cursor = true
  45. # $HookEnd.call
  46. $ShowCursor.call(1)
  47. end
  48. def self.mouse_debug
  49. return @mouse_debug.bitmap
  50. end
  51. def self.update
  52. left_down = $GetKeyState.call(0x01)
  53. right_down = $GetKeyState.call(0x02)

  54. @click_lock = false
  55. mouse_x, mouse_y = self.get_mouse_pos
  56. if @mouse_sprite != nil
  57. @mouse_sprite.x = mouse_x
  58. @mouse_sprite.y = mouse_y
  59. end
  60. if left_down[7] == 1
  61. @left_repeat = (not @left_repeat)
  62. @left_trigger = (not @left_press)
  63. @left_press = true
  64. else
  65. @left_press = false
  66. @left_trigger = false
  67. @left_repeat = false
  68. end
  69. if right_down[7] == 1
  70. @right_repeat = (not @right_repeat)
  71. @right_trigger = (not @right_press)
  72. @right_press = true
  73. else
  74. @right_press = false
  75. @right_trigger = false
  76. @right_repeat = false
  77. end
  78. end
  79. def self.get_mouse_pos
  80. point_var = [0, 0].pack('ll')
  81. if $GetCursorPos.call(point_var) != 0
  82. if $ScreenToClient.call($Window_HWND, point_var) != 0
  83. x, y = point_var.unpack('ll')
  84. if (x < 0) or (x > 10000) then x = 0 end
  85. if (y < 0) or (y > 10000) then y = 0 end
  86. if x > Graphics.width then x = Graphics.width end
  87. if y > Graphics.height then y = Graphics.height end
  88. return x, y
  89. else
  90. return 0, 0
  91. end
  92. else
  93. return 0, 0
  94. end
  95. end
  96. def self.press?(mouse_code)
  97. if mouse_code == LEFT
  98. if @click_lock
  99. return false
  100. else
  101. return @left_press
  102. end
  103. elsif mouse_code == RIGHT
  104. return @right_press
  105. else
  106. return false
  107. end
  108. end
  109. def self.trigger?(mouse_code)
  110. if mouse_code == LEFT
  111. if @click_lock
  112. return false
  113. else
  114. return @left_trigger
  115. end
  116. elsif mouse_code == RIGHT
  117. return @right_trigger
  118. else
  119. return false
  120. end
  121. end
  122. def self.repeat?(mouse_code)
  123. if mouse_code == LEFT
  124. if @click_lock
  125. return false
  126. else
  127. return @left_repeat
  128. end
  129. elsif mouse_code == RIGHT
  130. return @right_repeat
  131. else
  132. return false
  133. end
  134. end
  135. def self.click_lock?
  136. return @click_lock
  137. end
  138. def self.click_lock
  139. @click_lock = true
  140. end
  141. def self.click_unlock
  142. @click_lock = false
  143. end
  144. end
  145. module Input
  146. if @self_update == nil
  147. @self_update = method('update')
  148. @self_press = method('press?')
  149. @self_trigger = method('trigger?')
  150. @self_repeat = method('repeat?')
  151. end
  152. def self.update
  153. @self_update.call
  154. Mouse.update
  155. end
  156. def self.press?(key_code)
  157. if @self_press.call(key_code)
  158. return true
  159. end
  160. if key_code == C
  161. return Mouse.press?(Mouse::LEFT)
  162. elsif key_code == B
  163. return Mouse.press?(Mouse::RIGHT)
  164. else
  165. return @self_press.call(key_code)
  166. end
  167. end
  168. def self.trigger?(key_code)
  169. if @self_trigger.call(key_code)
  170. return true
  171. end
  172. if key_code == C
  173. return Mouse.trigger?(Mouse::LEFT)
  174. elsif key_code == B
  175. return Mouse.trigger?(Mouse::RIGHT)
  176. else
  177. return @self_trigger.call(key_code)
  178. end
  179. end
  180. def self.repeat?(key_code)
  181. if @self_repeat.call(key_code)
  182. return true
  183. end
  184. if key_code == C
  185. return Mouse.repeat?(Mouse::LEFT)
  186. elsif key_code == B
  187. return Mouse.repeat?(Mouse::RIGHT)
  188. else
  189. return @self_repeat.call(key_code)
  190. end
  191. end
  192. end

  193. class Window_Selectable
  194. if @self_alias == nil
  195. alias self_update update
  196. @self_alias = true
  197. end
  198. def update
  199. #self.cursor_rect.empty
  200. self_update
  201. if self.active and item_max > 0
  202. index_var = @index
  203. tp_index = @index
  204. mouse_x, mouse_y = Mouse.get_mouse_pos
  205. mouse_not_in_rect = true
  206. for i in 0...item_max
  207. [url=home.php?mod=space&uid=370741]@Index[/url] = i
  208. update_cursor
  209. top_x = self.cursor_rect.x + self.x + 16
  210. top_y = self.cursor_rect.y + self.y + 16
  211. bottom_x = top_x + self.cursor_rect.width
  212. bottom_y = top_y + self.cursor_rect.height

  213. top_x += self.x_mod
  214. top_y += self.y_mod
  215. bottom_x += self.x_mod
  216. bottom_y += self.y_mod

  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. $data_system.sounds[0].play
  223. end
  224. break
  225. end
  226. end
  227. if Input.trigger?(Input::F9)
  228. p top_x,top_y,Mouse.get_mouse_pos
  229. end
  230. if mouse_not_in_rect
  231. @index = index_var
  232. update_cursor
  233. Mouse.click_lock
  234. else
  235. Mouse.click_unlock
  236. end
  237. end
  238. end
  239. end




  240. class Window_NameInput
  241. if @self_alias == nil
  242. alias self_update update
  243. @self_alias = true
  244. end
  245. def update
  246. #self.cursor_rect.empty
  247. self_update
  248. if self.active
  249. index_var = @index
  250. mouse_x, mouse_y = Mouse.get_mouse_pos
  251. mouse_not_in_rect = true
  252. for i in (0...HIRAGANA.size).to_a.push(180)
  253. @index = i
  254. update_cursor
  255. top_x = self.cursor_rect.x + self.x + 16
  256. top_y = self.cursor_rect.y + self.y + 16
  257. bottom_x = top_x + self.cursor_rect.width
  258. bottom_y = top_y + self.cursor_rect.height
  259. #
  260. if (mouse_x > top_x) and (mouse_y > top_y) and
  261. (mouse_x < bottom_x) and (mouse_y < bottom_y)
  262. mouse_not_in_rect = false
  263. break
  264. end
  265. end
  266. if mouse_not_in_rect
  267. @index = index_var
  268. update_cursor
  269. Mouse.click_lock
  270. else
  271. Mouse.click_unlock
  272. end
  273. end
  274. end
  275. end

  276. class Scene_File
  277. if @self_alias == nil
  278. alias self_update update
  279. @self_alias = true
  280. end
  281. def update
  282. mouse_x, mouse_y = Mouse.get_mouse_pos
  283. Mouse.click_lock
  284. idx = 0
  285. for i in @savefile_windows
  286. top_x = i.x + 16
  287. top_y = i.y + 16
  288. bottom_x = top_x + i.width
  289. bottom_y = top_y + i.height
  290. if (mouse_x > top_x) and (mouse_y > top_y) and
  291. (mouse_x < bottom_x) and (mouse_y < bottom_y)
  292. i.selected = true
  293. if @file_index != idx
  294. @file_index = idx
  295. $data_system.sounds[0].play
  296. end
  297. Mouse.click_unlock
  298. else
  299. i.selected = false
  300. end
  301. idx += 1
  302. end
  303. self_update
  304. end
  305. end

  306. class Game_Player
  307. if @self_alias == nil
  308. alias self_update update
  309. @self_alias = true
  310. end
  311. def update
  312. mouse_x, mouse_y = Mouse.get_mouse_pos
  313. if @last_move_x == nil
  314. @last_move_x = false
  315. end
  316. if Mouse.press?(Mouse::LEFT)
  317. last_moving = moving?
  318. last_direction = @direction
  319. unless moving? or $game_map.interpreter.running?
  320. last_x = @x
  321. if @last_move_x
  322. @last_move_x = false
  323. elsif mouse_x > screen_x + 16
  324. move_straight(6)
  325. elsif mouse_x < screen_x - 16
  326. move_straight(4)
  327. end
  328. last_y = @y
  329. if last_x != @x
  330. @last_move_x = true
  331. elsif mouse_y > screen_y
  332. move_straight(2)
  333. elsif mouse_y < screen_y - 32
  334. move_straight(8)
  335. end
  336. end
  337. end
  338. self_update
  339. end
  340. end

  341. Mouse.init
  342. END { Mouse.exit }


  343. class Window_Base < Window
  344. attr_accessor :x_mod
  345. attr_accessor :y_mod
  346. alias ka_initialize initialize
  347. def initialize(x, y, width, height)
  348. ka_initialize(x, y, width, height)
  349. self.x_mod = 0
  350. self.y_mod = 0
  351. end
  352. end
  353. class Window_PartyCommand < Window_Command

  354. alias ka1_initialize initialize
  355. def initialize
  356. ka1_initialize
  357. self.y_mod = Graphics.height-128
  358. end

  359. end
  360. class Window_ActorCommand < Window_Command

  361. alias ka2_initialize initialize
  362. def initialize
  363. ka2_initialize
  364. self.x_mod = -128
  365. self.y_mod = Graphics.height-128
  366. end

  367. end

  368. #==============================================================================
  369. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  370. #==============================================================================
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
46 小时
注册时间
2013-7-13
帖子
62
2
发表于 2013-8-4 08:58:12 | 只看该作者
删掉这个脚本。

点评

额······  发表于 2013-8-4 12:11
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-18 02:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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