Przede wszystkim nie "S1" tylko "Sl" (małe L) ;)
Błąd sugeruje brak zainicjowania stałej o tej nazwie. Constant w języku RUBY może być definiowane w klasach lub modułach.
Niestety nie mam RM XP żeby przetestować i wskazać dokładne rozwiązanie ale może lepiej spróbuj użyć innego skryptu?
#===============================================================================
# Liz's Autosave Script
#-------------------------------------------------------------------------------
# Just place this script below all default scripts and above main.
# It will handle itself.
#
# To Auto-save:
# Use the 'Script...' command and input:
# Autosave.save
#===============================================================================
module Autosave
def self.save
filename = make_filename(0)
file = File.open(filename, "wb")
write_save_data(file)
file.close
end
def self.write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
def self.make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
end
class Window_SaveFile < Window_Base
def refresh
self.contents.clear
self.contents.font.color = normal_color
if @file_index == 0
name = "Autosave"
if $scene.is_a?(Scene_Save)
self.contents.font.color = disabled_color
end
else
name = "File #{@file_index}"
self.contents.font.color = normal_color
end
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
if @file_exist
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.contents.blt(x, 68 - ch, bitmap, src_rect)
end
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 8, 600, 32, time_string, 2)
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(4, 40, 600, 32, time_string, 2)
end
end
end
class Scene_Save < Scene_File
alias lizzie_autosave_ss_ondec on_decision
def on_decision(filename)
if filename.include?("Save1.rxdata")
$game_system.se_play($data_system.buzzer_se)
return
end
lizzie_autosave_ss_ondec(filename)
end
end