Project1

标题: 解释器问题太难了 [打印本页]

作者: kvkv97    时间: 2015-8-15 15:17
标题: 解释器问题太难了

  1. 1, Game_Event类里面@list = @page.list,@page是类变量,没赋值不能用, 查了@page,在上面有@page = new_page,可是new_page就不知道它在什么地方被赋值了?
  2. 2,Game_Event类里面
  3.   def update
  4.     super
  5.     # 自动启动事件判定
  6.     check_event_trigger_auto
  7.     # 并行处理有效的情况下
  8.     if @interpreter != nil
  9.       # 不在执行中的场合的情况下
  10.       unless @interpreter.running?
  11.         # 设置事件
  12.         @interpreter.setup(@list, @event.id)
  13.       end
  14.       # 更新解释器
  15.       @interpreter.update
  16.     end
  17.   end
复制代码
问题:@interpreter是类变量,可是找不到它在什么地方被赋值了?

  1. 3,在clss Interpreter的“显示文章”中:
  2. $game_temp.message_text = @list[@index].parameters[0] + "\n"
复制代码
问题:@list是方法setup(list, event_id)被传递进来的参数list,不知道它是从哪里传递进来的,能否给我指出?
问题:@list[]是数组,@index是什么意思?parameters[0]中的0又是什么意思?

作者: 汪汪    时间: 2015-8-15 15:55
本帖最后由 汪汪 于 2015-8-15 15:57 编辑

使用全局搜索。如果还找不到看说明书。大概是说明书里的地图事件页里
作者: 芯☆淡茹水    时间: 2015-8-15 17:19
new_page  你就不会用搜索么?
如果事件页启动条件达成,设置新的页数为当前达成条件的页数。
  1. # 设置本地变量 new_page
  2. new_page = page
复制代码
@interpreter 同样是搜索
  1. # 目标是 [并行处理] 的情况下
  2. if @trigger == 4
  3.   # 生成并行处理用解释器
  4.   @interpreter = Interpreter.new
  5. end
复制代码
貌似这个解释器只管并行处理,其它条件触发用的是地图场景或战斗场景解释器。

list 在 Interpreter 的 设置启动中事件 def setup_starting_event 里面有传递:
  1. # 循环 (地图事件)
  2.     for event in $game_map.events.values
  3.       # 如果找到了启动中的事件
  4.       if event.starting
  5.         # 如果不是自动执行
  6.         if event.trigger < 3
  7.           # 清除启动中标志
  8.           event.clear_starting
  9.           # 锁定
  10.           event.lock
  11.         end
  12.         # 设置事件
  13.         setup(event.list, event.id)
  14.         return
  15.       end
  16.     end
复制代码
@index 是事件内容 @list 的索引 ,执行完一项内容后, @index += 1 ,依此来判断事件内容执行到什么地方了。
parameters[0] 中的 0 同样是索引。事件编辑时的各种输入框里的内容,依顺序保存在对应的 parameters 数组里,
使用时按照索引调用相应的内容。
作者: 芯☆淡茹水    时间: 2015-8-15 20:06
至于事件页的模块,那就只能看F1里的 RPG数据结构 了
比如 事件->事件页
  1. module RPG
  2.   class Event
  3.     class Page
  4.       def initialize
  5.         @condition = RPG::Event::Page::Condition.new
  6.         @graphic = RPG::Event::Page::Graphic.new
  7.         @move_type = 0
  8.         @move_speed = 3
  9.         @move_frequency = 3
  10.         @move_route = RPG::MoveRoute.new
  11.         @walk_anime = true
  12.         @step_anime = false
  13.         @direction_fix = false
  14.         @through = false
  15.         @always_on_top = false
  16.         @trigger = 0
  17.         @list = [RPG::EventCommand.new]
  18.       end
  19.       attr_accessor :condition
  20.       attr_accessor :graphic
  21.       attr_accessor :move_type
  22.       attr_accessor :move_speed
  23.       attr_accessor :move_frequency
  24.       attr_accessor :move_route
  25.       attr_accessor :walk_anime
  26.       attr_accessor :step_anime
  27.       attr_accessor :direction_fix
  28.       attr_accessor :through
  29.       attr_accessor :always_on_top
  30.       attr_accessor :trigger
  31.       attr_accessor :list
  32.     end
  33.   end
  34. end
复制代码





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