[RMVX ACE] [SCRIPTING] GREYING OUT "CONTINUE" OPTION ON TITLESCREEN?

Posts

Pages: 1
Hi~ :)

So, for my game, I'm using a custom titlescreen script by TheoAllen, and I was wondering if there was any way I could have the option to make the "Continue" option greyed out when no save file data exists. I'm also using a script which only allows one single save file. Dunno if that's worth stating or not.

Here's my edited version of Theo's script how it is in my game already:
https://pastebin.com/mFusZt4K

Thank you!
Marrend
Guardian of the Description Thread
21806
I think it needs to have a graphic that can be associated with a greyed-out option...

module THEO
  module Title
    #--------------------------------------------------------------------------#
    # Command images placed in Graphics/System                                 #
    #--------------------------------------------------------------------------#
    module Start  #Start Command
      Unselect  = "New"
      Select    = "New (Selected)"
      Gray      = "New(Gray)"
      Position  = [0,0] #Position
    end
    
    module Continue #Continue Command
      Unselect  = "Continue"
      Select    = "Continue (Selected)"
      Gray      = "Continue (Gray)"
      Position  = [0,0] #Position
    end
    
    module Exit #Exit Command
      Unselect  = "Quit"
      Select    = "Quit (Selected)"
      Gray      = "Exit (Gray)"
      Position  = [0,0] #Position
    end 
  end
end

...like so. Saying that, I'm not 100% sure where to go from here. My thought is that there should probably be something like...

class TitleCommand < Sprite
  def unselect
    self.bitmap = Cache.system(@mod::Unselect)
  end
  
  def select
    self.bitmap = Cache.system(@mod::Select)
  end
  
  def gray
    self.bitmap = Cache.system(@mod::Gray)
  end
end

...that, but, I can't quite determine how it uses this information to display what graphic is actually shown.
Ah, I see. Thanks for your input! :D

My initial thought was that it would be a condition based on whether or not the file "Save.rvdata2" exists. If it does, leave the "Continue" graphic alone. If it doesn't, change it to another graphic—the greyed-out graphic—(like you said).

Then again, I'm not very good with this stuff, so... :)
Marrend
Guardian of the Description Thread
21806
Well, the script uses a function from Window_Title_Command...

def continue_enabled
  DataManager.save_file_exists?
end

...which checks to see if any number save files exist to determine if the "Continue" option can be used. However, that function does not determine what graphics displays for the "Continue" command, as far as I can tell.
Ahh, I see what you're saying, now...

Well, is there any command you can use to simply show a graphic on the titlescreen (suggesting it's used as a separate script all its own) and dispose of it upon exit of the titlescreen?

So, like:
unless DataManager.save_file_exists?
#insert show graphic command which disappears upon exit of the menu
If I remember correctly, you can't just use the regualar "Show Picture" command for images on the titlescreen, since that's only for images shown in-game, right?
Marrend
Guardian of the Description Thread
21806
The issue isn't so much that we don't have pictures to show. We have that. Right about...

class TitleCommand < Sprite
  def unselect
    self.bitmap = Cache.system(@mod::Unselect)
  end
  
  def select
    self.bitmap = Cache.system(@mod::Select)
  end

  def gray
    self.bitmap = Cache.system(@mod::Gray)
  end
end

...here, actually. The question in my mind is where the conditional branch (ie: if/then statement) would occur in relation to the "Continue" option, and there being no save files to load. I've moved onto another project (which has been it's own headache), so, I'd have to reacquire the script to take another look at it.


As for you comment about using "Show Picture", a hack trick I've learned is that it's possible to eschew the traditional title screen altogether, and do the title screen on the initial map players get dropped into.

class Scene_Title < Scene_Base
  def start
    super
    SceneManager.clear
    Graphics.freeze
    create_background
    create_foreground
    #create_command_window
    command_new_game
    #play_title_music
  end
  
  def command_new_game
    DataManager.setup_new_game
    #close_command_window
    fadeout_all
    $game_map.autoplay
    SceneManager.goto(Scene_Map)
  end
end

I don't know how many games use this method, outside of the two I know about. Well, okay, the second game I linked to goes directly to gameplay, and eschews the concept of title screen altogether. So, maybe that's not a great example. However, the point I was trying to make is that it can be done!

*Edit:
Quick hack alert
module THEO
  module Title
    module Start  #Start Command
      Unselect  = "New"
      Select    = "New (Selected)"
      Gray      = "New (Gray)"
      Position  = [0,0] #Position
    end
    
    module Continue #Continue Command
      Unselect  = "Continue"
      Select    = "Continue (Selected)"
      Gray      = "Continue (Gray)"
      Position  = [0,16] #Position
    end
    
    module Exit #Exit Command
      Unselect  = "Quit"
      Select    = "Quit (Selected)"
      Gray      = "Quit (Gray)"
      Position  = [0,32] #Position
    end
  end
end

class TitleCommand < Sprite
  def gray
    self.bitmap = Cache.system(@mod::Gray)
  end
end

class TitleCommandset
  def update_selection
    @commands.each {|cmd| cmd.unselect}
    if @index == 1
      # Continue selected.
      if DataManager.save_file_exists?
        @commands[@index].select
      else
        @commands[@index].gray
      end
    else
      # Continue not selected. Ensue normal processing.
      @commands[@index].select
    end
  end
end
Oooh, that works well! But, is there any way the greyed-out graphic could just show without having to be selected? I don't even need a separate "selected" graphic for it, to be honest. Just one that shows continuously unless there's a save file present?
Marrend
Guardian of the Description Thread
21806
Very much untested, but, I think...

class TitleCommandset
  def update_selection
    @commands.each {|cmd| cmd.unselect}
    @commands[1].gray if DataManager.save_file_exists?
    if @index == 1
      # Continue selected.
      if DataManager.save_file_exists?
        @commands[@index].select
      else
        @commands[@index].gray
      end
    else
      # Continue not selected. Ensue normal processing.
      @commands[@index].select
    end
  end
end


...this would be the code to use instead of what I had above for TitleCommandset.
Aha! I finally got it to (semi) work! >:D
I actually just ended up using:
def load_enable?
    unless DataManager.save_file_exists?
      @sprite = Sprite.new
      @sprite.bitmap = Bitmap.new("Graphics/System/Continue (grey).png")
      @sprite.z = 250
  end
The only problem is, I need the image to fade in over the course of 15 frames, so it doesn't just pop up before the screen has even faded in yet.

Any idea how to go about this?

*Edit:
NEVERMIND! That issue was coming from a different script I just forgot to take out of my database. lol Everything's all good now and I've gotten the effect I wanted.

Thank you for all your help, Marrend! :3

**Edit: K, double nevermind. I have another problem. It doesn't actually load the game if the save file exists. Whenever you select "Continue", it just doesn't do anything for a few seconds and then crashes.

Any ideas?
Marrend
Guardian of the Description Thread
21806
It crashes the game if you press "Continue"? I don't think that script over-writes (or otherwise messes with) Scene_Title.command_continue, but, that would be where I would start looking!
Pages: 1