New Config Scene
#1
New Config Scene
by stupidstormy36
Mar 15, 2008

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Hey! I just put up a CMS in the CMS posting area and I just thought I should post a Config Menu Script similar to the Final Fantasy series.

I know alot of people have been putting out alot of custom options menu, but this is different in terms of configuration tools for your game.
I think it can be customized by just about anyone!

Most of the options have been incorporated into my game that I am making. Of course things like the "VIBRATION" feature won't work but is there to add on an addition option.

It's simple really, use the arrow keys to change options and the C trigger to restore defaults at the end. The only working feature of the bat is the Full Screen option, which I got from someone! (Need to credit)

Anyway, here's the script:
Code:
#=============================================
# Custom Config Menu
#------------------------------------------------------------------------------
# Created By: StupidStormy36
# Version ID: 1.02
# Created on: 02/27/08
# Finished on: 03/18/08
#------------------------------------------------------------------------------
#=============================================


#=============================================
# ¦ Scene_Base
#=============================================
#Handles the looping process by calling main_graphics_update in each scene
#Aurguments are optional as defaults are as follows...
# length = 10
# type = ""
#=============================================


class Scene_Base
def main_graphics_update(length = 10, type = "")
Graphics.transition(length, type)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
end
end


#======================================================
# Scene_Title
#======================================================
# Aliasing the Title Scene to initialize the Game Option.
#======================================================


class Scene_Title
alias stupid_stormy_new command_new_game
def command_new_game
$game_options = Game_Config.new
stupid_stormy_new
end
end

#You'll have to add these to each proper scene


#class Scene_Load < Scene_File
#alias stupid_stormy_load read_save_data
#def read_save_data(file)
#$game_options = Marshal.load(file)
#stupid_stormy_load(file)
#end
#end

#class Scene_Save < Scene_File
#alias stupid_stormy_save write_save_data
#def write_save_data(file)
#Marshal.dump($game_options, file)
#stupid_stormy_save(file)
#end
#end

#======================================================
# Game_Options
#======================================================
# Stores all the config options.
#======================================================


class Game_Config
attr_accessor :skip_scenes
attr_accessor :battle_camera
attr_accessor :subtitles
attr_accessor :vibration
attr_accessor :full_screen
attr_accessor :audio
attr_accessor :voice
attr_accessor :battle_cursor
def initialize
@skip_scenes = false # true:zoom false:normal
@battle_camera = true # true:zoom false:normal
@subtitles = true # true:on false:off
@vibration = true # true:on false:off (doesn't work)
@full_screen = false # true:full false:window
@audio = true # true:stereo false:mono (doesn't work)
@voice = 0 # 0:sound & subtitles 1:subtitles only 2:sound only 3:proceed automatically
@battle_cursor = false # true:memory false:normal
end
def call_screen_mode
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
end
end

#======================================================
# Scene_Config
#======================================================
# The scene for configuration.
#======================================================


class Scene_Config < Scene_Base
def main
@twitch_count = 0
@a = 0
@config_window = Window_Config.new
@wait_window = Window_Wait.new
@wait_window.visible = false
@wait_window.z = 999
@cursor = Sprite.new
@cursor.bitmap = RPG::Cache.picture("Menu/cursor")
@cursor.z = 999
@help_window = Window_MenuHelp.new
@help_window.set_text("Sets to Skip Cutscenes.")
@help_window.ox = -640 + 150
#==============================
update_cursor_position
main_graphics_update
#==============================
@config_window.dispose
@wait_window.dispose
@cursor.dispose
@help_window.dispose
end
def update
@config_window.update
@wait_window.update
@cursor.update
@help_window.update
update_cursor_position
update_help
if @config_window.active
@help_window.ox += 2 if @help_window.ox < 640 - 350
if @help_window.ox >= 640 - 350 then @help_window.ox = - 640 + 150 end
@wait_window.visible = false
update_twitch
update_main
else
@wait_window.visible = true
update_wait
end
end
def update_main

if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or
Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
@help_window.ox = -640 + 150
end

if Input.trigger?(Input::A)
$game_system.se_play($data_system.cancel_se)
#$scene = Scene_SOMenu.new(4)
$scene = Scene_Map.new
end

if Input.trigger?(Input::C) and @config_window.index == 7
$game_system.se_play($data_system.decision_se)
restore_defaults
end

