2 hours ago was my first time being able to script. I made a quick script off of what i know and i want to know if it is good for only knowing scripting for 2 hours.
should i continue it or not?
remember its my first script
Replace Scene_Title With this if you are using The Title Verson
#==============================================================================
# ** 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
############################ ########## # # # # #######
# 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
Two questions: Are you sure the Jukebox script is by you when it's in Japanese? Also, isn't there Tsuno's juke? One more question XD: What's this script do??
1.I have the jap scripts cause im using pk
2.it just lets you play music from the game(Not finished)
did you test it?
Oh, I see.... And no, sorry, I haven't. I'm currently at my friend's house and I don't think he has RMXP. Nope. I'll try it out when I can. I guess this is different from Tsuno's because his works with yeah. Okay. Good job on a first script after only 2 hours of learning.
Thanks for the comment. Do you happen to know where his juke script is?
Script Database entitled "Flesh of a Radio": http://rmrk.net/index.php/topic,12956.0.html
Thanks this might help me learn how to script better
Cool script! I have a question, can this be used from somewhere else? Like the menu....or from a common event that activates when an item is used? Example: I have an item named jukebox. When the player use the item, it goes to the juke screen. Can that be done?
Thanks,
Lol, 2 hours :tpg:
I could script forever if I had the time ;8
I'll try this, it may come in handy ;8
[EDIT]
That's some nice script you have there
Would it be alright if I used this in my game? I'd credit you of course ;8
@magic2345 - Yes you could, as long as you can't activate it from the title screen, if you want it activatable from both... you'll have to clone the script and name the second one differently, and make it go back to the menu
Quote from: Rune on June 16, 2007, 09:33:28 AM
@magic2345 - Yes you could, as long as you can't activate it from the title screen, if you want it activatable from both... you'll have to clone the script and name the second one differently, and make it go back to the menu
Or a small edit could be done to the script to take it back to the game map ONLY if it was called from the item menu. I recall Blizzard helped me do something like that with a script of mine.
Am I right in correct in guessing that you have copied a script like the default Scene_Menu and edited to feed your needs?
It is quite nice for your first script ^_^
Tsuno have not made a jukebox, Tsu just made a part which searches for music files, stores them and allows you to find and play music on the list. No scene nor window have been made for it.
It is as Tsu wrote a "Flesh of a Radio", not a radio in itself.
It is more difficult to use since you have to make the menu dynamically. That is, it changes accordingly to how many songs there are.
To make an item which calls the juke box simple let the item call a common event. (Trigger = none)
Put a script call (Page 3 - bottom, right) containing the following in the common event:
$scene = Scene_Juke.new
It will call the scene when you try to use the item.
You will however go back to the title screen when exiting the jukebox.
I haven't tested this, but it might work. (Remember to take a backup)
Add this method to your Scene_Juke: (You can put it just before the main method)
def initialize(scene = $scene)
@scene = scene
end
Then find the line with $scene = Scene_Title.new and replace it with this:
$scene = @scene
Quote from: magic2345 on June 16, 2007, 03:07:44 AM
Cool script! I have a question, can this be used from somewhere else? Like the menu....or from a common event that activates when an item is used? Example: I have an item named jukebox. When the player use the item, it goes to the juke screen. Can that be done?
Thanks,
If you want i can make 2 versions. 1 to have it on the title and for the 2nt one i could have it a call script. I will leave comments in the script on how to add your own things after i finish it.
Quote from: ZeriabAm I right in correct in guessing that you have copied a script like the default Scene_Menu and edited to feed your needs?
I used Scene_End and non-scripters if you dont know how to script you may learn by editing my script. Scene_End is the way to learn fast about commands
Update:Added more songs and made page2 better
It's looking better ^_^
You should try to do what I suggested ;)
From your title: Mod Move this topic please
What do you mean?
move it to the script database
You can't just request a move, only the best scripts go into the database, notice how the database has only one or two pages? A mod has to confirm that it's worthy of the database
I cannot allow this script in the database yet, not in it's current state.
Keep working on it and if it gets good enough I can move it to the database ^_^
Don't get your hopes too high up. Remember this is your first script ;)
If you changed the script so that it reads and gets all the compatible files from the appropriate folder and automatically creates the pages necessary to display them I would more likely than not move the script into the database.
Creating dynamic scripts is however a bit more difficult.
I'll edit the topic since it won't be moved yet.
My second type of script (savepoint) got into the database :D I'm gonna be proud of that for ages :D
But don't let that get your hopes up :P
well i got lost of work to do