[RMVX ACE] ADDING SOME INFOS TO [LDS] SAVE SCREEN

Posts

Pages: 1
Hi. It's me again. I was playing around with LDS Save Screen a bit. I've commented out some stuff I don't need and I was trying to add some infos; most of them given by custom variables. While editing the script and get some smart tweaks running, I actually remembered that I'm no Scripter and I've no clue what I'm doing at all. So I'm coming to you who can probably do much better than I can... because I can't.

Here's what I have so far:



Here's what I want to achieve:



I made this edit using scrolling text event command.

Here's my current version of the script:

LDS Save Screen.txt

Maybe someone can help me adding these infos and maybe I can learn from you. Please show me how to do it. :)

Thanks. :)
Marrend
Guardian of the Description Thread
21781
I tried putting the code as written, and it's throwing a few errors at me.

One was the reference to ".min".

class Window_SaveInfo < Window_Selectable
  def item_max
    return .min #<-----
  end

  def draw_item(index)
    return if @actors.empty? or @actors.nil?
    actor = @actors
    rect = item_rect(index)
    rect.y += line_height * 2
    #draw_actor_face(actor, rect.x, rect.y, !actor.dead?)
    #draw_actor_name(actor, rect.x + 100, rect.y+line_height*0)
    #draw_actor_level(actor, rect.x + 100, rect.y+line_height*1)
    w = .min #<-----
    #draw_actor_hp(actor, rect.x + 100, rect.y+line_height*2, w)
    #draw_actor_mp(actor, rect.x + 100, rect.y+line_height*3, w)
  end
end


There is no object calling this function. It might be implementing a reference to "self.min", which, as far as I can see/know, doesn't exist. The other error was that "@savefile_windows" is an array, but, that can be fixed pretty easily...

class Scene_File < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● Create a save file window
  #--------------------------------------------------------------------------
  alias create_savefile_windows_save create_savefile_windows
  def create_savefile_windows
    create_savefile_windows_save
    @info_window = Window_SaveInfo.new(@savefile_windows[0].window_width, @help_window.height)
  end
end


Even if I fix those errors, the resulting window looks like it's printing garbage...





...which obviously isn't matching your "what I have now" screen at all. I tried tinkering with this, but, I'm just getting different kinds of errors.
@Marrend: I don't know what's causing these errors. Maybe that's because I couldn't get the code tag to work. I tried to upload the script as a .txt-file.

LDS Save Screen.txt
Marrend
Guardian of the Description Thread
21781
Well, the numbers aren't aligned the way you showed in the second screen....




...and I wasn't 100% sure if you wanted the variable names that are in the Control Variables screen. I'm not even sure how to access that data.

Saying that, this is what I've got on my end.

=begin
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=*    [LDS] Save Screen       =*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=* Date Created: 1/5/2013     =*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=* Last Updated: 1/5/2013     =*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=* Created by: Levi Stepp     =*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
  __________________________________________________________________________
 /                                                                          \
|      This save script allows you to view images on current saved files.    |
|                        ~Up to 6 actors can be viewed~                      |
|     This may be used in commercial projects, as long as you give credit.   |
 \__________________________________________________________________________/
                         ◆  There is no configuration. ◆
                               ◆  PLUG N' PLAY   ◆
=end
#==============================================================================
# ■ LDS_SAVE : Do not remove!
#==============================================================================
class LDS_SAVE
  #--------------------------------------------------------------------------
  # ● Variables
  #--------------------------------------------------------------------------
  attr_reader :name
  attr_reader :level
  attr_reader :hp
  attr_reader :mp
  attr_reader :mhp
  attr_reader :mmp
  attr_reader :face_name
  attr_reader :face_index
  #--------------------------------------------------------------------------
  # ● Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    @name = actor.name
    @level = actor.level
    @hp = actor.hp; @mhp = actor.mhp
    @mp = actor.mp; @mmp = actor.mmp
    @face_name = actor.face_name
    @face_index = actor.face_index
    @dead = actor.dead?
  end
  #--------------------------------------------------------------------------
  # ● Non-Combat Check
  #--------------------------------------------------------------------------
  def dead?
    @dead
  end
  #--------------------------------------------------------------------------
  # ● HP Set
  #--------------------------------------------------------------------------
  def hp_rate
    @hp.to_f / @mhp
  end
  #--------------------------------------------------------------------------
  # ● MP Set
  #--------------------------------------------------------------------------
  def mp_rate
    @mmp > 0 ? @mp.to_f / @mmp : 0
  end
