Juke Box Script
#1
Juke Box Script
by polraudio
Jun 17, 2007

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.

This is my 1st script please tell me what you think

Replace Scene_Title with this if your using it with the title
Code:
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================

class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "New Game"
s2 = "Continue"
s3 = "Shutdown"
s4 = "Juke Box"
@command_window = Window_Command.new(192, [s1, s2, s3, s4])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
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 of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 2 # Shutdown
command_shutdown
when 3 #Juke Box
command_Juke
end
end
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
#----------------------------------------------------------------------
# * Juke Box
#----------------------------------------------------------------------
def command_Juke
$scene = Scene_Juke.new
end
end

If you wish to make it a call script follow instructions in the comments in the script
$scene = Scene_Juke.new if you are using the call script instead of the title

Add This Above Main
Code:
############################ ########## # # # # #######
# Juke Box Script # # # # # # #
# created by: Polraudio # # # # ## #####
# created on: June 16, 2006# # # # # # # #
# version: 1.0 # ###### ####### # # #######
# credits: Polraudio #
##############################################################################
# If you want to add your own Music just look through the script for comments#
# I have instrusctions there #
# MAKING NEW PAGES #
# To make a new page copy Scene_Juke2 and paste it right on the last line and#
# chage the name of the scene to to Scene_Juke3 for page 3 then on line 285 #
# change that to $scene = Scene_Juke3.new to go to the new page you just #
# created. Any questions, comments or bugs E-mail me at polraudio@Gmail.com #
##############################################################################
class Scene_Juke
def main
#You can change the name of the songs here
s1 = "Exit Juke Box" #Line 96 to change it to a call script if you change this
s2 = "001-Battle01" #you don't need to copy Scene_Title
s3 = "002-Battle02"
s4 = "003-Battle03"
s5 = "004-Battle04"
s6 = "005-Boss01"
s7 = "006-Boss02"
s8 = "007-Boss03"
s9 = "008-Boss04"
s10 = "009-LastBoss01"
s11 = "010-LastBoss02"
s12 = "011-LastBoss03"
s13 = "012-Theme01"
s14 = "¥Next¥"
@command_window = Window_Command.new(200, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13,s14])
@command_window.x = 100 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
@command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Title.new # Change With $scene = Scene_Map.new
return # For call script to work
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_001
when 1
command_002
when 2
command_003
when 3
command_004
when 4
command_005
when 5
command_006
when 6
command_007
when 7
command_008
when 8
command_009
when 9
command_010
when 10
command_011
when 11
command_012
when 12
command_013
when 13
command_014
end
return
end
end
#Music Starts Here
def command_001
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Title.new # Change with $scene = Scene_Map.new
end # For call script to work
def command_002
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "001-Battle01", 100, 100)
# right here^you can add your own music bo changing 001-Battle01
# To the name of your song
# Note:It's not case sensitive but the song name has to be exact
end
def command_003
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "002-Battle02", 100, 100)
end
def command_004
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "003-Battle03", 100, 100)
end
def command_005
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "004-Battle04", 100, 100)
end
def command_006
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "005-Boss01", 100, 100)
end
def command_007
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "006-Boss02", 100, 100)
end
def command_008
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "007-Boss03", 100, 100)
end
def command_009
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "008-Boss04", 100, 100)
end
def command_010
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "009-LastBoss01", 100, 100)
end
def command_011
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "010-LastBoss02", 100, 100)
end
def command_012
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "011-LastBoss03", 100, 100)
end
def command_013
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "012-Theme01", 100, 100)
end
def command_014
$game_system.se_play($data_system.decision_se)
$scene = Scene_Juke2.new #calls Scene_Juke2 witch is below. Also knowen as page 2
end #When s14 is pressed it will call this script and go
end #to Scene_Juke2
#############################################################################
# Page 2
#############################################################################
class Scene_Juke2 #The same as the 1st scene its just page 2 after you hit s14
def main #on the 1st scene it will bring you to this one
s1 = "£Back£"
s2 = "013-Theme02"
s3 = "014-Theme03"
s4 = "015-Theme04"
s5 = "016-Theme05"
s6 = "017-Theme06"
s7 = "018-Field01"
s8 = "019-Field02"
s9 = "020-Field03"
s10 = "021-Field04"
s11 = "022-Field05"
s12 = "023-LastBoss03"
s13 = "024-Theme01"
s14 = "¥Next¥"
@command_window = Window_Command.new(200, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13,s14])
@command_window.x = 300 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
@command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Juke.new #When the cancel button is pressed it will bring you
return #to the Scene_Juke witch is the 1st page
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_001
when 1
command_002
when 2
command_003
when 3
command_004
when 4
command_005
when 5
command_006
when 6
command_007
when 7
command_008
when 8
command_009
when 9
command_010
when 10
command_011
when 11
command_012
when 12
command_013
when 13
command_014
end
end
def command_001
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Juke.new
end
def command_002
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "013-Theme02", 100, 100)
end
def command_003
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "014-Theme03", 100, 100)
end
def command_004
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "015-Theme04", 100, 100)
end
def command_005
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "016-Theme05", 100, 100)
end
def command_006
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "017-Theme06", 100, 100)
end
def command_007
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "018-Field01", 100, 100)
end
def command_008
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "019-Field02", 100, 100)
end
def command_009
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "020-Field03", 100, 100)
end
def command_010
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "022-Field04", 100, 100)
end
def command_011
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "023-Fiels05", 100, 100)
end
def command_012
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "024-Town01", 100, 100)
end
def command_013
$game_system.se_play($data_system.decision_se)
Audio.bgm_play("Audio/BGM/" + "012-Town02", 100, 100)
end
def command_014
$game_system.se_play($data_system.decision_se)
$scene = Scene_Juke.new
end
end
end


Updated version
DEMO: http://www.box.net/shared/qj5yr5zo50


Enjoy the script
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Steal and Mug Script Lethrface 0 3,039 08-08-2011, 01:00 PM
Last Post: Lethrface
  Book Script and Utility Bruth 0 2,736 06-10-2009, 01:00 PM
Last Post: Bruth
  Custom EXP Script Dargor 0 2,557 11-24-2007, 01:00 PM
Last Post: Dargor
  Clan Script ShockWave 0 2,609 08-27-2007, 01:00 PM
Last Post: ShockWave
  ARMS Script El Conductor 0 2,562 08-04-2007, 01:00 PM
Last Post: El Conductor
  Quest Script Samo the thief 0 2,557 03-12-2007, 01:00 PM
Last Post: Samo the thief
  Quest Script by SAMO Samo the thief 0 2,519 12-29-2006, 01:00 PM
Last Post: Samo the thief
  An easier WORKING party change script The Ghost 0 2,490 07-09-2006, 01:00 PM
Last Post: The Ghost
  Mission Script Leon Westbrooke 0 2,723 07-04-2006, 01:00 PM
Last Post: Leon Westbrooke
  Mining Script GoldenShadow 0 2,498 03-05-2006, 01:00 PM
Last Post: GoldenShadow



Users browsing this thread: 1 Guest(s)