Project1
标题:
请教是何种语法错误
[打印本页]
作者:
gb68783568
时间:
2007-8-24 09:18
标题:
请教是何种语法错误
今天研究“学习技能”脚本,本想拿来用,但是报错。请大家指点下```
(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",请大家指点下! [LINE]1,#dddddd[/LINE]
本贴由论坛斑竹九泪结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
作者:
gb68783568
时间:
2007-8-24 09:18
标题:
请教是何种语法错误
今天研究“学习技能”脚本,本想拿来用,但是报错。请大家指点下```
(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",请大家指点下! [LINE]1,#dddddd[/LINE]
本贴由论坛斑竹九泪结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
作者:
暴风の龙
时间:
2007-8-24 11:19
SyntaxError就代表语法错误
基本遇到这个的情况都是多了或少了几个end所致.......
自己检查下
第一个太长不看了,第二个貌似多了个end
作者:
K’
时间:
2007-8-24 16:35
应该把 module Opacity_CS
的部分写在 Scene 之前
作者:
索尔迦·蓝
时间:
2007-8-24 17:43
提示:
作者被禁止或删除 内容自动屏蔽
作者:
K’
时间:
2007-8-24 18:01
不用删 = = ,不是end的问题
作者:
索尔迦·蓝
时间:
2007-8-24 18:30
提示:
作者被禁止或删除 内容自动屏蔽
作者:
精灵使者
时间:
2007-8-24 22:38
老大……我想问下。
是不是注释的部分没有注释引起的?
有2种方案:
一种是把注释行前面加上#号
另外一种就是……用=begin和=end来注释掉大段的行……
你确认脚本就是这样放进去的么?
作者:
幻の飞鱼
时间:
2007-8-26 01:32
我第一眼看过去就在想
那写-----前面LZ是不是有写#
作者:
柳柳
时间:
2007-8-28 07:10
放工程。说脚本错误也不说明是哪一行,让人很难判断。
作者:
gb68783568
时间:
2007-8-29 17:37
对不起电脑突然被黑,现在才上来```
我的:
(1)Window_Drug.new
------------------------------------------------------------------------------------
只是为了看起来方便,我在脚本中并没有任何的注释。工程中只提示脚本错误,没有说那一行错误了,让我十分郁闷。
作者:
Zeiro
时间:
2007-8-29 22:33
提示:
作者被禁止或删除 内容自动屏蔽
作者:
叶子
时间:
2007-8-30 13:45
以下引用
苏小脉于2007-8-30 5:20:00
的发言:
没有输出行数即是说,在事件解释器执行时发生了语法错误
更确切地讲是eval所执行的脚本有错误..
作者:
苏小脉
时间:
2009-6-12 08:00
没有输出行数即是说,在事件解释器执行时发生了语法错误
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1