Force choices to close?

Hello!

Say I want to give the player some choices on a timer. When it ends, the choice box closes and a 'default' cutscene follows. How can I force close the choice box? Both in MV and VX Ace?

Thank you!
bump

Whitney, please do not bump your topic unless it has been 24 hours later since your last post. You can review our forum rules here. Thank you.



Please wait 72 hours before bumping next time. This is to give all questions a fair chance to be answered.
[bump]Whitney[/bump]

Please wait 72 hours before bumping next time. This is to give all questions a fair chance to be answered.

Alright, I'm sorry, I completely missed it. Could you add the word "bump" onto it though, I did go on the thread, tried CTRL + F but I didn't find the specific word, so I thought there weren't rules on it.
It's under rule 4, forum rules. Though I see what you mean about the CTRL+F part missing it.
well it would be a simple as modifying the choice box script. basically you have an internal time inside the choice box that will invoke the "defualt" option once it hits zero. now we need to be is telling the box whether it should be on a timer or not and for how long. just in case you want different time to think on a puzzle or something.

I made a rough script that does this well,
Code:
//=============================================================================
// Timed Choices
//=============================================================================
/*:
 * @plugindesc Timed Choices for RPGmaker MV
 * @author SilverKnightArcher
 *
 * *
 *  @param timed?
 *  @desc will choices be timed by defult iunless explicitystated other wise
 *    defualt: false
 *  @defualt false
 *
 *
 *  @param Defualt Time
 *  @desc how long the window will wait for when timed in seconds.
 *    defualt: 10.0
 *  @defualt 10.0
 *
 *  @param Defualt Choice Index
 *  @desc which choice (numbered down from zero - six) will be selected on eding of a timer
 *    defualt: 0
 *  @defualt 0
 *
 *=============================================================================
 *
 *=============================================================================
 */
 var Imported = Imported || {};
Imported.DSE4_AudioCore = true;

var DSEIV = DSEIV || {};
DSEIV.TimedChoices = DSEIV.TimeChoices || {};

//=============================================================================
// Params
//=============================================================================
DSEIV.TimedChoices.Timed = false;
DSEIV.TimedChoices.TimeRemaining = 10.0;
DSEIV.TimedChoices.defaultChoice = 0;
DSEIV.TimedChoices.currentTimer = null;

//=============================================================================
// DSEIV.TimedChoices.Timer
//=============================================================================
DSEIV.TimedChoices.Timer = function() {
     this.initialize.apply(this, arguments);
 
};

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.initialize = function() {
 
    this._working = DSEIV.TimedChoices.Timed;
    this._timeRemaining = DSEIV.TimedChoices.TimeRemaining * 60;
    this._choice = 0;
    this._OnEnd = null; //when timer ends call back
};

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.update = function () {
 if(this._working) {
     this._timeRemaining--;
     if(this._timeRemaining < 0) {
         this.expire();
     }
 }
 
};

//-----------------------------------------------------------------------------
// Set Working
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.SetWorking = function(bool) {
    console.log('working set to ' + bool);
    this._working = bool;
};
//-----------------------------------------------------------------------------
// Set Choice
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.SetChoice = function(index) {
    console.log('choice set to ' + index);
    this._choice = index;
};
//-----------------------------------------------------------------------------
// Get Choice
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.SetChoice = function() {
 
    return this._choice;
};
//-----------------------------------------------------------------------------
// Set Duration
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.SetDuration = function(seconds) {
    console.log('duration set to ' + seconds);
    this._timeRemaining = seconds * 60;
};

//-----------------------------------------------------------------------------
// Add On End Lister
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.addOnEndListerner = function(listener, instance) {
    console.log('adding listener');
    this._OnEnd = listener.bind(instance);
};

//-----------------------------------------------------------------------------
//  Expire
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Timer.prototype.expire = function () {
    console.log("expireed!");
    this._working = false;
    if(this._OnEnd) {
        this._OnEnd();
    
    }
    this._onEnd = null;
 
};
//=============================================================================
// Window_ChoiceList
//=============================================================================
// The Window used for making Choices
//
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
DSEIV.TimedChoices.Window_ChoiceList_start = Window_ChoiceList.prototype.start;
Window_ChoiceList.prototype.start = function() {
    DSEIV.TimedChoices.Window_ChoiceList_start.call(this);
 

 
    if(DSEIV.TimedChoices.currentTimer == null) {
        DSEIV.TimedChoices.currentTimer = new DSEIV.TimedChoices.Timer();
    }
    DSEIV.TimedChoices.currentTimer.addOnEndListerner(this.invokeDefaultChoice, this);

};
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
Window_ChoiceList.prototype.update = function() {
    this.ProcessTimer();
    Window_Command.prototype.update.call(this);
};

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
Window_ChoiceList.prototype.ProcessTimer = function() {
    if(DSEIV.TimedChoices.currentTimer) {
    DSEIV.TimedChoices.currentTimer.update();
    }
};

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
Window_ChoiceList.prototype.invokeDefaultChoice = function() {
    console.log(this);
    this.select(DSEIV.TimedChoices.currentTimer.GetChoice());
    this.processOk();
};
//=============================================================================
// END OF FILE
//=============================================================================


it doesn't any any plugin commands per se but it work by creating a Timer before calling your choices then runs them. its pretty rough and haven't fully tested i, so they will probably be a few bugs /crashes with this but it works.
RPGmakerForums.png


this is basically how you use it. each time you want a timed Choice window , you will need to set up the timer for it. the Timer is set up with 4 lines of code as you can see in the screenshot. First line creates the timer, that's all.
Working (2nd line) tells the timer whether it should work or not. True means it will tick, false means it won't.
Choices (3rd Line)are what is defined as the default choice. by default it is 0 (the first choice).
Duration (4th line) is the number of seconds the timer will last until it fires off the "default ' choice, this is set to 10 seconds by default but in the screen shot it is set to 5.

Original thread: https://forums.rpgmakerweb.com/threads/force-choices-to-close.74541/