查看: 2350|回复: 13

请教是何种语法错误

  [复制链接]
梦石
0
星屑
50
在线时间
48 小时
注册时间
2006-12-10
回帖
31
发表于 2007-8-24 09:18:57 | 显示全部楼层 |阅读模式

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

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

×
今天研究“学习技能”脚本,本想拿来用,但是报错。请大家指点下```
(1)Window_Drug.new
--------------------------------------------------------------------------------------
class Scene_Drug
  include Opacity_CS
  def main
    create_screen
    @drug = Window_Drug.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene !=self
        break
      end
    end
    Graphics.freeze
    @drug.dispose
    dispose_screen
  end
  def update
    @drug.refresh
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if (Graphic.frame_count%10) == 0
    if $game_variables[25] != 0
      if $game_system.drug_min[$name]< $game_system.drug_max[$name]
        $game_system.drug_min[$name] += 1
        $game_variables[25] -= 1
      else
        $game_system.drug_name[$name] += 1
        $game_system.drug_min[$name] = 0
        $game_system.drug_max[$name] += $game_system.drug_name[$name] + 30
      end
    else
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
  end
end
end
--------------------------------------------------------------------------------------
(2)Window_Drug
--------------------------------------------------------------------------------------
class Window_Drug < Window_Base
  def initialize
    super(160,120,320,120)
    self.contents = Bitmap.new(width - 32,height - 32)
    refresh
  end
  def refresh
    self.contents.clear
  width = 255
  x = 0
  y = 0
  self.contents.font.color = Color.new(255,255,255,255)
  self.contents.fill_rect(x-2+10,y+45,width+4,8,Color.new(255,255,255,255))
  self.contents.fill_rect(x-1+10,y+46,width+2,6,Color.new(0,0,0,255))
  w = width * $game_system.drug_min / $game_system.drug_max
  self.contets.font.size = 18
  self.contets.draw_text(x-20,y,160,32,"学习中.....",1)
  self.contets.fill_rect(x+10,y+47,w,1,Color.new(255,141,0,255))
  self.contets.fill_rect(x+10,y+48,w,1,Color.new(255,180,0,255))
  self.contets.fill_rect(x+10,y+49,w,1,Color.new(157,87,0,255))
  self.contets.fill_rect(x+10,y+49,w,1,Color.new(0,0,0,255))
  self.contets.font.color = Color.new(255,255,255,255)
  self.contets.draw_text(x+30,y+32,128,32,$game_system.drug_min.to_s,1)
  self.contets.draw_text(x+96+20,y+32,12,32, "/",1)
  self.contets.draw_text(x+120+20,y+32,48,32,$game_system.drug_mmax.to_s)
  self.contets.draw_text(x+10,y+64,72,32,"剩余潜力:",1)
  self.contets.draw_text(x+80,y+64,48,32,$game_variables[1].to_s,1)
  self.contets.draw_text(x+142,y+64,72,32,"技能等级:",1)
  self.contets.draw_text(x+205,y+64,48,32,$game_system.drug_name.to_s,1)
  if $game_system.drug_min >= $game_system.drug_max
    $game_system.drug_min = $game_system.drug_max
  end
end
end
--------------------------------------------------------------------------------------
(3)opacity for map
--------------------------------------------------------------------------------------
module Opacity_CS
  def create_screen
    @back = Spriteset_Map.new
  end
  def dispose_screen
    @back.dispose
  end
end
--------------------------------------------------------------------------------------
整个脚本就以上3部分组成,但是我一运行就提示"SyntaxError",请大家指点下!
本贴由论坛斑竹九泪结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
邋遢小乞丐 我是菜鸟```需要大家的支持!!!
梦石
0
星屑
50
在线时间
48 小时
注册时间
2006-12-10
回帖
31
发表于 2007-8-24 09:18:57 | 显示全部楼层 |阅读模式

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

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

