赞 | 12 |
VIP | 2 |
好人卡 | 5 |
积分 | 13 |
经验 | 24311 |
最后登录 | 2023-9-26 |
在线时间 | 378 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1345
- 在线时间
- 378 小时
- 注册时间
- 2015-6-16
- 帖子
- 571
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 300英雄 于 2019-2-22 20:48 编辑
本系统为本作者自己游戏需要制作的,最近以游戏内容为主,做一个看玩家对本游戏理解程度为目的系统。支持多选项,看对于QuestionO的讲解就行了
先讲解一下怎么用,你需要改动三个变量,在答题系统脚本写上你要的内容,以新增第四个问题为例子
1.Question
格式: ID => "问题",
Question = {
1 => "你是好人吗",
2 => "LOL技能快捷键不包括",
3 => "假面骑士KIKAI是哪一年的",
4 => "假面骑士WOZ是哪个时代来的",
}
2.QuestionA,有问题当然有答案了,A代表第一个选项,B代表第二个,C和D同理,只能填ABCD,填别的必定是错误答案,只会判定你选的ABCD,你填了别的肯定是false错误。
格式:ID => "答案",
"答案"改成"A","B","C","D"的一个
QuestionA = {
1 => "A",
2 => "C",
3 => "D",
4 => "D",
}
3.QuestionO
QuestionO支持多选项,只要你删除选项即可。
格式:ID => ["A","B","C","D"],
讲解注意点
1.问题的最大上限是4个,所以选项最多状态是["a","b","c","d"]这样,多写无用,不读取,不生效。
2.问题答案以从左到右为ABCD。
例子:
1号问题是四个选项,ABCD都可以选择。
2号只有三个选项,所以是ABC有效,D为无法选择,所以2的选项答案不能用D,否则无法选取导致你答案必定错误(233)。
3号A选项是"",所以本题只能选BCD
若答案为""(英文状态的双引号,打两个")则此选项无法选择,可以皮一波只能选ABD ACD,这种操作哈哈,这也是本系统的一个彩蛋功能
QuestionO = {
1 => ["是","不是","看着办","你猜啊"],
2 => ["1","2","3"],
3 => ["","2020","2021","2121"],
4 => ["过去","现代","未来","逢魔之日"],
}
下面附上脚本
#encoding:utf-8 #============================================================================== # ■ Module Question #答题系统模组 #============================================================================== module Question Question = { 1 => "你是好人吗", 2 => "LOL技能快捷键不包括", 3 => "假面骑士KIKAI是哪一年的", } QuestionA = { 1 => "A", 2 => "C", 3 => "D", } QuestionO = { 1 => ["是","不是","看着办","你猜啊"], 2 => ["1","2","3"], 3 => ["2120","2020","2021","2121"], } QuestionE = { 0 => "A", 1 => "B", 2 => "C", 3 => "D", } end
#encoding:utf-8
#==============================================================================
# ■ Module Question
#答题系统模组
#==============================================================================
module Question
Question = {
1 => "你是好人吗",
2 => "LOL技能快捷键不包括",
3 => "假面骑士KIKAI是哪一年的",
}
QuestionA = {
1 => "A",
2 => "C",
3 => "D",
}
QuestionO = {
1 => ["是","不是","看着办","你猜啊"],
2 => ["1","2","3"],
3 => ["2120","2020","2021","2121"],
}
QuestionE = {
0 => "A",
1 => "B",
2 => "C",
3 => "D",
}
end
#encoding:utf-8 #============================================================================== # ■ Window_dati #答题的选项窗口 #============================================================================== class Window_dati < Window_Command #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize @has_command = [] super(0, 248) end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def make_command_list Question::QuestionO[$问题ID][0] = "" if Question::QuestionO[$问题ID][0] == nil Question::QuestionO[$问题ID][1] = "" if Question::QuestionO[$问题ID][1] == nil Question::QuestionO[$问题ID][2] = "" if Question::QuestionO[$问题ID][2] == nil Question::QuestionO[$问题ID][3] = "" if Question::QuestionO[$问题ID][3] == nil add_command("A."+Question::QuestionO[$问题ID][0], :xz, Question::QuestionO[$问题ID][0]!="",) add_command("B."+Question::QuestionO[$问题ID][1], :xz, Question::QuestionO[$问题ID][1]!="",) add_command("C."+Question::QuestionO[$问题ID][2], :xz, Question::QuestionO[$问题ID][2]!="",) add_command("D."+Question::QuestionO[$问题ID][3], :xz, Question::QuestionO[$问题ID][3]!="",) add_command("确定", :确定, true) #~ add_command("选项3", :third, true) unless @has_command.include?(:third) add_command("退出", :退出, true) end #-------------------------------------------------------------------------- # ● 获取显示行数 #-------------------------------------------------------------------------- def visible_line_number 3 end #-------------------------------------------------------------------------- # ● 获取列数 #-------------------------------------------------------------------------- def col_max return 2 end def item_width 320 end #~ def item_width #~ return 24*3+30 #~ end def window_width return 640 end #-------------------------------------------------------------------------- # ● 加入选择的选项 #-------------------------------------------------------------------------- def push(symbol) @has_command.push(symbol) unless @has_command.include?(symbol) end end
#encoding:utf-8
#==============================================================================
# ■ Window_dati
#答题的选项窗口
#==============================================================================
class Window_dati < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
@has_command = []
super(0, 248)
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
Question::QuestionO[$问题ID][0] = "" if Question::QuestionO[$问题ID][0] == nil
Question::QuestionO[$问题ID][1] = "" if Question::QuestionO[$问题ID][1] == nil
Question::QuestionO[$问题ID][2] = "" if Question::QuestionO[$问题ID][2] == nil
Question::QuestionO[$问题ID][3] = "" if Question::QuestionO[$问题ID][3] == nil
add_command("A."+Question::QuestionO[$问题ID][0], :xz, Question::QuestionO[$问题ID][0]!="",)
add_command("B."+Question::QuestionO[$问题ID][1], :xz, Question::QuestionO[$问题ID][1]!="",)
add_command("C."+Question::QuestionO[$问题ID][2], :xz, Question::QuestionO[$问题ID][2]!="",)
add_command("D."+Question::QuestionO[$问题ID][3], :xz, Question::QuestionO[$问题ID][3]!="",)
add_command("确定", :确定, true)
#~ add_command("选项3", :third, true) unless @has_command.include?(:third)
add_command("退出", :退出, true)
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
3
end
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def col_max
return 2
end
def item_width
320
end
#~ def item_width
#~ return 24*3+30
#~ end
def window_width
return 640
end
#--------------------------------------------------------------------------
# ● 加入选择的选项
#--------------------------------------------------------------------------
def push(symbol)
@has_command.push(symbol) unless @has_command.include?(symbol)
end
end
#encoding:utf-8 #============================================================================== # ■ Scene_D答题 #------------------------------------------------------------------------------ # 答题画面 #============================================================================== class D答题 < Scene_MenuBase #-------------------------------------------------------------------------- # ● 开始处理 #-------------------------------------------------------------------------- def start super create_command_window end #-------------------------------------------------------------------------- # ● 生成指令窗口 #-------------------------------------------------------------------------- def create_command_window $问题ID = Question::Question.keys.sample #~ Question::QuestionID = Question::Question.keys.sample @command_window = Window_dati.new @问题标题 = Window_Base.new(0,0,640,48) @问题标题.contents.clear @问题标题.draw_text_ex(320-24,0,"问题") @command_help = Window_Base.new(0,48,640,200) @command_help.contents.clear @command_help.draw_text_ex(0,0,"#{Question::Question[$问题ID]}") $预选答案 = "无" $选择答案 = "无" @预选答案 = Window_Base.new(0,360,640,60) @选择答案 = Window_Base.new(0,420,640,60) @预选答案.contents.clear @预选答案.draw_text_ex(0,0,"目前预选答案为:#{$预选答案}") @选择答案.contents.clear @选择答案.draw_text_ex(0,0,"目前选择答案为:#{$选择答案}") @command_window.set_handler(:xz, method(:xuanze)) @command_window.set_handler(:确定, method(:queding)) @command_window.set_handler(:退出, method(:return_map)) end def xuanze $预选答案 = @command_window.command_name(@command_window.index) $预选答案顺序 = @command_window.index @预选答案.contents.clear @预选答案.draw_text_ex(0,0,"目前预选答案为:#{$预选答案}") #~ @command_window.index command_end end def queding $选择答案 = Question::QuestionE[$预选答案顺序] #你选的ABCD if $选择答案 == Question::QuestionA[$问题ID] 正确 = "正确" else 正确 = "错误" end @选择答案.contents.clear @选择答案.draw_text_ex(0,0,"您的答案为:#{$选择答案},#{正确}") @command_window.select(0) $问题ID = Question::QuestionO.keys.sample @command_window.command_gname(0,Question::QuestionO[$问题ID][0]) @command_window.command_gname(1,Question::QuestionO[$问题ID][1]) @command_window.command_gname(2,Question::QuestionO[$问题ID][2]) @command_window.command_gname(3,Question::QuestionO[$问题ID][3]) @command_help.contents.clear @command_help.draw_text_ex(0,0,"#{Question::Question[$问题ID]}") command_end end def update super SceneManager.goto(Scene_Map) if KeyBoard.press?(VK_X) or KeyBoard.press?(VK_ESCAPE) Sound.play_ok if KeyBoard.press?(VK_X) or KeyBoard.press?(VK_ESCAPE) end ######## #-------------------------------------------------------------------------- # ● 选择后刷新 #-------------------------------------------------------------------------- def command_end @command_window.refresh @command_window.active = true end end
#encoding:utf-8
#==============================================================================
# ■ Scene_D答题
#------------------------------------------------------------------------------
# 答题画面
#==============================================================================
class D答题 < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_command_window
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
$问题ID = Question::Question.keys.sample
#~ Question::QuestionID = Question::Question.keys.sample
@command_window = Window_dati.new
@问题标题 = Window_Base.new(0,0,640,48)
@问题标题.contents.clear
@问题标题.draw_text_ex(320-24,0,"问题")
@command_help = Window_Base.new(0,48,640,200)
@command_help.contents.clear
@command_help.draw_text_ex(0,0,"#{Question::Question[$问题ID]}")
$预选答案 = "无"
$选择答案 = "无"
@预选答案 = Window_Base.new(0,360,640,60)
@选择答案 = Window_Base.new(0,420,640,60)
@预选答案.contents.clear
@预选答案.draw_text_ex(0,0,"目前预选答案为:#{$预选答案}")
@选择答案.contents.clear
@选择答案.draw_text_ex(0,0,"目前选择答案为:#{$选择答案}")
@command_window.set_handler(:xz, method(:xuanze))
@command_window.set_handler(:确定, method(:queding))
@command_window.set_handler(:退出, method(:return_map))
end
def xuanze
$预选答案 = @command_window.command_name(@command_window.index)
$预选答案顺序 = @command_window.index
@预选答案.contents.clear
@预选答案.draw_text_ex(0,0,"目前预选答案为:#{$预选答案}")
#~ @command_window.index
command_end
end
def queding
$选择答案 = Question::QuestionE[$预选答案顺序]
#你选的ABCD
if $选择答案 == Question::QuestionA[$问题ID]
正确 = "正确"
else
正确 = "错误"
end
@选择答案.contents.clear
@选择答案.draw_text_ex(0,0,"您的答案为:#{$选择答案},#{正确}")
@command_window.select(0)
$问题ID = Question::QuestionO.keys.sample
@command_window.command_gname(0,Question::QuestionO[$问题ID][0])
@command_window.command_gname(1,Question::QuestionO[$问题ID][1])
@command_window.command_gname(2,Question::QuestionO[$问题ID][2])
@command_window.command_gname(3,Question::QuestionO[$问题ID][3])
@command_help.contents.clear
@command_help.draw_text_ex(0,0,"#{Question::Question[$问题ID]}")
command_end
end
def update
super
SceneManager.goto(Scene_Map) if KeyBoard.press?(VK_X) or KeyBoard.press?(VK_ESCAPE)
Sound.play_ok if KeyBoard.press?(VK_X) or KeyBoard.press?(VK_ESCAPE)
end
########
#--------------------------------------------------------------------------
# ● 选择后刷新
#--------------------------------------------------------------------------
def command_end
@command_window.refresh
@command_window.active = true
end
end
|
|