[VX ACE] Slight delay before opening other windows in the menu?

Tok.wa

Villager
Member
Joined
Nov 21, 2017
Messages
6
Reaction score
0
First Language
Filipino
Primarily Uses
RMVXA
Hi, I was wondering if there is something that I could add into the Scene_Menu (or any script in the game) that makes the game wait n frames before opening other windows in the menu?
For example, when I press X to bring out the menu, I'd like the game to wait 5 frames before opening the gold window, then another 5 frames before opening the menu status window. (Instead of bringing them all up at once)

I tried modifying the first several lines in Scene_Menu:
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_command_window
wait(5)
create_gold_window
wait(5)
create_status_window
end

def wait(duration)
duration.times { Fiber.yield } #<-- this is line 20
end
but it only brings out an error when I try to open up the menu (Script 'Scene_Menu' line 20: FiberError occurred. Can't yield from root fiber)

I also tried adding in Graphics.wait(5) instead of wait(5) but all it does is make the game wait 10 frames before opening all the windows at once.

Any help is greatly appreciated!! :kaoluv:
(I apologize in advance for any grammar mistakes I might have made) :kaocry:
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,297
Reaction score
6,055
First Language
Indonesian
Primarily Uses
RMVXA
You gotta learn what Fiber.yield actually do before blindly taking them from Game_Interpreter to your scene. But that would be a quite long lecture

Btw, when I'm going to put some "wait". I usually do
Code:
Graphics.update
Input.update
Give it a try
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
810
First Language
Hungarian
Primarily Uses
RMVXA
The place where you try to add the waiting time is your problem.
The graphics are frozen there, so nothing you make there will affect the screen directly until the graphics are unfrozen.
That happens in the perform_transition method of the scene class, which happens in the post_start method of the scene.
You can setup the initial values of your graphical objects in the start method (which is what every default script does).
Than you move on to the post_start method, setup your waiting times there and change your graphical objects there however you want.

For example, close all windows in the start method (you might also need to deactivate the command windows too, I don't remember much about these window classes ).
Now move to the post_start method (to the end of it) and start opening them, placing a waiting time before each of the opening lines.
A simple Graphics.wait(X) works if you only want to update the screen during these waiting times.
And this should be it, if you really just want to add some waiting time between their opening animations.

Here is an example code for the main menu:
Code:
class Scene_Menu

  alias close_them_wins7772 start
  def start
    close_them_wins7772
    close_the_windows
  end
 
  def close_the_windows
    # Closing all windows before the transition happens
    instance_variables.each do |vkey|
      obj = instance_variable_get(vkey)
      obj.openness = 0 if obj.is_a?(Window)
    end
  end
 
  alias open_them_wins7741 post_start
  def post_start
    open_them_wins7741
    open_the_windows
  end
 
  def open_the_windows
    # Getting all window objects
    wins = []
    instance_variables.each do |vkey|
      obj = instance_variable_get(vkey)
      wins << obj if obj.is_a?(Window)
    end
    # Opening all windows after the transition
    wins.each do |win|
      win.open
      until win.open?
        win.update
        Graphics.update
      end
      # This unless check is why we pre-collected all windows above
      Graphics.wait(10) unless win == wins[-1]
    end
  end
 
end
It will account for all window objects automatically. Other graphical objects are not affected though.
 

Tok.wa

Villager
Member
Joined
Nov 21, 2017
Messages
6
Reaction score
0
First Language
Filipino
Primarily Uses
RMVXA
This might be what you want. it has a slight pause between each window, but you may have to play with it to get it to do a specific order.
http://www.rpgmakercentral.com/topic/423-nasty-animated-main-menu/
Thank you for this, I just tested this a while ago and it actually has the delay I want, but, yeah, I think I might have to make slight adjustments to the script if I'd want it to work the way I want to. :kaoblush:

You gotta learn what Fiber.yield actually do before blindly taking them from Game_Interpreter to your scene. But that would be a quite long lecture
Time to watch tutorials, I guess :kaocry:

The place where you try to add the waiting time is your problem.
The graphics are frozen there, so nothing you make there will affect the screen directly until the graphics are unfrozen.
That happens in the perform_transition method of the scene class, which happens in the post_start method of the scene.
You can setup the initial values of your graphical objects in the start method (which is what every default script does).
Than you move on to the post_start method, setup your waiting times there and change your graphical objects there however you want.

For example, close all windows in the start method (you might also need to deactivate the command windows too, I don't remember much about these window classes ).
Now move to the post_start method (to the end of it) and start opening them, placing a waiting time before each of the opening lines.
A simple Graphics.wait(X) works if you only want to update the screen during these waiting times.
And this should be it, if you really just want to add some waiting time between their opening animations.

Here is an example code for the main menu:
Code:
class Scene_Menu

  alias close_them_wins7772 start
  def start
    close_them_wins7772
    close_the_windows
  end
 
  def close_the_windows
    # Closing all windows before the transition happens
    instance_variables.each do |vkey|
      obj = instance_variable_get(vkey)
      obj.openness = 0 if obj.is_a?(Window)
    end
  end
 
  alias open_them_wins7741 post_start
  def post_start
    open_them_wins7741
    open_the_windows
  end
 
  def open_the_windows
    # Getting all window objects
    wins = []
    instance_variables.each do |vkey|
      obj = instance_variable_get(vkey)
      wins << obj if obj.is_a?(Window)
    end
    # Opening all windows after the transition
    wins.each do |win|
      win.open
      until win.open?
        win.update
        Graphics.update
      end
      # This unless check is why we pre-collected all windows above
      Graphics.wait(10) unless win == wins[-1]
    end
  end
 
end
It will account for all window objects automatically. Other graphical objects are not affected though.
It now works the way I want it to! Thank you soooo much!:kaoluv:
This thread can be closed now! :kaohi:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Yay! Got 3 new frying pans, its weird, but I'm so happy about it.
Yelp. I've discovered that I am one of those people who should not be drinking coffee. Took me a week detoxing off of coffee and switching to tea to realize how badly it was affecting me- and I've been drinking the stuff for years. Yikes!
I bought a gaiter with Meijer printed on it.

I'm still a Walmart worker, and I wore it today for work.
Trying out new carpet autotiles and I can't decide if it's working or not. Pixeling soft carpets is hard
It seems like this is going to be another remote semester. RIP.

Forum statistics

Threads
99,516
Messages
966,348
Members
131,146
Latest member
jakobhenerey309
Top