×
今天研究“学习技能”脚本,本想拿来用,但是报错。请大家指点下```
(1)Window_Drug.new
--------------------------------------------------------------------------------------
class Scene_Drug
  include Opacity_CS
  def main
    create_screen
    @drug = Window_Drug.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene !=self
        break
      end
    end
    Graphics.freeze
    @drug.dispose
    dispose_screen
  end
  def update
    @drug.refresh
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if (Graphic.frame_count%10) == 0
    if $game_variables[25] != 0
      if $game_system.drug_min[$name]< $game_system.drug_max[$name]
        $game_system.drug_min[$name] += 1
        $game_variables[25] -= 1
      else
        $game_system.drug_name[$name] += 1
        $game_system.drug_min[$name] = 0
        $game_system.drug_max[$name] += $game_system.drug_name[$name] + 30
      end
    else
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
  end
end
end
--------------------------------------------------------------------------------------
(2)Window_Drug
--------------------------------------------------------------------------------------
class Window_Drug < Window_Base
  def initialize
    super(160,120,320,120)
    self.contents = Bitmap.new(width - 32,height - 32)
    refresh
  end
  def refresh
    self.contents.clear
  width = 255
  x = 0
  y = 0
  self.contents.font.color = Color.new(255,255,255,255)
  self.contents.fill_rect(x-2+10,y+45,width+4,8,Color.new(255,255,255,255))
  self.contents.fill_rect(x-1+10,y+46,width+2,6,Color.new(0,0,0,255))
  w = width * $game_system.drug_min / $game_system.drug_max
  self.contets.font.size = 18
  self.contets.draw_text(x-20,y,160,32,"学习中.....",1)
  self.contets.fill_rect(x+10,y+47,w,1,Color.new(255,141,0,255))
  self.contets.fill_rect(x+10,y+48,w,1,Color.new(255,180,0,255))
  self.contets.fill_rect(x+10,y+49,w,1,Color.new(157,87,0,255))
  self.contets.fill_rect(x+10,y+49,w,1,Color.new(0,0,0,255))
  self.contets.font.color = Color.new(255,255,255,255)
  self.contets.draw_text(x+30,y+32,128,32,$game_system.drug_min.to_s,1)
  self.contets.draw_text(x+96+20,y+32,12,32, "/",1)
  self.contets.draw_text(x+120+20,y+32,48,32,$game_system.drug_mmax.to_s)
  self.contets.draw_text(x+10,y+64,72,32,"剩余潜力:",1)
  self.contets.draw_text(x+80,y+64,48,32,$game_variables[1].to_s,1)
  self.contets.draw_text(x+142,y+64,72,32,"技能等级:",1)
  self.contets.draw_text(x+205,y+64,48,32,$game_system.drug_name.to_s,1)
  if $game_system.drug_min >= $game_system.drug_max
    $game_system.drug_min = $game_system.drug_max
  end
end
end
--------------------------------------------------------------------------------------
(3)opacity for map
--------------------------------------------------------------------------------------
module Opacity_CS
  def create_screen
    @back = Spriteset_Map.new
  end
  def dispose_screen
    @back.dispose
  end
end
--------------------------------------------------------------------------------------
整个脚本就以上3部分组成,但是我一运行就提示"SyntaxError",请大家指点下!
本贴由论坛斑竹九泪结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
邋遢小乞丐 我是菜鸟```需要大家的支持!!!

邪恶小龙包

梦石
0
星屑
55
在线时间
17 小时
注册时间
2006-5-22
回帖
6832

第2届短篇游戏比赛冠军第3届短篇游戏大赛小游戏及其他组冠军RMVX自由创作大赛冠军

发表于 2007-8-24 11:19:54 | 显示全部楼层
SyntaxError就代表语法错误
基本遇到这个的情况都是多了或少了几个end所致.......
自己检查下

第一个太长不看了,第二个貌似多了个end
虚无  堕落
回复

使用道具 举报

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
回帖
1177
发表于 2007-8-24 16:35:17 | 显示全部楼层
应该把 module Opacity_CS
的部分写在 Scene 之前
和记忆一起封存着的ID...
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-29
回帖
443
发表于 2007-8-24 17:43:33 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
回帖
1177
发表于 2007-8-24 18:01:57 | 显示全部楼层

不用删 = = ,不是end的问题
和记忆一起封存着的ID...
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-29
回帖
443
发表于 2007-8-24 18:30:14 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

精灵族の天使<

梦石
0
星屑
1712
在线时间
3039 小时
注册时间
2007-3-16
回帖
33092

开拓者贵宾

发表于 2007-8-24 22:38:35 | 显示全部楼层
老大……我想问下。
是不是注释的部分没有注释引起的?
有2种方案:
一种是把注释行前面加上#号
另外一种就是……用=begin和=end来注释掉大段的行……
你确认脚本就是这样放进去的么?
回复

使用道具 举报

梦石
1
星屑
916
在线时间
101 小时
注册时间
2006-3-27
回帖
1019
发表于 2007-8-26 01:32:18 | 显示全部楼层
我第一眼看过去就在想

那写-----前面LZ是不是有写#
回复

使用道具 举报

66RPG站长

梦石
0
星屑
54
在线时间
615 小时
注册时间
2005-10-10
回帖
4793

RMVX自由创作大赛亚军第2届短篇游戏比赛亚军第5届短篇游戏比赛冠军

发表于 2007-8-28 07:10:48 | 显示全部楼层
放工程。说脚本错误也不说明是哪一行,让人很难判断。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部