if Input.trigger?(Input::LEFT)
case @config_window.index
when 0
if $game_options.skip_scenes != true
$game_system.se_play($data_system.cursor_se)
$game_options.skip_scenes = true
end
when 1
if $game_options.full_screen != true
$game_system.se_play($data_system.cursor_se)
$game_options.call_screen_mode
$game_options.full_screen = true
@config_window.active = false
end
when 2
if $game_options.battle_camera != true
$game_system.se_play($data_system.cursor_se)
$game_options.battle_camera = true
end
when 3
if $game_options.audio != true
$game_system.se_play($data_system.cursor_se)
$game_options.audio = true
end
when 4
if $game_options.voice > 0
$game_system.se_play($data_system.cursor_se)
$game_options.voice -= 1
end
when 5
if $game_options.vibration != true
$game_system.se_play($data_system.cursor_se)
$game_options.vibration = true
end
when 6
if $game_options.battle_cursor != true
$game_system.se_play($data_system.cursor_se)
$game_options.battle_cursor = true
end
end
@config_window.refresh
return
end

if Input.trigger?(Input::RIGHT)
case @config_window.index
when 0
if $game_options.skip_scenes
$game_system.se_play($data_system.cursor_se)
$game_options.skip_scenes = false
end
when 1
if $game_options.full_screen
$game_system.se_play($data_system.cursor_se)
$game_options.call_screen_mode
$game_options.full_screen = false
@config_window.active = false
end
when 2
if $game_options.battle_camera
$game_system.se_play($data_system.cursor_se)
$game_options.battle_camera = false
end
when 3
if $game_options.audio
$game_system.se_play($data_system.cursor_se)
$game_options.audio = false
end
when 4
if $game_options.voice < 3
$game_system.se_play($data_system.cursor_se)
$game_options.voice += 1
end
when 5
if $game_options.vibration
$game_system.se_play($data_system.cursor_se)
$game_options.vibration = false
end
when 6
if $game_options.battle_cursor
$game_system.se_play($data_system.cursor_se)
$game_options.battle_cursor = false
end
end
@config_window.refresh
return
end
end

def update_wait
@a += 1
if @a == 100
@a = 0
@config_window.active = true
end
end

def update_cursor_position
offset = 50 + 32
if @config_window.index == 7
@cursor.x = 0
@cursor.y = 11 * 32 + offset
elsif @config_window.index == 5 or @config_window.index ==6
@cursor.x = 0
@cursor.y = (@config_window.index + 1) * 32 + offset
else
@cursor.x = 0
@cursor.y = @config_window.index * 32 + offset
end
end

def update_twitch
@twitch_count = (@twitch_count + 1) % 50
if @twitch_count < 2
@cursor.x += 5
else
@cursor.x -= 5 if @cursor.x > 0
end
end

def update_help
case @config_window.index
when 0
@help_window.set_text("Sets to Skip Cutscenes.")
when 1
@help_window.set_text("Enables Fullscreen or Window mode.")
when 2
@help_window.set_text("Sets Battle Camera.")
when 3
@help_window.set_text("Sets Audio Output.")
when 4
@help_window.set_text("Sets Voice and Subtitles settings.")
when 5
@help_window.set_text("Sets Vibration to on or off.")
when 6
@help_window.set_text("Sets battle cursor memory.")
when 7
@help_window.set_text("Restores all configuration settings.")
end
return
end

def restore_defaults
if $game_options.full_screen
$game_options.call_screen_mode
end
$game_options.skip_scenes = false
$game_options.battle_camera = true # true:zoom false:normal
$game_options.subtitles = true # true:on false:off
$game_options.vibration = true # true:on false:off (doesn't work)
$game_options.full_screen = false # true:full false:window
$game_options.audio = true # true:stereo false:mono
$game_options.voice = 0 # 0:sound & subtitles 1:subtitles only 2:sound only 3:proceed automatically
$game_options.battle_cursor = false
@config_window.refresh
end
end

#======================================================
# Window_Config
#======================================================
# The window for configuration.
#======================================================

