设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 69|回复: 0

[转载] Issues With In-Scene Command Window Changing

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4452

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22911
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28257

    灌水之王

    发表于 7 天前 | 显示全部楼层 |阅读模式
    So, I'm going back through some old code and I came across the attempt I was making at a quest log script and I recalled why I gave up on it. I cannot for the life of me get the quest description to display on the display window when I select it from the main quest log command window.
    Below is a spoiler tag of my code snippet. If anyone could give me any insight as to why it isn't working I would appreciate it. I am not looking for anyone to hand me the answer as, personally, I'd rather someone hint to me where I should start looking or where the problem may lie. Thank you in advance for any any and all help given.

    Spoiler: Code Snippet
                    Ruby:        
    module Quests   List = {}   List[1] = {     :name         => "Quest 1",     :symbol       => :quest1,     :description  => "Description text for quest 01."   }   List[2] = {     :name         => "Quest 2",     :symbol       => :quest2,     :description  => "Description text for quest 02."   } end  #============================================================================= # ▼ Scene_Menu #----------------------------------------------------------------------------- #  This class performs the menu screen processing. #============================================================================= class Scene_Menu < Scene_MenuBase      #--------------------------------------------------------------------------   # ■ Create Command Window   #--------------------------------------------------------------------------   alias :wea_create_command_window         :create_command_window   #--------------------------------------------------------------------------   def create_command_window()     wea_create_command_window() # calls original method     @command_window.set_handler(:journal_scene,   method(:journal_command))   end   #--------------------------------------------------------------------------   # ■ Call Journal Scene   #--------------------------------------------------------------------------   def journal_command()     SceneManager.call(Journal)   end end # end Scene_Menu  #============================================================================= # ▼ Window_MenuCommand #----------------------------------------------------------------------------- #  This command window appears on the menu screen. #============================================================================= class Window_MenuCommand < Window_Command   #--------------------------------------------------------------------------   # ■ For Adding Original Commands   #--------------------------------------------------------------------------   alias :wea_add_original_commands                     :add_original_commands      #--------------------------------------------------------------------------   def add_original_commands()     wea_add_original_commands() # calls original method     add_command("Journal", :journal_scene, true)   end end # end Window_MenuCommand  #============================================================================= # ▼ Journal #----------------------------------------------------------------------------- #  This window appears when the Journal option is selected from the main menu. #============================================================================= class Journal < Scene_Base   #--------------------------------------------------------------------------   # ■ Start Processing   #--------------------------------------------------------------------------   def start()     super()     @window_list = Window_QuestList.new(0,0)     @window_summary = Window_QuestSummary.new()     create_handlers()     create_background()     # Control Window Variables     @window_list.activate()     @window_summary.deactivate()     @current_command_index = 0     @command_index = @window_list.return_index()   end   #--------------------------------------------------------------------------   # ■ Create Background   #--------------------------------------------------------------------------   def create_background()     @background_sprite = Sprite.new()     @background_sprite.bitmap = SceneManager.background_bitmap     @background_sprite.color.set(16, 16, 16, 128)   end   #--------------------------------------------------------------------------   # ■ Create Handlers   #--------------------------------------------------------------------------   def create_handlers()     Quests::List.each do |id, contents|       @window_list.set_handler(contents[:symbol], method(:change_focus))     end   end   #--------------------------------------------------------------------------   # ■ Create Handlers   #--------------------------------------------------------------------------   def change_focus()     @window_list.deactivate()     @window_summary.activate()   end   #--------------------------------------------------------------------------   # ■ Frame Update   #--------------------------------------------------------------------------   def update()     super()     process_input()     @command_index = @window_list.return_index()     if @current_command_index != @command_index       @current_command_index = @command_index       @window_summary.set_index(@command_index)     end   end   #--------------------------------------------------------------------------   # ■ Process Input Triggers   #--------------------------------------------------------------------------   def process_input()     process_on_cancel() if Input.trigger?(:B)   end   #--------------------------------------------------------------------------   # ■ Process On Cancel   #--------------------------------------------------------------------------   def process_on_cancel()     if @window_list.is_active? == true       Sound.play_cancel()       return_scene()     else       Sound.play_cancel()       @window_list.activate()       @window_summary.deactivate()     end   end   #--------------------------------------------------------------------------   # ■ Termination Processing   #--------------------------------------------------------------------------   def terminate()     super()     @window_list.dispose()     @window_summary.dispose()     @background_sprite.dispose()   end end # end Journal  #============================================================================= # ▼ Quest List Window #----------------------------------------------------------------------------- #  This window displays a list of active quests. #============================================================================= class Window_QuestList < Window_Command   #--------------------------------------------------------------------------   # ■ Object Initialization   #--------------------------------------------------------------------------   def initialize(x, y)     clear_command_list()     make_command_list()     super(x, y)     refresh()     select(0)     @index = 0     @current_index = 0   end   #--------------------------------------------------------------------------   # ■ Get Window Width   #--------------------------------------------------------------------------   def window_width()     return 160   end   #--------------------------------------------------------------------------   # ■ Get Window Height   #--------------------------------------------------------------------------   def window_height()     return Graphics.height   end   #--------------------------------------------------------------------------   # ■ Create Quest List   #--------------------------------------------------------------------------   def make_command_list()     add_quests()   end   #--------------------------------------------------------------------------   # ■ Add Quests to List   #--------------------------------------------------------------------------   def add_quests()     Quests::List.each do |id, contents|       add_command(contents[:name], contents[:sumbol], true)     end   end   #--------------------------------------------------------------------------   # ■ Move Cursor Down   #--------------------------------------------------------------------------   def cursor_down(wrap = true)     if index < item_max - col_max || (wrap && col_max == 1)       select((index + col_max) % item_max)       @current_index = index     end   end   #--------------------------------------------------------------------------   # ■ Move Cursor Up   #--------------------------------------------------------------------------   def cursor_up(wrap = true)     if index >= col_max || (wrap && col_max == 1)       select((index - col_max + item_max) % item_max)       @current_index = index     end   end   #--------------------------------------------------------------------------   # ■ Return Highlighted Index   #--------------------------------------------------------------------------   def return_index()     return @index   end   #--------------------------------------------------------------------------   # ■ Activate Window   #--------------------------------------------------------------------------   def activate()     self.active = true     self   end   #--------------------------------------------------------------------------   # ■ Deactivate Window   #--------------------------------------------------------------------------   def deactivate()     self.active = false     self   end   #--------------------------------------------------------------------------   # ■ Deactivate Window   #--------------------------------------------------------------------------   def is_active?()     return self.active   end end  #============================================================================== # ▼ Window_ScrollText #------------------------------------------------------------------------------ #  This window is for displaying scrolling text. No frame is displayed, but it # is handled as a window for convenience. #============================================================================== class Window_QuestSummary < Window_ScrollText   #--------------------------------------------------------------------------   # ■ Object Initialization   #--------------------------------------------------------------------------   def initialize()     super()     self.x              = 160     self.width          = (Graphics.width - 160)     self.height         = Graphics.height     self.opacity        = 255     self.arrows_visible = false     @index              = 0     @current_index      = 0     @max_up_scroll      = 0     @scroll_pos         = 0     show()   end   #--------------------------------------------------------------------------   # ■ Frame Update   #--------------------------------------------------------------------------   def update()     super     if self.active == true       process_input()       if @index != @current_index         clear_summary_text()         draw_summary_text(@index)       end     end     self.oy = @scroll_pos   end   #--------------------------------------------------------------------------   # ■ Clear Quest Summary   #--------------------------------------------------------------------------   def clear_summary_text()     contents.clear()   end   #--------------------------------------------------------------------------   # ■ Draw Quest Summary   #--------------------------------------------------------------------------   def draw_summary_text(index)     text = Quests::List[index][:description]     draw_text_ex(0, 0, text)   end   #--------------------------------------------------------------------------   # ■ Shift Index Text   #--------------------------------------------------------------------------   def set_index(index)     @index = index   end   #--------------------------------------------------------------------------   # ■ Process Key input   #--------------------------------------------------------------------------   def process_input()     @scroll_pos -= 1 if Input.press?(:UP) && @scroll_pos != @max_up_scroll     @scroll_pos += 1 if Input.press?(:DOWN)   end   #--------------------------------------------------------------------------   # ■ Activate Window   #--------------------------------------------------------------------------   def activate()     self.active = true     self   end   #--------------------------------------------------------------------------   # ■ Deactivate Window   #--------------------------------------------------------------------------   def deactivate()     self.active = false     self   end end




    本贴来自国际rpgmaker官方论坛作者:Wyn Wizard处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/issues-with-in-scene-command-window-changing.165770/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 15:26 , Processed in 0.090606 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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