Waiting for a Scene to complete

Discussion in 'Javascript/Plugin Support' started by Sn0wCrack, Oct 29, 2015.

  1. Sn0wCrack

    Sn0wCrack Veteran Veteran

    Messages:
    82
    Likes Received:
    48
    Location:
    Australia
    First Language:
    英語
    In my script a function begins processing, however in the middle I call a custom scene based on Scene_ItemBase

    SceneManager.push(Snow.Gather.Scenes.ToolChoice)However my script carries along without caring if the Scene is terminated or not, is there anyway to go about waiting for the scene to be terminated before continuing on without stopping the Scene in the process?( I've used a while loop to check but the entire game stalls, which I realised was a stupid idea in about 2 seconds before testing as well.)

    Code for Scene and Windows:

    Code:
    // Windowsvar ItemChoiceWindow = function() {	this.initialize.apply(this, arguments);}ItemChoiceWindow.prototype = Object.create(Window_ItemList.prototype);ItemChoiceWindow.prototype.constructor = ItemChoiceWindow;ItemChoiceWindow.prototype.initialize = function(x, y, width, height) {	Window_ItemList.prototype.initialize.call(this, x, y, width, height);	this._data = [];	this.activate();	this.refresh();    this.select(0);}ItemChoiceWindow.prototype.makeItemList = function() {	this._data = Snow.Gather.TempItems;}Snow.Gather.Windows.ItemChoiceWindow = ItemChoiceWindow;var ItemChoiceHelpWindow = function() {	this.initialize.apply(this, arguments);}ItemChoiceHelpWindow.prototype = Object.create(Window_Base.prototype);ItemChoiceHelpWindow.prototype.constructor = ItemChoiceHelpWindow;Snow.Gather.Windows.ItemChoiceHelpWindow = ItemChoiceHelpWindow;// Scenesvar ToolChoice = function() {	this.initialize.apply(this, arguments);}ToolChoice.prototype = Object.create(Scene_ItemBase.prototype);ToolChoice.prototype.constructor = ToolChoice;ToolChoice.prototype.initialize = function(data) {	Scene_ItemBase.prototype.initialize.call(this);}ToolChoice.prototype.create = function() {	Scene_ItemBase.prototype.create.call(this);	this._createItemChoiceWindow();	this._createItemChoiceHelpWindow();}ToolChoice.prototype.start = function() {	 Scene_ItemBase.prototype.start.call(this);}ToolChoice.prototype._createItemChoiceWindow = function() {	this._itemChoiceWindow = new Snow.Gather.Windows.ItemChoiceWindow(0, 100, Graphics.boxWidth, Graphics.boxHeight - 100);	this._itemChoiceWindow.setHandler('ok', this._onItemChoiceWindowOK.bind(this));	this._itemChoiceWindow.setHandler('cancel', this._onItemChoiceWindowCancel.bind(this));	this.addWindow(this._itemChoiceWindow);}ToolChoice.prototype._createItemChoiceHelpWindow = function() {	this._itemChoiceHelpWindow = new Snow.Gather.Windows.ItemChoiceHelpWindow();	this.addWindow(this._itemChoiceHelpWindow);}ToolChoice.prototype._onItemChoiceWindowOK = function() {	var selected = this._itemChoiceWindow.item();	Snow.Gather.TempItems = selected;	console.log(Snow.Gather.TempItems);	this.popScene();}ToolChoice.prototype._onItemChoiceWindowCancel = function() {	this.popScene();}Snow.Gather.Scenes.ToolChoice = ToolChoice;
     
    Last edited by a moderator: Oct 29, 2015
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,712
    Likes Received:
    11,419
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You would need to show us the section of code, not just one line.
     
    #2
  3. Sn0wCrack

    Sn0wCrack Veteran Veteran

    Messages:
    82
    Likes Received:
    48
    Location:
    Australia
    First Language:
    英語
    I don't see how showing any of my code would really help, since I'm asking more about how to implement something that doesn't rely on my code any more than what I've posted. (The scene type I'm extending from and how I'm adding the Scene)

    Put I'll put up the code for the scene and windows in the OP if it does help.

    Nevermind, I've solved this myself, I've separated the main function into two parts, the second part gets called when the item has been selected.
     
    Last edited by a moderator: Oct 29, 2015
    #3

Share This Page