A script to cancel player command input when timer reaches 0, and then auto battle.

I have a timer starting upon the start of turns, and the timer stopping upon action input.

What I need is a way to, when the timer reaches 0, it instantly closes out all actor_command / ItemList / SkillList / Enemy-actor Select windows, and then force the actor to perform an Auto Battle action for their turn.

Visual representation:

Turn Start

Timer starts at 10 seconds

If actor performs action before the timer reaches 0

     Timer stops

     Action is performed

else

     All actor_command_windows and such are force-closed (I need this)

     Actor automatically performs Auto Battle (I need this)

end

Thanks a bunch.
hope someone's coming, it would be nice 😀
Super huge bump + edit-fix.  I was going back to this idea of mine while thinking of trying to make my battles more faster-paced.

Edit: Found this script with some research, trying to tinker with it to work with Game_Timer's @count.

http://www.rpgmakervxace.net/topic/233-auto-battle-when-idle/

So far it works fine when the timer hits 0, but it only force-closes Party_Command and Actor_Command even though I added checks for the other windows as well. (Like if i'm on ItemList or SkillList or Actor-Select or Enemy-Select) I removed the usage of the Trigger key + MAB_IDLE_FRAMES. The disable switch might be handy so i'm keeping that.

Spoiler
#===========================================================================01=# MITCHI Auto Battle when Idle [VXA]#------------------------------------------------------------------------------# Script version: 1.2# By: //mitchi.exe # Converted on: Dec. 8, 2011# (This is my first completed VX and VXA script!)#------------------------------------------------------------------------------# Description:# This script will make all actors in the party to auto attack when the player# is not doing anything (idling) during a party or actor command selection# after the specified amount of frames or by pressing a certain button. This# is very useful when you suddenly have to do something else IRL and you don't# want to waste game play time! This is also beneficial when you're sleepy# or lazy... or somethin'...#------------------------------------------------------------------------------# Features:# ~The party attacks automatically if player is idle or by a key press# ~Can set a specific amount of frames before the auto battle starts# ~Can be disabled by a switch#------------------------------------------------------------------------------# Instructions:# Change the value of MAB_IDLE_FRAMES below to the amount you want:# MAB_IDLE_FRAMES = n# Party will automatically attack after 'n' frames. (usu. 60 frames = 1 sec.)MAB_IDLE_FRAMES = 300 # Change the value of DISABLE_IDLE_SWITCH below to a switch you want:# DISABLE_IDLE_SWITCH = n# If the switch 'n' is turned ON, the script's features WILL NOT WORK.DISABLE_IDLE_SWITCH = 0 # You can also enter auto mode by pressing a button.# IDLE_AUTO_KEY = button# where 'button' can be 🙂A,:X,:Y,:Z,:L,:R)IDLE_AUTO_KEY = nil #------------------------------------------------------------------------------# Compatibility:# -Only supports UP, DOWN, OKAY©, and CANCEL( keys for idling# -This will not work on battle systems that alters turns like the ATB and TBS#===========================================================================42=# Special Thanks:# -IMP1 for the frame count and seconds info# -Yanfly for helping me fix an error for the conversion# -SortaCool for originally requesting the script# -Peva for the manual key press suggestion## Changelog:# v1.2 - Script converted to VXA# v1.1 - auto.battle -> make.action to prevent screwing up# each actor's default auto-battle setting (VX)#==============================================================================##### START OF CODE #####puts "MITCHI Auto Battle when Idle loaded" class Scene_Battle < Scene_Base alias idle_auto_start start alias idle_auto_update update alias idle_auto_turn_end turn_end def start idle_auto_start @idle_counter = 0 end def idle_auto_key_trigger? if (Input.trigger?🙂DOWN) or Input.trigger?🙂UP)) return true elsif (Input.trigger?🙂C) or Input.trigger?( return true end return false end def idle_manual_key_press? if (Input.trigger?(IDLE_AUTO_KEY)) return true end return false end def update idle_auto_update if !$game_switches[DISABLE_IDLE_SWITCH] if @party_command_window.active or @actor_command_window.active #@idle_counter = 0 if idle_auto_key_trigger? #@idle_counter += 1 #@idle_counter = MAB_IDLE_FRAMES if idle_manual_key_press? if @idle_counter == $game_timer.count #puts "Auto Battle Idle mode enabled!" for i in 0..$game_party.members.size-1 actor_set_auto = $game_party.members.id $game_actors[actor_set_auto].make_auto_battle_actions end Sound.play_ok @actor_window.deactivate if @actor_window.active @enemy_window.deactivate if @enemy_window.active @skill_window.deactivate if @skill_window.active @item_window.deactivate if @item_window.active @party_command_window.deactivate if @party_command_window.active @actor_command_window.deactivate if @actor_command_window.active turn_start end end end end def turn_end @idle_counter = 0 idle_auto_turn_end end end ##### END OF CODE ######==============================================================================# _ _ _ _____ ____ _ _ _# | \ / | | | |_ _| | __| | |_| | | |# | ' | | | | | | |__ | _ | | |# |_|_|_| |_| |_| |____| |_| |_| |_|# "Yay for my first completed VXA script!"#============================================================================== 


Edit 2: I officially tinkered with the script so it works perfectly!

All windows deactivate properly now when the timer reaches 0, and auto battle is performed. This change is aimed towards single-actor-selection turn systems (like Ao no Kiskei and ATBs. For default turn systems refer to the small bit in the original script with party_member size.

Spoiler
Code:
#===========================================================================01=#  MITCHI Auto Battle when Idle [VXA]#------------------------------------------------------------------------------#  Script version: 1.2#  By: //mitchi.exe                                        #  Converted on: Dec. 8, 2011#  (This is my first completed VX and VXA script!)#------------------------------------------------------------------------------#  Description:#  This script will make all actors in the party to auto attack when the player#  is not doing anything (idling) during a party or actor command selection#  after the specified amount of frames or by pressing a certain button. This#  is very useful when you suddenly have to do something else IRL and you don't#  want to waste game play time! This is also beneficial when you're sleepy#  or lazy... or somethin'...#------------------------------------------------------------------------------#  Features:#  ~The party attacks automatically if player is idle or by a key press#  ~Can set a specific amount of frames before the auto battle starts#  ~Can be disabled by a switch#------------------------------------------------------------------------------#  Instructions:#  Change the value of MAB_IDLE_FRAMES below to the amount you want:#  MAB_IDLE_FRAMES = n#  Party will automatically attack after 'n' frames. (usu. 60 frames = 1 sec.)MAB_IDLE_FRAMES = 600 #  Change the value of DISABLE_IDLE_SWITCH below to a switch you want:#  DISABLE_IDLE_SWITCH = n#  If the switch 'n' is turned ON, the script's features WILL NOT WORK.DISABLE_IDLE_SWITCH = 0 #  You can also enter auto mode by pressing a button.#  IDLE_AUTO_KEY = button#  where 'button' can be (:A,:X,:Y,:Z,:L,:R)IDLE_AUTO_KEY = nil #------------------------------------------------------------------------------#  Compatibility:#  -Only supports UP, DOWN, OKAY©, and CANCEL( keys for idling#  -This will not work on battle systems that alters turns like the ATB and TBS#===========================================================================42=#  Special Thanks:#  -IMP1 for the frame count and seconds info#  -Yanfly for helping me fix an error for the conversion#  -SortaCool for originally requesting the script#  -Peva for the manual key press suggestion##   Changelog:#   v1.2 - Script converted to VXA#   v1.1 - auto.battle -> make.action to prevent screwing up#          each actor's default auto-battle setting (VX)#==============================================================================##### START OF CODE #####puts "MITCHI Auto Battle when Idle loaded" class Scene_Battle < Scene_Base   alias idle_auto_start start  alias idle_auto_update update  alias idle_auto_turn_end turn_end   def start    idle_auto_start    @idle_counter = 0  end     #def idle_auto_key_trigger?  #  if (Input.trigger?(:DOWN) or Input.trigger?(:UP))  #    return true  #  elsif (Input.trigger?(:C) or Input.trigger?(  #    return true  #  end  #  return false  #end   #def idle_manual_key_press?  #  if (Input.trigger?(IDLE_AUTO_KEY))  #    return true  #  end  #  return false  #end   def update    idle_auto_update    if !$game_switches[DISABLE_IDLE_SWITCH]      #if @party_command_window.active or @actor_command_window.active        #@idle_counter = 0 if idle_auto_key_trigger?        #@idle_counter += 1        #@idle_counter = MAB_IDLE_FRAMES if idle_manual_key_press?        if @idle_counter == $game_timer.count          #puts "Auto Battle Idle mode enabled!"          #for i in 0..$game_party.members.size-1            #actor_set_auto = $game_party.members[i].id            #$game_actors[actor_set_auto].make_auto_battle_actions          #end          BattleManager.actor.make_auto_battle_actions          #Sound.play_ok          if @actor_window.active            @actor_window.hide.deactivate            @skill_window.hide.deactivate            @item_window.hide.deactivate          end          if @enemy_window.active            @enemy_window.hide.deactivate            @skill_window.hide.deactivate            @item_window.hide.deactivate          end          @skill_window.hide.deactivate if @skill_window.active          @item_window.hide.deactivate if @item_window.active          @party_command_window.deactivate if @party_command_window.active          @actor_command_window.deactivate if @actor_command_window.active          turn_start          @idle_counter += 1        end      #end    end  end     #def turn_end  #  @idle_counter = 0  #  idle_auto_turn_end  #end end ##### END OF CODE ######==============================================================================#  _   _   _   _____   ____   _   _   _# | \ / | | | |_   _| |  __| | |_| | | |# |  '  | | |   | |   | |__  |  _  | | |# |_|_|_| |_|   |_|   |____| |_| |_| |_|#  "Yay for my first completed VXA script!"#============================================================================== 

Original thread: https://forums.rpgmakerweb.com/threads/a-script-to-cancel-player-command-input-when-timer-reaches-0-and-then-auto-battle.14534/