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

Project1

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

[已经解决] 关于脚本SyntaxError

[复制链接]

Lv1.梦旅人

梦石
0
星屑
820
在线时间
8 小时
注册时间
2012-8-17
帖子
3
跳转到指定楼层
1
发表于 2012-8-17 23:55:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 hcm 于 2012-8-20 08:40 编辑

45度角战斗的脚本
Window_Base   里的
运行游戏时说这个脚本里的302行发生了SyntaxErro
我看了看302行就一个 end 啊= =   而且也么发现其它的问题了……到底是怎么回事……求高人解释
r
  1. #==============================================================================
  2. # ■ Window_Base
  3. #------------------------------------------------------------------------------
  4. #  游戏中全部窗口的超级类。
  5. #==============================================================================

  6. class Window_Base < Window
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     x      : 窗口的 X 坐标
  10.   #     y      : 窗口的 Y 坐标
  11.   #     width  : 窗口的宽
  12.   #     height : 窗口的宽
  13.   #--------------------------------------------------------------------------
  14.   def initialize(x, y, width, height)
  15.     super()
  16.     @windowskin_name = $game_system.windowskin_name
  17.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  18.     self.x = x
  19.     self.y = y
  20.     self.width = width
  21.     self.height = height
  22.     self.z = 100
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 释放
  26.   #--------------------------------------------------------------------------
  27.   def dispose
  28.     # 如果窗口的内容已经被设置就被释放
  29.     if self.contents != nil
  30.       self.contents.dispose
  31.     end
  32.     super
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 获取文字色
  36.   #     n : 文字色编号 (0~7)
  37.   #--------------------------------------------------------------------------
  38.   def text_color(n)
  39.     case n
  40.     when 0
  41.       return Color.new(255, 255, 255, 255)
  42.     when 1
  43.       return Color.new(128, 128, 255, 255)
  44.     when 2
  45.       return Color.new(255, 128, 128, 255)
  46.     when 3
  47.       return Color.new(128, 255, 128, 255)
  48.     when 4
  49.       return Color.new(128, 255, 255, 255)
  50.     when 5
  51.       return Color.new(255, 128, 255, 255)
  52.     when 6
  53.       return Color.new(255, 255, 128, 255)
  54.     when 7
  55.       return Color.new(192, 192, 192, 255)
  56.     else
  57.       normal_color
  58.     end
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 获取普通文字色
  62.   #--------------------------------------------------------------------------
  63.   def normal_color
  64.     return Color.new(255, 255, 255, 255)
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 获取无效文字色
  68.   #--------------------------------------------------------------------------
  69.   def disabled_color
  70.     return Color.new(255, 255, 255, 128)
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 获取系统文字色
  74.   #--------------------------------------------------------------------------
  75.   def system_color
  76.     return Color.new(192, 224, 255, 255)
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 获取危机文字色
  80.   #--------------------------------------------------------------------------
  81.   def crisis_color
  82.     return Color.new(255, 255, 64, 255)
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取战斗不能文字色
  86.   #--------------------------------------------------------------------------
  87.   def knockout_color
  88.     return Color.new(255, 64, 0)
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 刷新画面
  92.   #--------------------------------------------------------------------------
  93.   def update
  94.     super
  95.     # 如果窗口的外观被变更了、再设置
  96.     if $game_system.windowskin_name != @windowskin_name
  97.       @windowskin_name = $game_system.windowskin_name
  98.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  99.     end
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 图形的描绘
  103.   #     actor : 角色
  104.   #     x     : 描画目标 X 坐标
  105.   #     y     : 描画目标 Y 坐标
  106.   #--------------------------------------------------------------------------
  107.   def draw_actor_graphic(actor, x, y)
  108.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  109.     cw = bitmap.width / 4
  110.     ch = bitmap.height / 4
  111.     src_rect = Rect.new(0, 0, cw, ch)
  112.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 名称的描绘
  116.   #     actor : 角色
  117.   #     x     : 描画目标 X 坐标
  118.   #     y     : 描画目标 Y 坐标
  119.   #--------------------------------------------------------------------------
  120.   def draw_actor_name(actor, x, y)
  121.     self.contents.font.color = normal_color
  122.     self.contents.draw_text(x, y, 120, 32, actor.name)
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 职业的描绘
  126.   #     actor : 角色
  127.   #     x     : 描画目标 X 坐标
  128.   #     y     : 描画目标 Y 坐标
  129.   #--------------------------------------------------------------------------
  130.   def draw_actor_class(actor, x, y)
  131.     self.contents.font.color = normal_color
  132.     self.contents.draw_text(x, y, 236, 32, actor.class_name)
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 等级的描绘
  136.   #     actor : 角色
  137.   #     x     : 描画目标 X 坐标
  138.   #     y     : 描画目标 Y 坐标
  139.   #--------------------------------------------------------------------------
  140.   def draw_actor_level(actor, x, y)
  141.     self.contents.font.color = system_color
  142.     self.contents.draw_text(x, y, 32, 32, "Lv")
  143.     self.contents.font.color = normal_color
  144.     self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 生成描绘用的状态字符串
  148.   #     actor       : 角色
  149.   #     width       : 描画目标的宽度
  150.   #     need_normal : [正常] 是否为必须 (true / false)
  151.   #--------------------------------------------------------------------------
  152.   def make_battler_state_text(battler, width, need_normal)
  153.     # 获取括号的宽
  154.     brackets_width = self.contents.text_size("[]").width
  155.     # 生成状态名字符串
  156.     text = ""
  157.     for i in battler.states
  158.       if $data_states[i].rating >= 1
  159.         if text == ""
  160.           text = $data_states[i].name
  161.         else
  162.           new_text = text + "/" + $data_states[i].name
  163.           text_width = self.contents.text_size(new_text).width
  164.           if text_width > width - brackets_width
  165.             break
  166.           end
  167.           text = new_text
  168.         end
  169.       end
  170.     end
  171.     # 状态名空的字符串是 "[正常]" 的情况下
  172.     if text == ""
  173.       if need_normal
  174.         text = "[正常]"
  175.       end
  176.     else
  177.       # 加上括号
  178.       text = "[" + text + "]"
  179.     end
  180.     # 返回完成后的文字类
  181.     return text
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 描绘状态
  185.   #     actor : 角色
  186.   #     x     : 描画目标 X 坐标
  187.   #     y     : 描画目标 Y 坐标
  188.   #     width : 描画目标的宽
  189.   #--------------------------------------------------------------------------
  190.   def draw_actor_state(actor, x, y, width = 120)
  191.     text = make_battler_state_text(actor, width, true)
  192.     self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
  193.     self.contents.draw_text(x, y, width, 32, text)
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 描绘 EXP
  197.   #     actor : 角色
  198.   #     x     : 描画目标 X 坐标
  199.   #     y     : 描画目标 Y 坐标
  200.   #--------------------------------------------------------------------------
  201.   def draw_actor_exp(actor, x, y)
  202.     self.contents.font.color = system_color
  203.     self.contents.draw_text(x, y, 24, 32, "E")
  204.     self.contents.font.color = normal_color
  205.     self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
  206.     self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
  207.     self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 描绘 HP
  211.   #     actor : 角色
  212.   #     x     : 描画目标 X 坐标
  213.   #     y     : 描画目标 Y 坐标
  214.   #     width : 描画目标的宽
  215.   #--------------------------------------------------------------------------
  216.   def draw_actor_hp1(actor, x, y, width = 72)
  217.     # 描绘字符串 "HP"
  218.     self.contents.font.color = system_color
  219.     self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
  220.     # 计算描绘 MaxHP 所需的空间
  221.     if width - 24 >= 32
  222.       hp_x = x + 32# + width - 24
  223.     end
  224.     # 描绘 HP
  225.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  226.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  227.     self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 描绘 SP
  231.   #     actor : 角色
  232.   #     x     : 描画目标 X 坐标
  233.   #     y     : 描画目标 Y 坐标
  234.   #     width : 描画目标的宽
  235.   #--------------------------------------------------------------------------
  236.   def draw_actor_sp1(actor, x, y, width = 72)
  237.     # 描绘字符串 "SP"
  238.     self.contents.font.color = system_color
  239.     self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
  240.     # 计算描绘 MaxSP 所需的空间
  241.     if width - 24 >= 32
  242.       sp_x = x + 32# + width - 24
  243.     end
  244.     # 描绘 SP
  245.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  246.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  247.     self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
  248.   end
  249. end
  250.   #--------------------------------------------------------------------------
  251.   # ● 描绘能力值
  252.   #     actor : 角色
  253.   #     x     : 描画目标 X 坐标
  254.   #     y     : 描画目标 Y 坐标
  255.   #     type  : 能力值种类 (0~6)
  256.   #--------------------------------------------------------------------------
  257.   def draw_actor_parameter(actor, x, y, type)
  258.     case type
  259.     when 0
  260.       parameter_name = $data_system.words.atk
  261.       parameter_value = actor.atk
  262.     when 1
  263.       parameter_name = $data_system.words.pdef
  264.       parameter_value = actor.pdef
  265.     when 2
  266.       parameter_name = $data_system.words.mdef
  267.       parameter_value = actor.mdef
  268.     when 3
  269.       parameter_name = $data_system.words.str
  270.       parameter_value = actor.str
  271.     when 4
  272.       parameter_name = $data_system.words.dex
  273.       parameter_value = actor.dex
  274.     when 5
  275.       parameter_name = $data_system.words.agi
  276.       parameter_value = actor.agi
  277.     when 6
  278.       parameter_name = $data_system.words.int
  279.       parameter_value = actor.int
  280.     end
  281.     self.contents.font.color = system_color
  282.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  283.     self.contents.font.color = normal_color
  284.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● 描绘物品名
  288.   #     item : 物品
  289.   #     x    : 描画目标 X 坐标
  290.   #     y    : 描画目标 Y 坐标
  291.   #--------------------------------------------------------------------------
  292.   def draw_item_name(item, x, y)
  293.     if item == nil
  294.       return
  295.     end
  296.     bitmap = RPG::Cache.icon(item.icon_name)
  297.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  298.     self.contents.font.color = normal_color
  299.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  300.   end
  301. end
复制代码
‘‘──love_xingxuan于2012-8-17 23:56补充以下内容:

呃  就是最后一行
’’

Lv2.观梦者

梦石
0
星屑
672
在线时间
2184 小时
注册时间
2009-12-6
帖子
607

开拓者

2
发表于 2012-8-18 07:43:15 | 只看该作者
本帖最后由 ML4455739 于 2012-8-18 07:47 编辑

250行多了一个end,删掉就好了
#--------------------------------------------------------------------------
  # ● 描绘 SP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_sp1(actor, x, y, width = 72)
    # 描绘字符串 "SP"
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
    # 计算描绘 MaxSP 所需的空间
    if width - 24 >= 32
      sp_x = x + 32# + width - 24
    end
    # 描绘 SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
  end
end#<——把这行删掉,包括这些字

评分

参与人数 1星屑 +200 收起 理由
忧雪の伤 + 200 认可答案

查看全部评分

往事简直不堪回首,稍微做点想做的事吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
820
在线时间
8 小时
注册时间
2012-8-17
帖子
3
3
 楼主| 发表于 2012-8-18 10:09:01 | 只看该作者
ML4455739 发表于 2012-8-18 07:43
250行多了一个end,删掉就好了

嗯 谢谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-19 14:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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