Project1

标题: 关于对话框的未定义方法 [打印本页]

作者: 224xyz    时间: 2013-11-1 13:50
标题: 关于对话框的未定义方法
本帖最后由 224xyz 于 2013-11-1 13:50 编辑

之前在资源区里找到了一个对话框得脚本
但近来使用的时候经常出现错误未定义方法

特别是当对话在狭小的空间里 (通常是当对话出现在角色的头顶而且是在地图的边缘), 或者是在一大段自动据情之后再跟其他角色对话就会出现这个错误
请各位指导指导, 感谢

此为现在在用的对话框脚本, 把它代替了原本的Window_Message
  1. #从此精简版本中去除的标记:
  2. # \. :停顿一刹那(1、2帧)
  3. # \| :停顿片刻(20帧)
  4. # \> :文字不用打字方式
  5. # \< :文字使用打字方式
  6. # \! :等待玩家按回车再继续
  7. # \~ :文字直接消失
  8. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  9. #新增的标记:
  10. # \d[4]:空4个字节(2个汉字)的位置
  11. # \t: 显示游戏时间窗口
  12. # \v[7]:显示7号变量的值
  13. # \v[a7]:显示7号防具的名称
  14. # \v[s7]:显示7号特技的名称
  15. # \v[w7]:显示7号武器的名称
  16. # \v[i7]:显示7号道具的名称
  17. # \A:头像及姓名框靠左排列
  18. # \a:头像及姓名框靠右排列
  19. # \u[rrggbb]:直接以RGB值十六进制指定颜色

  20. #强化功能的标记:
  21. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  22. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  23. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  24. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  25. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  26. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果
  27. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  28. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框 ----不知道有多少人盼这个功能盼了多久了呵呵

  29. #下面是脚本:

  30. #——说明

  31. # 其他在对话中可以使用的功能:

  32. # \n[1]:显示1号角色的姓名

  33. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  34. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框

  35. # \p[1]:对话框出现在1号事件的上方
  36. # \p[0]:主人公上方出现对话框
  37. #——————————————————使用\p功能后可以自动调整对话框大小

  38. # \\:显示"\"这个符号

  39. # \c[0-7]:更改颜色

  40. # \u[rrggbb]:直接以十六进制指定颜色,注意这里会把透明度重设为255

  41. # \g:显示金钱窗口

  42. # \t: 显示游戏时间窗口

  43. # \I :下一行从这个位置开始

  44. # \o[123]:文字透明度改为123,模拟将死之人(汗)

  45. # \h[12]:改用12号字

  46. # \b[50]:空50象素

  47. # \d[4]:空4个字节(2个汉字)的位置

  48. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  49. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  50. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  51. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  52. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  53. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果

  54. # \Lk:清除左边的图像
  55. # \Rk:清除右边的图像

  56. # \v[7]:显示7号变量的值
  57. # \v[a7]:显示7号防具的名称
  58. # \v[s7]:显示7号特技的名称
  59. # \v[w7]:显示7号武器的名称
  60. # \v[i7]:显示7号道具的名称

  61. # \A:头像及姓名框靠左排列
  62. # \a:头像及姓名框靠右排列

  63. #==============================================================================
  64. # ■ Window_Message
  65. #------------------------------------------------------------------------------
  66. class Window_Message < Window_Selectable
  67. #--------------------------------------------------------------------------
  68. # ● 初始化状态
  69. #--------------------------------------------------------------------------
  70. def initialize
  71. super(80, 304, 480, 160)
  72. self.contents = Bitmap.new(width - 32, height - 32)
  73. self.visible = false
  74. self.z = 9998
  75. @fade_in = false
  76. @fade_out = false
  77. @contents_showing = false
  78. @cursor_width = 0
  79. self.active = false
  80. self.index = -1
  81. @popchar = -2
  82. @alignment = true
  83. end
  84. #--------------------------------------------------------------------------
  85. # ● 释放
  86. #--------------------------------------------------------------------------
  87. def dispose
  88. terminate_message
  89. $game_temp.message_window_showing = false
  90. if @input_number_window != nil
  91. @input_number_window.dispose
  92. end
  93. super
  94. end
  95. #--------------------------------------------------------------------------
  96. # ● 处理信息结束
  97. #--------------------------------------------------------------------------
  98. def terminate_message
  99. self.active = false
  100. self.pause = false
  101. self.index = -1
  102. self.contents.clear
  103. # 清除显示中标志
  104. @contents_showing = false
  105. # 呼叫信息调用
  106. if $game_temp.message_proc != nil
  107. $game_temp.message_proc.call
  108. end
  109. # 清除文章、选择项、输入数值的相关变量
  110. $game_temp.message_text = nil
  111. $game_temp.message_proc = nil
  112. $game_temp.choice_start = 99
  113. $game_temp.choice_max = 0
  114. $game_temp.choice_cancel_type = 0
  115. $game_temp.choice_proc = nil
  116. $game_temp.num_input_start = 99
  117. $game_temp.num_input_variable_id = 0
  118. $game_temp.num_input_digits_max = 0
  119. # 开放金钱窗口
  120. if @gold_window != nil
  121. @gold_window.dispose
  122. @gold_window = nil
  123. end
  124. # 开放时间窗口
  125. if @playtime_window != nil
  126. @playtime_window.dispose
  127. @playtime_window = nil
  128. end
  129. # 开放姓名窗口
  130. if @name_window != nil
  131. @name_window.dispose
  132. @name_window = nil
  133. end
  134. if @name_airtext != nil
  135. @name_airtext.dispose
  136. @name_airtext = nil
  137. end
  138. # 开放角色图片
  139. if @right_picture != nil and @right_keep == true
  140. @right_picture.dispose
  141. end
  142. if @left_picture != nil and @left_keep == true
  143. @left_picture.dispose
  144. end
  145. @face_bitmap = nil
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● 刷新
  149. #--------------------------------------------------------------------------
  150. def refresh
  151. # 初期化
  152. self.contents.clear
  153. self.contents.font.color = normal_color
  154. self.contents.font.size = Font.default_size
  155. x = y = max_x = max_y = @indent = lines = 0
  156. @left_keep = @right_keep = false
  157. @face_indent = 0
  158. [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  159. @cursor_width = 0
  160. face = nil
  161. if $game_temp.choice_start == 0
  162. x = 8
  163. end
  164. if $game_temp.message_text != nil
  165. text = $game_temp.message_text
  166. #——对齐设置
  167. if (/\\([Aa])/.match(text))!=nil then
  168. if $1 == "A"
  169. @alignment = true
  170. else
  171. @alignment = false
  172. end
  173. text.gsub!(/\\([Aa])/) { "" }
  174. end
  175. #——头像设置
  176. if (/\\([Ff])\[(.+?)\]/.match(text))!=nil then
  177. face = "66rpg_" + $2 + "_f.png"
  178. if $1 == "f" and $game_actors[$2.to_i] != nil
  179. face = $game_actors[$2.to_i].battler_name + "_f.png"
  180. end
  181. if FileTest.exist?("Graphics/Pictures/#{face}")
  182. @face_bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  183. if @alignment
  184. x = @face_indent = 128
  185. self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  186. else
  187. self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  188. Rect.new(0, 0, 96, 96))
  189. end
  190. else
  191. face = nil
  192. @face_bitmap = nil
  193. end
  194. text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  195. end
  196. #——左半身像设置
  197. if (/\\([Ll])\[(.+?)\]/.match(text))!=nil then
  198. face = "66rpg_" + $2 + "_h.png"
  199. if $1 == "l" and $game_actors[$2.to_i] != nil
  200. face = $game_actors[$2.to_i].battler_name + "_h.png"
  201. end
  202. if $加密 == true
  203. if @left_picture != nil
  204. @left_picture.dispose
  205. end
  206. @left_picture = Sprite.new
  207. @left_picture.bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  208. @left_picture.y = 480-@left_picture.bitmap.height
  209. @left_picture.x = 0
  210. @left_picture.mirror = true
  211. text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  212. else
  213. if FileTest.exist?("Graphics/Pictures/#{face}")
  214. if @left_picture != nil
  215. @left_picture.dispose
  216. end
  217. @left_picture = Sprite.new
  218. @left_picture.bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  219. @left_picture.y = 480-@left_picture.bitmap.height
  220. @left_picture.x = 0
  221. @left_picture.mirror = true
  222. text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  223. end
  224. end
  225. end
  226. #——右半身像设置
  227. if (/\\([Rr])\[(.+?)\]/.match(text))!=nil then
  228. face = "66rpg_" + $2 + "_h.png"
  229. if $1 == "r" and $game_actors[$2.to_i] != nil
  230. face = $game_actors[$2.to_i].battler_name + "_h.png"
  231. end
  232. if $加密 == true
  233. if @right_picture != nil
  234. @right_picture.dispose
  235. end
  236. @right_picture = Sprite.new
  237. @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  238. @right_picture.y = 480-@right_picture.bitmap.height
  239. @right_picture.x = 640-@right_picture.bitmap.width
  240. text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  241. else
  242. if FileTest.exist?("Graphics/battlers/#{face}")
  243. if @right_picture != nil
  244. @right_picture.dispose
  245. end
  246. @right_picture = Sprite.new
  247. @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  248. @right_picture.y = 480-@right_picture.bitmap.height
  249. @right_picture.x = 640-@right_picture.bitmap.width
  250. text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  251. end
  252. end
  253. end
  254. if (/\\[Rr]k/.match(text)) != nil
  255. @right_keep = true
  256. text.sub!(/\\[Rr]k/) { "" }
  257. end
  258. if (/\\[Ll]k/.match(text)) != nil
  259. @left_keep = true
  260. text.sub!(/\\[Ll]k/) { "" }
  261. end
  262. # 替换人物姓名
  263. text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  264. $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  265. end
  266. # 显示人物姓名
  267. name_window_set = false
  268. if (/\\[Mm]([0-9]*?)\[(.+?)\]/.match(text)) != nil
  269. name_window_set = true
  270. if $1 == ""
  271. color = 0
  272. else
  273. color = $1.to_i
  274. end
  275. if color >= 0 and color <= 7
  276. name_color = color
  277. end
  278. name_text = $2
  279. text.sub!(/\\[Mm]([0-9]*?)\[(.*?)\]/) { "" }
  280. end
  281. # 文字位置的判定
  282. if (/\\[Pp]\[([-1,0-9]+)\]/.match(text))!=nil then
  283. @popchar = $1.to_i
  284. if @popchar == -1
  285. x = @indent = 48
  286. y = 4
  287. end
  288. text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  289. end
  290. # 开始
  291. begin
  292. last_text = text.clone
  293. text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  294. end until text == last_text
  295. text.gsub!(/\\\\/) { "\000" }
  296. text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  297. text.gsub!(/\\[Gg]/) { "\002" }
  298. text.gsub!(/\\[Tt]/) { "\003" }
  299. text.gsub!(/\\[Uu]\[([0-9A-Fa-f]{6})\]/) { "\004[#{$1}]" }
  300. text.gsub!(/\\[Ii]/) { "\023" }
  301. text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  302. text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  303. text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  304. text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  305. if @popchar >= 0
  306. max_x = 0
  307. max_y = 4
  308. for i in 0..3
  309. line = text.split(/\n/)[3-i]
  310. max_y -= 1 if line == nil and max_y <= 4-i
  311. next if line == nil
  312. cx = contents.text_size(line).width
  313. max_x = cx if cx > max_x
  314. end
  315. self.width = max_x + 48 + @face_indent
  316. self.height = (max_y - 1) * 32 + 64
  317. else
  318. max_x = self.width - 32 - @face_indent
  319. end
  320. reset_window
  321. if name_window_set
  322. w = self.contents.text_size(name_text).width + 16
  323. xn = @alignment ? self.x : self.x + self.width - w
  324. yn = self.y >= 40 ? self.y - 40 : self.y + self.height
  325. @name_window = Window_Name.new(xn, yn, w)
  326. @name_window.z = self.z + 1
  327. @name_airtext = Window_AirText.new(xn + 8, yn + 8, name_text, name_color)
  328. @name_airtext.z = self.z + 2
  329. end
  330. while ((c = text.slice!(/./m)) != nil)
  331. if c == "\000"
  332. c = "\\"
  333. end
  334. if c == "\001"
  335. text.sub!(/\[([0-9]+)\]/, "")
  336. color = $1.to_i
  337. if color >= 0 and color <= 7
  338. self.contents.font.color = text_color(color)
  339. end
  340. next
  341. end
  342. if c == "\002"
  343. if @gold_window == nil and @popchar <= 0
  344. @gold_window = Window_Gold.new
  345. @gold_window.x = 560 - @gold_window.width
  346. if $game_temp.in_battle
  347. @gold_window.y = 192
  348. else
  349. @gold_window.y = self.y >= 128 ? 32 : 384
  350. end
  351. @gold_window.opacity = self.opacity
  352. @gold_window.back_opacity = self.back_opacity
  353. end
  354. next
  355. end
  356. if c == "\003"
  357. if @playtime_window == nil and @popchar <=0
  358. @playtime_window = Window_PlayTime.new
  359. @playtime_window.x = 80
  360. if $game_temp.in_battle
  361. @playtime_window.y = 192
  362. else
  363. @playtime_window.y = self.y >= 128 ? 32 : 384
  364. end
  365. @playtime_window.opacity = self.opacity
  366. @playtime_window.back_opacity = self.back_opacity
  367. end
  368. end
  369. if c == "\004"
  370. text.sub!(/\[([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\]/, "")
  371. self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)
  372. next
  373. end
  374. if c == "\023"
  375. @indent = x
  376. next
  377. end
  378. if c == "\024"
  379. text.sub!(/\[([0-9]+)\]/, "")
  380. self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  381. next
  382. end
  383. if c == "\025"
  384. text.sub!(/\[([0-9]+)\]/, "")
  385. self.contents.font.size = [[$1.to_i, 6].max, 32].min
  386. next
  387. end
  388. if c == "\026"
  389. text.sub!(/\[([0-9]+)\]/, "")
  390. x += $1.to_i
  391. next
  392. end
  393. if c == "\027"
  394. text.sub!(/\[([0-9]+)\]/, "")
  395. x += $1.to_i * self.contents.font.size / 2
  396. next
  397. end
  398. if c == "\030"
  399. text.sub!(/\[(.*?)\]/, "")
  400. self.contents.blt(x , y * line_height + 4, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  401. x += 24
  402. next
  403. end
  404. if c == "\n"
  405. if lines >= $game_temp.choice_start
  406. @cursor_width = [@cursor_width, max_x - @face_indent].max
  407. end
  408. lines += 1
  409. y += 1
  410. x = 0 + @indent + @face_indent
  411. if lines >= $game_temp.choice_start
  412. x = 8 + @indent + @face_indent
  413. end
  414. next
  415. end
  416. # 描绘文字
  417. self.contents.draw_text(x, line_height * y, 40, 32, c)
  418. # x 为要描绘文字的加法运算
  419. x += self.contents.text_size(c).width
  420. end
  421. end
  422. if $game_temp.choice_max > 0
  423. @item_max = $game_temp.choice_max
  424. self.active = true
  425. self.index = 0
  426. end
  427. if $game_temp.num_input_variable_id > 0
  428. digits_max = $game_temp.num_input_digits_max
  429. number = $game_variables[$game_temp.num_input_variable_id]
  430. @input_number_window = Window_InputNumber.new(digits_max)
  431. @input_number_window.number = number
  432. @input_number_window.x = self.x + 8
  433. @input_number_window.y = self.y + $game_temp.num_input_start * 32
  434. end
  435. end
  436. #--------------------------------------------------------------------------
  437. # ● 更新
  438. #--------------------------------------------------------------------------
  439. def update
  440. super
  441. # 渐变的情况下
  442. if @fade_in
  443. self.contents_opacity += 24
  444. if @input_number_window != nil
  445. @input_number_window.contents_opacity += 24
  446. end
  447. if self.contents_opacity == 255
  448. @fade_in = false
  449. end
  450. return
  451. end
  452. # 输入数值的情况下
  453. if @input_number_window != nil
  454. @input_number_window.update
  455. # 确定
  456. if Input.trigger?(Input::C)
  457. $game_system.se_play($data_system.decision_se)
  458. $game_variables[$game_temp.num_input_variable_id] =
  459. @input_number_window.number
  460. $game_map.need_refresh = true
  461. # 释放输入数值窗口
  462. @input_number_window.dispose
  463. @input_number_window = nil
  464. terminate_message
  465. end
  466. return
  467. end
  468. # 显示信息中的情况下
  469. if @contents_showing
  470. # 如果不是在显示选择项中就显示暂停标志
  471. if $game_temp.choice_max == 0
  472. self.pause = true
  473. end
  474. # 取消
  475. if Input.trigger?(Input::B)
  476. if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  477. $game_system.se_play($data_system.cancel_se)
  478. $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  479. terminate_message
  480. end
  481. end
  482. # 确定
  483. if Input.trigger?(Input::C)
  484. if $game_temp.choice_max > 0
  485. $game_system.se_play($data_system.decision_se)
  486. $game_temp.choice_proc.call(self.index)
  487. end
  488. terminate_message
  489. end
  490. return
  491. end
  492. # 在渐变以外的状态下有等待显示的信息与选择项的场合
  493. if @fade_out == false and $game_temp.message_text != nil
  494. @contents_showing = true
  495. $game_temp.message_window_showing = true
  496. reset_window
  497. refresh
  498. Graphics.frame_reset
  499. self.visible = true
  500. self.contents_opacity = 0
  501. if @input_number_window != nil
  502. @input_number_window.contents_opacity = 0
  503. end
  504. @fade_in = true
  505. return
  506. end
  507. # 没有可以显示的信息、但是窗口为可见的情况下
  508. if self.visible
  509. @fade_out = true
  510. self.opacity -= 48
  511. if self.opacity == 0
  512. self.visible = false
  513. @fade_out = false
  514. $game_temp.message_window_showing = false
  515. end
  516. return
  517. end
  518. end
  519. #--------------------------------------------------------------------------
  520. # ● 获得字符
  521. #--------------------------------------------------------------------------
  522. def get_character(parameter)
  523. case parameter
  524. when 0
  525. return $game_player
  526. else
  527. events = $game_map.events
  528. return events == nil ? nil : events[parameter]
  529. end
  530. end
  531. #--------------------------------------------------------------------------
  532. # ● 设置窗口位置与不透明度
  533. #--------------------------------------------------------------------------
  534. def reset_window
  535. # 判定
  536. if @popchar >= 0
  537. events = $game_map.events
  538. if events != nil
  539. character = get_character(@popchar)
  540. x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  541. y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  542. self.x = x
  543. self.y = y
  544. end
  545. elsif @popchar == -1
  546. self.x = -4
  547. self.y = -4
  548. self.width = 648
  549. self.height = 488
  550. else
  551. if $game_temp.in_battle
  552. self.y = 16
  553. else
  554. case $game_system.message_position
  555. when 0 # 上
  556. self.y = 16
  557. when 1 # 中
  558. self.y = 160
  559. when 2 # 下
  560. self.y = 304
  561. end
  562. self.x = 80
  563. if @face_bitmap == nil
  564. self.width = 480
  565. else
  566. self.width = 600
  567. self.x -= 60
  568. end
  569. self.height = 160
  570. end
  571. end
  572. self.contents = Bitmap.new(self.width - 32, self.height - 32)
  573. if @face_bitmap != nil
  574. if @alignment
  575. self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  576. else
  577. self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  578. Rect.new(0, 0, 96, 96))
  579. end
  580. end
  581. if @popchar == -1
  582. self.opacity = 255
  583. self.back_opacity = 0
  584. elsif $game_system.message_frame == 0
  585. self.opacity = 255
  586. self.back_opacity = 200
  587. else
  588. self.opacity = 0
  589. self.back_opacity = 200
  590. end
  591. end
  592. #--------------------------------------------------------------------------
  593. # ● line_height
  594. #--------------------------------------------------------------------------
  595. # 返回値:行高
  596. #--------------------------------------------------------------------------
  597. def line_height
  598. if self.contents.font.size >= 20 and self.contents.font.size <= 24
  599. return 32
  600. else
  601. return self.contents.font.size * 15 / 10
  602. end
  603. end
  604. #--------------------------------------------------------------------------
  605. # ● \V 变换
  606. #--------------------------------------------------------------------------
  607. def convart_value(option, index)
  608. option == nil ? option = "" : nil
  609. option.downcase!
  610. case option
  611. when "i"
  612. unless $data_items[index].name == nil
  613. r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  614. end
  615. when "w"
  616. unless $data_weapons[index].name == nil
  617. r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  618. end
  619. when "a"
  620. unless $data_armors[index].name == nil
  621. r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  622. end
  623. when "s"
  624. unless $data_skills[index].name == nil
  625. r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  626. end
  627. else
  628. r = $game_variables[index]
  629. end
  630. r == nil ? r = "" : nil
  631. return r
  632. end
  633. #--------------------------------------------------------------------------
  634. # ● 矩形更新
  635. #--------------------------------------------------------------------------
  636. def update_cursor_rect
  637. if [url=home.php?mod=space&uid=370741]@Index[/url] >= 0
  638. n = $game_temp.choice_start + @index
  639. self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  640. else
  641. self.cursor_rect.empty
  642. end
  643. end
  644. end
  645. #==============================================================================
  646. # ■ Window_Name
  647. #------------------------------------------------------------------------------
  648. #  显示对话人姓名的窗口。
  649. #==============================================================================

  650. class Window_Name < Window_Base
  651. #--------------------------------------------------------------------------
  652. # ● 初始化窗口
  653. #--------------------------------------------------------------------------
  654. def initialize(x, y, width)
  655. super(x, y, width, 40)
  656. self.contents = nil
  657. self.back_opacity = 160
  658. end
  659. end

  660. #==============================================================================
  661. # ■ Window_AirText
  662. #------------------------------------------------------------------------------
  663. #  显示对话人姓名的文字。
  664. #==============================================================================

  665. class Window_AirText < Window_Base
  666. #--------------------------------------------------------------------------
  667. # ● 初始化窗口
  668. #--------------------------------------------------------------------------
  669. def initialize(x, y, designate_text, color)
  670. super(x-16, y-16, 32 + designate_text.size * 12, 56)
  671. self.opacity = 0
  672. self.back_opacity = 0
  673. self.contents = Bitmap.new(self.width - 32, self.height - 32)
  674. w = self.contents.width
  675. h = self.contents.height
  676. self.contents.font.color = text_color(color)
  677. self.contents.draw_text(0, 0, w, h, designate_text)
  678. end
  679. end
复制代码

作者: 过眼云烟    时间: 2013-11-1 14:10
很简单,\p[i],那个编号为i的npc不存在
作者: 224xyz    时间: 2013-11-1 14:37
过眼云烟 发表于 2013-11-1 14:10
很简单,\p,那个编号为i的npc不存在

但是我已经检查过了, \p那个编号为i的NPC是存在的
跟他对话也是有机会出现未定义的错误
比如说我跟这个NPC谈话, 就有机会出现错误


话的内容如下


语法打成:
\p[1][老闆]
有些什麼想要?
作者: 224xyz    时间: 2013-11-2 20:58
还有一个问题, 如果我想把对话框还原成正常的一样 (就是对话框在画面的下面,而不是在角色的上方), 我应该打甚麻语法?
我现在打成 \p[-2] ,

559-562行写:

if @popchar >=0
events = $game_map.events
if events != nil
character = get_character(@popchar)

接着第563行就发生错误了。
但其实这个脚本好像没有说怎样写
那这个会不会做成未定义方法的错误?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1