end
   
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ● Party Member Graphics
  #--------------------------------------------------------------------------
  def member_for_savefile
    members.collect { |actor| LDS_SAVE.new(actor) }
  end
end
   
#==============================================================================
# ■ DataManager
#==============================================================================
class << DataManager
  #--------------------------------------------------------------------------
  # ● Create Location / Actors
  #--------------------------------------------------------------------------
  alias make_save_header_faces make_save_header
  def make_save_header
    header = make_save_header_faces
    header[:map_name] = $game_map.display_name
    #header[:map_name] = Vocab.get_mapname() #eingefügt von Tw0, oben auskommentiert.
    header[:actors] = $game_party.member_for_savefile
    header[:gold] = $game_party.gold
    header[:var] = $game_variables
    header
  end
end
   
   
#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # ● Object Initialization
  #     Index: Saved Files
  #--------------------------------------------------------------------------
  def initialize(height, index)
    super(0, index * height, window_width, height)
    @file_index = index
    refresh
    @selected = false
  end
  #--------------------------------------------------------------------------
  # ● Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 134
  end
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    change_color(normal_color)
    name = Vocab::File + " #{@file_index + 1}"
    draw_text(4, 0, 200, line_height, name)
    @name_width = text_size(name).width
  end
end
   
#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveInfo < Window_Selectable
  #--------------------------------------------------------------------------
  # ● Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, h)
    @actors = []
    super(x, h, Graphics.width - x, Graphics.height - h)
    self.file_index = index
  end
  #--------------------------------------------------------------------------
  # ● Capture Height
  #--------------------------------------------------------------------------
  def item_height
    (contents_height - (line_height * 2)) / row_num
  end
  #--------------------------------------------------------------------------
  # ● Calculate Height of the Window
  #--------------------------------------------------------------------------
  def contents_height
    height - standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # ● Rows
  #--------------------------------------------------------------------------
  def row_num
    return 3
  end
  #--------------------------------------------------------------------------
  # ● Getting Digits
  #--------------------------------------------------------------------------
  def col_max
    return 2
  end
  #--------------------------------------------------------------------------
  # ● Update the Bottom Padding
  #--------------------------------------------------------------------------
  def update_padding_bottom
  end
  #--------------------------------------------------------------------------
  # ● Gets the width of the blanks
  #--------------------------------------------------------------------------
  def spacing
    return 16
  end
  #--------------------------------------------------------------------------
  # ● Actor Limit
  #--------------------------------------------------------------------------
  def item_max
    return [@actors.size, 6].min
  end
  #--------------------------------------------------------------------------
  # ● File changes
  #--------------------------------------------------------------------------
  def file_index=(index)
    return if @file_index == index
    @file_index = index
    header = DataManager.load_header(@file_index)
    @actors   = !header.nil? ? header[:actors] : []
    @map_name = !header.nil? ? header[:map_name] : ""
    @playtime = !header.nil? ? header[:playtime_s] : ""
    @gold     = !header.nil? ? header[:gold] : ""
    @var      = !header.nil? ? header[:var] : ""
    create_contents
    refresh
  end
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------
  def refresh
    super
    if @actors.empty? or @actors.nil?
      #draw_text(0, 0, contents_width, contents_height, INFO::SPEICHER, 1)
      draw_text(0, 0, contents_width, contents_height, "empty slot", 1)
      return
    end
    draw_text(0, 0, contents_width, line_height, @map_name)
    draw_playtime(200, 0, contents_width - 200)
    draw_horz_line(line_height)
    draw_icon(361, 0, fitting_height(2))
    draw_text(24, fitting_height(2), contents_width, line_height, "Gold")
    draw_text(0, fitting_height(2), 300, line_height, @gold, 2)
    draw_icon(232, 0, fitting_height(3))
    draw_text(24, fitting_height(3), contents_width, line_height, "Var1 Text")
    draw_text(0, fitting_height(3), 300, line_height, @var[0], 2)
    draw_icon(232, 0, fitting_height(4))
    draw_text(24, fitting_height(4), contents_width, line_height, "Var2 Text")
    draw_text(0, fitting_height(4), 300, line_height, @var[1], 2)
    draw_icon(232, 0, fitting_height(5))
    draw_text(24, fitting_height(5), contents_width, line_height, "Var3 Text")
    draw_text(0, fitting_height(5), 300, line_height, @var[2], 2)
    draw_icon(232, 0, fitting_height(6))
    draw_text(24, fitting_height(6), contents_width, line_height, "Var4 Text")
    draw_text(0, fitting_height(6), 300, line_height, @var[3], 2)
    draw_icon(232, 0, fitting_height(7))
    draw_text(24, fitting_height(7), contents_width, line_height, "Var5 Text")
    draw_text(0, fitting_height(7), 300, line_height, @var[4], 2)
  end
  #--------------------------------------------------------------------------
  # ● Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    return if @actors.empty? or @actors.nil?
    actor = @actors[index]
    rect = item_rect(index)
    rect.y += line_height * 2
    #draw_actor_face(actor, rect.x, rect.y, !actor.dead?)
    #draw_actor_name(actor,  rect.x + 100, rect.y+line_height*0)
    #draw_actor_level(actor, rect.x + 100, rect.y+line_height*1)
    w = [124, rect.width - 100].min
    #draw_actor_hp(actor,   rect.x + 100, rect.y+line_height*2, w)
    #draw_actor_mp(actor,   rect.x + 100, rect.y+line_height*3, w)
  end
  #--------------------------------------------------------------------------
  # ● Draw Playtime
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width)
    draw_text(x, y, width, line_height, @playtime, 2)
  end
  #--------------------------------------------------------------------------
  # ● Draw a horizontal line
  #--------------------------------------------------------------------------
  def draw_horz_line(y)
    line_y = y + line_height / 2 - 1
    contents.fill_rect(0, line_y, contents_width, 2, line_color)
  end
  #--------------------------------------------------------------------------
  # ● Gets the color of the horizontal line
  #--------------------------------------------------------------------------
  def line_color
    color = normal_color
    color.alpha = 48
    color
  end
end
   
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● Create a save file window
  #--------------------------------------------------------------------------
  alias create_savefile_windows_save create_savefile_windows
  def create_savefile_windows
    create_savefile_windows_save
    @info_window = Window_SaveInfo.new(@savefile_windows[0].window_width, @help_window.height)
  end
  #--------------------------------------------------------------------------
  # ● Initialization of Selected State
  #--------------------------------------------------------------------------
  alias init_selection_save init_selection
  def init_selection
    init_selection_save
    @info_window.file_index = @index
  end
  #--------------------------------------------------------------------------
  # ● Get the number of save files that are displayed in the screen
  #--------------------------------------------------------------------------
  def visible_max
    return @savefile_viewport.rect.height / @help_window.height
  end
  #--------------------------------------------------------------------------
  # ● Cursor updates
  #--------------------------------------------------------------------------
  alias update_cursor_save update_cursor
  def update_cursor
    update_cursor_save
    @info_window.file_index = @index
  end
end

*Edit: Tweaked Window_SaveInfo.refresh a bit to fix the alignment issue. The numbers are further to the left of the screen to give a bit more wiggle room for larger values as well.
@Marrend: That's super cool! Thanks a lot for your effort. I really appreciate that. :)
Pages: 1