class Window_Config < Window_Selectable
def initialize
super(0,64,640,480 - 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("Star_Ocean3-no cursor")
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
self.active = true
self.index = 0
@commands = ["Skip Scenes", "Full Screen", "Battle Camera", "Output", "Voice", "Vibration", "Battle Cursor", "Default"]
@item_max = @commands.size
refresh
end

def refresh
self.contents.clear
for i in 0..4
x = 28
y = i * 32
draw_text_outline(x,y,640,32,@commands[i])
self.contents.font.color = normal_color
self.contents.draw_text(x,y,640,32,@commands[i])
end
for i in 5..6
x = 28
y = (i + 1) * 32
draw_text_outline(x,y,640,32,@commands[i])
self.contents.font.color = normal_color
self.contents.draw_text(x,y,640,32,@commands[i])
end
x = 28
y = 11 * 32
draw_text_outline(x,y,640,32,@commands[7])
self.contents.font.color = normal_color
self.contents.draw_text(x,y,640,32,@commands[7])
draw_selected
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
if self.index < 6
self.cursor_rect.set(0, self.index * 32 , self.width - 32, 32)
else
self.cursor_rect.set(0, 8 * 32 , self.width - 32, 32)
end
end

def draw_selected
#==================================================
x = 160 + 80
y = 0 * 32
if $game_options.skip_scenes
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"ON", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"ON" ,1)
if $game_options.skip_scenes
color = disabled_color
else
color = normal_color
end
draw_text_outline(x + 160,y,160,32,"OFF", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"OFF", 1)
#==================================================
x = 160 + 80
y = 1 * 32
if $game_options.full_screen
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"FULL", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"FULL", 1)
if $game_options.full_screen
color = disabled_color
else
color = normal_color
end
draw_text_outline(x + 160,y,160,32,"WINDOW", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"WINDOW", 1)
#==================================================
x = 160 + 80
y = 2 * 32
if $game_options.battle_camera
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"ZOOM", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"ZOOM", 1)
if $game_options.battle_camera
color = disabled_color
else
color = normal_color
end
draw_text_outline(x + 160,y,160,32,"FIXED", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"FIXED", 1)
#==================================================
x = 160 + 80
y = 3 * 32
if $game_options.audio
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"STEREO", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"STEREO", 1)
if $game_options.audio
color = disabled_color
else
color = normal_color
end
draw_text_outline(x + 160,y,160,32,"MONO", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"MONO", 1)
#==================================================
x = 160 + 80
y = 4 * 32
if $game_options.voice == 0
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"SOUND & SUBTITLES", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"SOUND & SUBTITLES", 1)
if $game_options.voice == 1
color = normal_color
else
color = disabled_color
end
draw_text_outline(x + 160,y,160,32,"SUBTITLES ONLY", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"SUBTITLES ONLY", 1)
if $game_options.voice == 2
color = normal_color
else
color = disabled_color
end
x = 160 + 80
y = 5 * 32
draw_text_outline(x,y,160,32,"SOUND ONLY", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"SOUND ONLY", 1)
if $game_options.voice == 3
color = normal_color
else
color = disabled_color
end
draw_text_outline(x + 160,y,160,32,"PROCEED AUTOMATICALLY", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"PROCEED AUTOMATICALLY", 1)
#==================================================
x = 160 + 80
y = 6 * 32
if $game_options.vibration
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"ON", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"ON", 1)
if $game_options.vibration
color = disabled_color
else
color = normal_color
end
draw_text_outline(x + 160,y,160,32,"OFF", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"OFF", 1)
#==================================================
x = 160 + 80
y = 7 * 32
if $game_options.battle_cursor
color = normal_color
else
color = disabled_color
end
draw_text_outline(x,y,160,32,"MEMORY", 1)
self.contents.font.color = color
self.contents.draw_text(x,y,160,32,"MEMORY", 1)
if $game_options.battle_cursor
color = disabled_color
else
color = normal_color
end
draw_text_outline(x + 160,y,160,32,"DEFAULT", 1)
self.contents.font.color = color
self.contents.draw_text(x + 160,y,160,32,"DEFAULT", 1)
#==================================================
end
end


#======================================================
# Window_Wait
#======================================================
# Allows for full screen switch to complete.
# If you were to switch back immediately, the screen would not switch while the
# variable would, causing a problem between the two. This is easily fixed by allowing
# the time differential to syncronize, or something like that.
#======================================================

class Window_Wait < Window_Base
def initialize
super(320 - 100,240 - 50,200,100)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
draw_text_outline(0,16,200-32,32,"Please wait.",1)
self.contents.font.color = normal_color
self.contents.draw_text(0,16,200-32,32,"Please wait.",1)
end
end

I hope this helps somebody.
}




Users browsing this thread: 1 Guest(s)