$gameInterpreter.wait() doesn't work?

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
I've been referencing the 'script equivalent of command calls' list a lot lately ( link ) but the listing for the Wait command doesn't work.


I can't locate $gameInterpreter in my console, firstly.  I was able to find it being created (or at least where I think it's created, I'm an amateur with JS) in rpg_objects.js and, in fact, that Game_Interpreter function does have a wait method which takes a duration as its parameter.  However, even so, calling it returns that $gameInterpreter is undefined.  If I call Game_Interpreter instead it (of course) returns that it doesn't have a Wait method.


So what is the proper way to call for a Wait inside a script execution event?  This is what my event looks like at the moment:


Capture4.PNG


What I'm trying to achieve is a sweep of audio from the left-most pan to the right-most pan with a short delay between each played sound so it doesn't create overlapping tones and takes a little bit to go from left to right.
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
because this not how it's work.


your method is strongly wrong you can't declare variable like this.


honestly what you are trying to do is a "gradual" song increasing.


and I do think this would require a plugin who edit how work HTML audio.


and pan is setup to a value of 0 to 1 
 

Nicke

Fortune seeker
Veteran
Joined
Apr 4, 2012
Messages
550
Reaction score
552
First Language
Swedish
Primarily Uses
RMMZ
Use this instead:


this.wait(60);


Then you have your code after. No need using a for loop. :)
 

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
No need using a for loop

Pan goes from -100 to 100 in RMMV's event editor, I want it to play a sound once for every increment of 5 between -100 and 100, to create a sweep.  Playing it once won't be enough and I don't want to put down 80 'play sound' and 'wait' commands.

honestly what you are trying to do is a "gradual" song increasing.

Hm?  But that's not at all what I'm trying to do.  It's similar in execution - but I'm not changing its volume from 0 to 100, I'm changing its pan from the left-most to the right-most speaker.

and pan is setup to a value of 0 to 1 

Interesting.  I'll check that but at first blush my event did seem to work properly with the -100 to 100 cycle.

this.wait(60);

Aha.  That would make sense.  I didn't consider that possibility.  Let me check into that real quick.

and I do think this would require a plugin who edit how work HTML audio.

Definitely not true.  Without the wait command it functions perfectly.  Replicating the facisimile of a forloop in the database made it work fine - but it doesn't solve my query over why the listed command ($gameInterpreter.wait(x)) isn't working.  


This works, although it's more annoying to set up than a for loop in the scripted event execution command.


Capture6.PNG
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
@Firgof


// Wait
Game_Interpreter.prototype.command230 = function() {
    this.wait(this._params[0]);
    return true;
};


This is the definition, so you should be able to just use


this.wait(4)

but it doesn't solve my query over why the listed command ($gameInterpreter.wait(x)) isn't working.  



Perhaps they mean you need to replace $gameinterpreter with an actual reference to a Game_Interpreter object. For example if you're calling from a script call, `this` would work just fine.


I don't know, different programmers have different ways of representing things I guess.
 
Last edited by a moderator:

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
this.wait(frames) does in fact work.  I've made a note of it in the official spreadsheet for the script call.


Note to others who might stumble on this topic also looking to pan a sound:  I'm using very short sounds which I've modified to the exact length in frames * 60 seconds I expect each step to take.  Obviously this can result in stutters, gaps, and lots of clashing noise if not handled delicately.  I have the benefit of working in a game project where the player character is exploring a glitchy computer-generated environment so that sort of audio processing error is actually just fine in my use-case.  Beware if you can't guarantee that framerate or don't have a sound short enough to fit in those small increments of time.
 

Latest Threads

Latest Posts

Latest Profile Posts

What Reviews say on RPG Maker MZ?
Looking back at some sketches, and game design documents on my PC dated summer of 2015. I started development with the release of MZ, but in 2015, I felt a strong desire to make a game out of the blue. I remember feeling sad for no apparent reason, and all these ideas rushed into my head. Now that I think about it, since that day, everything has become easier to do on my PC . . . it’s very creepy.
Everything's going to be alright! We're all in this together. <3
Aaaaannd published my game's tech demo. :D

Feel free to download and play it. And give feedback!
Hey everyone, we know that the edit bar is missing. We're working on it. You can talk about it in the announcement here: https://forums.rpgmakerweb.com/index.php?threads/forum-errors-missing-edit-bar-etc.132715/

Forum statistics

Threads
107,800
Messages
1,032,287
Members
139,942
Latest member
Safiplasm
Top