XP 스크립트

Source Thread: http://www.creationasylum.net/forum/index.php?showtopic=22162
  세이브파일의 갯수를 사용자가 지정할 수 있는 스크립트입니다. 그래픽 커서를 사용하며, 파일명은 cursor로 해 줘야 합니다.(이거 커서그림 안쓰는 방법 없을까요)


#=============================================
# Custom Save System (CSS)
#------------------------------------------------------------------------------
# Created By: StupidStormy36
# Version ID: 1.01
# Started on: 04/10/08 @ 8:36 pm EST
# Finished on: 04/10/08 @ 11:24 pm EST (Beleive it or not, YAY!!)
#=============================================
# This script allows you to have as many save files as necessary for your game.
# Simply find GAME_SAVES and change the value to your liking.
#
# This overwrites the Scene_File class and the Window_SaveFile class.
# This will overwrite any other custom save menus.
#
# You will need your own cursor image for this to work properly!
# It can be anything but keep it small.
# And remember to name it "cursor.png", OK?
#
# If there are any suggestions to make this script cleaner and more efficient, please let me know.
#
# If there are any errors, let me know that too, OK!
#
# Please credit me for this.
#=============================================



# Initializes save game number.
# You only have to edit this and the rest handles itself.


GAME_SAVES = 50 # <<============================ *CUSTOMIZE*

# End of customization.

# End of custom initialization.
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
# This window displays save files on the save and load screens.
#==============================================================================

class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :filename # file name
attr_reader :selected # selected
#--------------------------------------------------------------------------
# * Object Initialization
# file_index : save file index (0..Game Saves max)
# filename : file name
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 64 + file_index % GAME_SAVES * 104, 640, 104) #<<== *EDIT*
self.contents = Bitmap.new(width - 32, height - 32)
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
refresh
@selected = false
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
#if @selected
#self.cursor_rect.set(0, 0, @name_width + 8, 32)
#else
self.cursor_rect.empty
#end
end
#--------------------------------------------------------------------------
# * End of Class Definition
#--------------------------------------------------------------------------
end


#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This is a superclass for the save screen and load screen.
#==============================================================================


class Scene_File
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates cursor bitmap.
@cursor = Sprite.new #<<============================= *NEW*
@cursor.bitmap = RPG::Cache.picture("cursor")
@cursor.x = 0
@cursor.z = 1100
# Make help window
@help_window = Window_Help.new
@help_window.set_text(@help_text)
@help_window.z = 999
# Make save file window
@savefile_windows = []
for i in 0..GAME_SAVES - 1 #<<============================= *EDIT*
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
# Select last file to be operated
@file_index = $game_temp.last_file_index
@savefile_windows[@file_index].selected = true
# Execute transition
update_cursor
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose items
@cursor.dispose
@help_window.dispose
for i in @savefile_windows
i.dispose
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_cursor
# Update items
@cursor.update
@help_window.update
for i in @savefile_windows
i.update
end
# If C button was pressed
if Input.trigger?(Input::C)
# Call method: on_decision (defined by the subclasses)
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
# If B button was pressed
if Input.trigger?(Input::B)
# Call method: on_cancel (defined by the subclasses)
on_cancel
return
end
# If the down directional button was pressed
if Input.repeat?(Input::DOWN)
# If the down directional button pressed down is not a repeat,
# or cursor position is more in front than the maximum game saves - 1
if Input.trigger?(Input::DOWN) or @file_index < (GAME_SAVES - 1) #<<== *EDIT*
# Play cursor SE
update_window_position_down
$game_system.se_play($data_system.cursor_se)
# Move cursor down
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 1) % GAME_SAVES #<<============ *EDIT*
@savefile_windows[@file_index].selected = true
return
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
# If the up directional button pressed down is not a repeat
# or cursor position is more in back than 0
if Input.trigger?(Input::UP) or @file_index > 0
# Play cursor SE
update_window_position_up
$game_system.se_play($data_system.cursor_se)
# Move cursor up
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + GAME_SAVES - 1) % GAME_SAVES #<<=== *EDIT*
@savefile_windows[@file_index].selected = true
return
end
end
# if F9 is pressed and in debug mode, prints out neccessary info only.<<==== *NEW*
if Input.trigger?(Input::F9) and $DEBUG
p @file_index
p @cursor.y
p @savefile_windows[0].y
end
end
# <<============================================== # *NEW*
#--------------------------------------------------------------------------
# * Updates Cursor Image Position
#--------------------------------------------------------------------------
def update_cursor
if @savefile_windows[0].y != 64
@cursor.y = @file_index * 104 + 0 + @savefile_windows[0].y
else
@cursor.y = @file_index * 104 + 128 - @savefile_windows[0].y
end
end
#--------------------------------------------------------------------------
# * Updates Save Window Positions when UP is pressed.
#--------------------------------------------------------------------------
def update_window_position_up
# If Cursor image y value equals 64 and file index is greater than top most...
if @cursor.y == 64 and @file_index > 0
# Move all windows down
for i in @savefile_windows
i.y += 104
end
# If file index is top most...
elsif @file_index == 0
# Reinitializes window positions.
for i in @savefile_windows
i.y -= 104 * (GAME_SAVES - 1) - (376 - 64)
@cursor.y = 376
end
end
end
#--------------------------------------------------------------------------
# * Updates Save Window Positions when DOWN is pressed.
#--------------------------------------------------------------------------
def update_window_position_down
# If Cursor image y value equals 376 and file index is less than bottom most...
if @cursor.y == 376 and @file_index < (GAME_SAVES - 1)
# Move all windows up
for i in @savefile_windows
i.y -= 104
end
# If file index is bottom most...
elsif @file_index == (GAME_SAVES - 1)
# Reinitializes window positions.
for i in @savefile_windows
i.y += 104 * (GAME_SAVES - 1) - (376 - 64)
@cursor.y = 64
end
end
end
#--------------------------------------------------------------------------
# * End of Class Definition
#--------------------------------------------------------------------------
end


