1

I want it to automatically press the ok button after the window is opened for 20 seconds. I don't know how exactly to do this. code is:

window_NameInput.prototype.processHandling = function() {
    if (this.isOpen() && this.active) {

        if (Input.isRepeated('ok')) { 
            this.processOk();
        }
    }
};

What I tried:

window_NameInput.prototype.processHandling = function() {
    if (this.isOpen() && this.active) {

       { setTimeout(function ()   if (Input.isRepeated('ok')) { 
            this.processOk();
        } , 20000); }

    }
};

Edit:

I actually decided to use this code below. I want to call ok handler after window has been opened for 20 seconds.

Window_NameInput.prototype.processHandling = function() {
    if (this.isOpen() && this.active) {

   setTimeout(function(){

    this.callOkHandler();

},2000);



    }
};

But I got uncaught type error this.callokhandler is not a function

Any help is appreciated Thanks in advance

Tosps
  • 73
  • 7

1 Answers1

1

You've misplaced your if() condition before the function {.

Try:

window_NameInput.prototype.processHandling = function(){
  if (this.isOpen() && this.active) { 
      setTimeout(function() {
        if (Input.isRepeated('ok')) {
          this.processOk();
        }
      }, 20000);
  }
};

Hope this helps,

Miroslav Glamuzina
  • 4,472
  • 2
  • 19
  • 33
  • I have edited the question, I decided to use a different code, but I got uncaught type error this.callokhandler is not a function, do you know how to solve this? – Tosps Mar 09 '19 at 04:56
  • We have to see your `callOkHandler` function. PS, this should be added as a new question not appended to your previous question. – Miroslav Glamuzina Mar 09 '19 at 05:09
  • I am new to javascript, this is the full code https://www.dropbox.com/s/dpbzclydv5sf1fn/rpg_windows.js?dl=0 – Tosps Mar 09 '19 at 05:19