Bitte beachtet das es mein erstes Script ist bevor ihr mit zu harter Kritik kommt,
danke.
Kurze erklärung:
Es erweitert das Normale Speicher Menü um 2 weiter Speicherplätze.
Es ist mein erstes Script und ich lerne noch, das heißt ich werde es nach und nach noch verbessern.
Den Code über Main einfügen
Changelog v.0.2
-Varierende Namen für "Gespeichert" und "Nicht gespeichert" hinzu gefügt.
-Kompatiblitätsprobleme behoben
v.0.2
#==============================================================================
# ** 6 Save Files
#------------------------------------------------------------------------------
# (C)By Lenni96 and Ranack
#
# v.0.2
#
# Deutsch:
# Bitte ändert zuerst einmal die Variabeln.
#
# English:
# Please change the variables first.
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Variables
# Please Change the variable with the names for saved file and unsaved
# file.
#
# Bitte ändere die Variabeln für die Namen für gespeicherte und nicht
# gespeicherte datei.
#--------------------------------------------------------------------------
$filenameunsaved = "unsaved file"
$filenamesaved = "saved file"
#--------------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------------
attr_reader :filename # filename
attr_reader :file_exist # file existence flag
attr_reader :time_stamp # timestamp
attr_reader :selected # selected
#--------------------------------------------------------------------------
# * Object Initialization
# file_index : save file index (0-3)
# filename : filename
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 56 + file_index % 6 * 60, 544, 60)
@file_index = file_index
@filename = filename
load_gamedata
refresh
@selected = false
end
#--------------------------------------------------------------------------
# * Load Partial Game Data
# By default, switches and variables are not used (for expansion use,
# such as displaying place names)
#--------------------------------------------------------------------------
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
if @file_exist
name = $filenamesaved
else
name = $filenameunsaved
end
self.contents.draw_text(4, 0, 200, WLH, name)
@name_width = contents.text_size(name).width
if @file_exist
draw_playtime(0, 4, contents.width - 4, 2)
end
end
#--------------------------------------------------------------------------
# * Draw Party Characters
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_party_characters(x, y)
for i in 0...@characters.size
name = @characters[i][0]
index = @characters[i][1]
draw_character(name, index, x + i * 48, y)
end
end
#--------------------------------------------------------------------------
# * Draw Play Time
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
# width : Width
# align : Alignment
#--------------------------------------------------------------------------
def draw_playtime(x, y, width, align)
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("Spielzeit: %02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width, WLH, time_string, 2)
end
#--------------------------------------------------------------------------
# * Set Selected
# selected : new selected (true = selected, false = unselected)
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @selected
self.cursor_rect.set(0, 0, @name_width + 8, WLH)
else
self.cursor_rect.empty
end
end
end
Credits müssen nicht sein, wenn doch dann an ranack und mich
Kritik und Lob sind erwünscht