Hiya,
I've created a little script, but it doesn't work proparly...
It should show the world map, and it does, but when I click on esc. it doesn't go back to the menu, so I've created a "Back" option, but still it doesn't work...
This is the script:
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
# This wil show the world map
#==============================================================================
class World_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = "Back"
s2 = "test"
# Make command window
@command_window = Window_Command.new(160, [s1, s2])
Graphics.transition(0)
Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
$scene = World_Map.new(false)
# Play decision SE
$game_system.se_play($data_system.cancel_se)
# Switch to item screen
$scene = Scene_Menu.new
end
end
end
end
end
Anyone who knows the problm?
First off, you're updating the graphics about a billion times more than you should be.
But your problem is that you're not checking for Input inside the loop.
I used the graphics update that much cause I needed the pictures to look like a little animation.
(Its a map that opens)
And what you are saying about the input thingy, is this what you mean?:
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
or maybe this?:
# Update input information
Input.update
Could you explain what I dit wrong or still have to do?
But... in verry clear language please, I'm not that good in scripting or... eh english :^_^':
The
loop do
#stuff
if $scene != self
break
end
end
loop. You're not doing anything in it, which is the problem. You have to check for input there. In other words, you'll have to add the update_command code/call there.
Replace your loop with this
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
update_command
# Abort loop if screen is changed
if $scene != self
break
end
end
Ok thanks for the help you guys, but I'm still getting errors :<_<:
I think I was getting this errors because I copied certain parts from other scripts...
I've deleted the stuff I thought they where cousing the errors, but I don't know what to write there instead. Maybe you guys know what I have to write there instead?
I'll put this
on every place I've been messing around.
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
# This wil show the world map
#==============================================================================
class World_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = "Back"
s2 = "test"
# Make command window
@command_window = Window_Command.new(160, [s1, s2])
Graphics.transition(0)
Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
update_command
# Abort loop if screen is changed
if $scene != self
break
end
end
def update_command
if Input.repeat?(Input::UP)
if @command_window.index == 0
@command_window.index = ? :ninja:
else
@command_window.index -= 1
end
unless @questids.size == 1
$game_system.se_play($data_system.cursor_se) unless ? :ninja:
@status_window.refresh
end
end
if Input.repeat?(Input::DOWN)
if @command_window.index == ? :ninja:
@command_window.index = 0
else
@command_window.index += 1
end
unless ? :ninja:
$game_system.se_play($data_system.cursor_se)
@status_window.refresh
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # Back
$scene = World_Map.new(false)
# Play decision SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new
end
end
end
end
replace this
if Input.repeat?(Input::UP)
if @command_window.index == 0
@command_window.index = ? :ninja:
else
@command_window.index -= 1
end
unless @questids.size == 1
$game_system.se_play($data_system.cursor_se) unless ? :ninja:
@status_window.refresh
end
end
if Input.repeat?(Input::DOWN)
if @command_window.index == ? :ninja:
@command_window.index = 0
else
@command_window.index += 1
end
unless ? :ninja:
$game_system.se_play($data_system.cursor_se)
@status_window.refresh
end
with
You do not need to add the up and down movement of a window as it already has it.
I'm close, I feel it.
I'm not getting any errors but when I click on "back" It doesn't do anything...
The code how it is right now:
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
# This wil show the world map
#==============================================================================
class World_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = "Back"
s2 = "test"
# Make command window
@command_window = Window_Command.new(160, [s1, s2])
Graphics.transition(0)
Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
@command_window.update
# Abort loop if screen is changed
if $scene != self
break
end
end
def update_command
@command_window.update
# Branch by command window cursor position
case @command_window.index
when 0 # Back
$scene = World_Map.new(false)
# Play decision SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new
return
end
return
end
end
end
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
# This wil show the world map
#==============================================================================
class World_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = "Back"
s2 = "test"
# Make command window
@command_window = Window_Command.new(160, [s1, s2])
Graphics.transition(0)
Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
update_command
# Abort loop if screen is changed
if $scene != self
break
end
end
def update_command
@command_window.update
# Branch by command window cursor position
case @command_window.index
when 0 # Back
$scene = World_Map.new(false)
# Play decision SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new
return
end
return
end
end
end
There now try it
(http://img40.imageshack.us/img40/9268/78785233.png)
Dang...
nobodhy's answering... :twitch:
Post your entire script, please.
Game_guy has posted the editted version of my script how it 'chould' work.
(I know its a small script. :^_^': I'm not really a good scripter...)
:wong: Bump
Bump, and if you really need it, here's my script (again :P)
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
# This wil show the world map
#==============================================================================
class World_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = "Back"
# Make command window
@command_window = Window_Command.new(160, [s1])
@command_window.x = 480
@command_window.y = 0
Graphics.transition(0)
Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
@sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
@command_window.update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Menu.new(5)
return
end
# Branch by command window cursor position
case @command_window.update
when 1 # Back
# Play decision SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(5)
return
end
return
end
end
BUMP! :sos:
BUMP!! :<_<:
Look, this script is nowhere near close to being correct. You have a better chance of posting a request and getting that filled than someone taking the time to fix the mountain of issues with this.
Mountain? You mean mountain chain. :V:
Ergh... ok, so far for trying to script :(