커서파일:


**원본 스크립트에서 기본 스크립트와 중복되는 부분 빼고, 폰트설정부분을 삭제했습니다($defaultfonttype같은 것은 초기에 돌아다닌 해적판 쓰는 사람 아니면 필요없습니다.  굳이 폰트를 바꾸고 싶다면 Window_SaveFile::initialize에 self.contents.font.name = (폰트명)을 넣기 바랍니다).


**사실 이런 스크립트를 제대로 쓰려면 Scene_Title의 main도 수정해야 합니다.
Scene_Title::main에서:   
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
부분을 찾아 VX의 Scene_Title에 사용된 것처럼
    @continue_enabled = (Dir.glob('Save*.rxdata').size > 0)
로 수정하면 세이브파일 갯수에 관계없이 컨티뉴 명령을 통해 불러오기가 가능합니다.

Comment '3'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
841 이동 및 탈것 이벤트의 점프의 길이를 자유자제로~! 아랫꺼 업글버전 3 file 백호 2009.02.21 1575
840 이동 및 탈것 이벤트의 스크립트로 기동하는 점프 루트 완성 2 file 백호 2009.02.21 1698
839 이동 및 탈것 이벤트가 이벤트를 따라가는것 8 백호 2009.02.22 1872
838 이벤트 클릭 시스템 [마우스 스크립트]| 36 아방스 2007.11.09 5622
837 기타 이벤트 범위 스크립트 2 Tine 2012.07.25 1580
836 이름입력 이름입력스크립트 ps인간 2009.01.23 3632
835 HUD 이름띄우기스크립트 - [ID홍길동] 이 아닌 [홍길동]으로 표기하기 27 블루레스 2009.11.06 4054
834 이동 및 탈것 이동속도[빈도]를 높히거나 낮추게할수있는 스크립트 5 - 하늘 - 2009.08.06 2759
833 이동 및 탈것 이동루트에 애니메이션커맨드 추가 1 file 백호 2009.02.21 1047
832 이동 및 탈것 이동루트에 관해서... 2 WMN 2008.03.17 1486
831 이동 및 탈것 이동루트 설정 스크립트-특정범위 13 file 『★Browneyedgirls』 2010.02.18 2000
830 이동 및 탈것 이거만드느라 똥줄탓다!(는뻥) 초간단스크립트 10 *PS인간 2009.02.10 2369
829 오디오 음악감상 스크립트 3 file 백호 2009.02.21 1126
828 오디오 음악 재생 스크립트 3 file 백호 2009.02.21 1140
827 메시지 윈도우즈 확장 file 백호 2009.02.21 2564
826 윈도우_게이지 (HP, SP, 경험치<소수점포함>… 12 WMN 2008.04.06 4859
825 전투 위치보정스크립트 한글화 1 백호 2009.02.22 922
824 기타 요리스크립트 (구) 6 *ps인간 2009.01.26 1932
823 기타 요리 시스템 스크립트 12 file 백호 2009.02.21 2022
822 온라인 온라인스크립트 실행방법 13 file 백호 2009.02.22 4275
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52