XP 스크립트

Source Thread: http://www.creationasylum.net/forum/index.php?showtopic=22162
  이미지 커서 사용여부를 설정할 수 있도록 바뀐 버전입니다.  스크립트가 버전업되었는데도 헤더는 안 바뀌었더군요.  일단 제목에 버전 대신 스크립트가 나온 날짜를 넣었습니다.
  그래픽 커서를 사용할 경우 커서파일명은 'cursor.png'여야 합니다.(GraphicsPictures에 들어감)


#===============================================================================

# 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.
#
#---------------------------
# Small update!
#
# You can now choose to show the cursor image or not. You do not need the
# cursor image any more!
#===============================================================================




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


GAME_SAVES = 50 # Sets the number of save files.
USE_CURSOR_IMAGE = true # Sets whether or not to display the cursor image.
DEFAULT_FONT_FACE = "Tahoma" # Change this to display the text in a certain font face.
DEFAULT_FONT_SIZE = 22 # Change this to change the font size.

# End of customization.

# !!! DO NOT EDIT AFTER THIS POINT !!!

# 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)
self.contents.font.name = DEFAULT_FONT_FACE
self.contents.font.size = DEFAULT_FONT_SIZE
@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
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Draw file number
self.contents.font.color = normal_color
name = "File#{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
# If save file exists
if @file_exist
# Draw character
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
# Draw play time
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)
# Draw timestamp
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)
else
self.contents.draw_text(4, 40, 600, 32, "No Data")
end
end
#--------------------------------------------------------------------------
# * Set Selected
# selected : new selected (true = selected, false = unselected)
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @selected
unless USE_CURSOR_IMAGE
self.cursor_rect.set(0, 0, @name_width + 8, 32)
else
self.cursor_rect.empty
end
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
#--------------------------------------------------------------------------
# * Object Initialization
# help_text : text string shown in the help window
#--------------------------------------------------------------------------
def initialize(help_text)
@help_text = help_text
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates cursor bitmap.
@cursor = Sprite.new #<<============================= *NEW*
if USE_CURSOR_IMAGE
@cursor.bitmap = RPG::Cache.picture("cursor")
else
@cursor.bitmap = Bitmap.new(1, 1)
@cursor.bitmap.fill_rect(0, 0, 3, 3, Color.new(0, 0, 0, 0))
end
@cursor.x = 0
@cursor.z = 1100
@cursor.visible = USE_CURSOR_IMAGE
# 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 #<<============================= *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
#--------------------------------------------------------------------------
# * Make File Name
# file_index : save file index (0..Game Save max - 1)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
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



List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6159
801 전투 Star Ocean Battle System 3 file 백호 2009.02.22 1228
800 메뉴 L's Simple Custom Menu #1 R2 (SDK 2.x 필요) Alkaid 2013.01.18 1228
799 변수/스위치 The Self Data Suite by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1232
798 기타 멋진...제작자 정보를 그림으로 1 백호 2009.02.22 1233
797 장비 전체키 이용을 위한 장비창 스크립트 백호 2009.02.21 1234
796 이동 및 탈것 방향키를 누름에따라 점프의 거리가 길어진다 - 출처:엑사포 의 비밀소년님과 연금술사님의 스크립트를 개량함 3 백호 2009.02.21 1234
795 전투 전투위치 보정 스크립트 1 file 백호 2009.02.21 1234
794 전투 전투의 승리마다 행동에 따라서 능력치가 상승한다! 1 백호 2009.02.22 1238
793 기타 제작한 게임의 파일을 모두 exe파일 하나에 쓸어담기 by sheefo@Creation Asylum 1 file 백호 2009.02.22 1239
792 아이템 아이템 단축키로 구입 스크립트 3 백호 2009.02.22 1243
791 이동 및 탈것 밑에 KIN 님의 MP 없어지는 대쉬, 제가 손좀 봤음 1 백호 2009.02.22 1244
790 기타 무기 회피율, 방어구 공격력 지정 스크립트 6 백호 2009.02.22 1244
789 장비 SIBruno's Advanced Equip Screen v2 file 백호 2009.02.22 1246
788 기타 무기 개조 스크립트 file 백호 2009.02.21 1248
787 전투 Custom Debugger, Battle Debugger by RPG Advocate file 백호 2009.02.22 1248
» 저장 StupidStormy36's Custom Save System 2010-10-06(05?) Edition 1 Alkaid 2010.10.07 1249
785 기타 Etude87_Bone_Animation_Character ver.1.2 4 습작 2012.07.06 1255
784 오디오 WhiteFlute - AudioEX (XP/VX/VXA) file Alkaid 2012.12.26 1255
783 HUD 맵명을 표시하는 스크립트 한글로 번역한것 백호 2009.02.21 1257
782 기타 복권 스크립트 6 백호 2009.02.21 1258
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... 52 Next
/ 52