Run In N Frames
Classes
Section titled “Classes”RunInNFrames
Section titled “RunInNFrames”Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:39
Extends
Section titled “Extends”Feature
Methods
Section titled “Methods”vConditionalFunc()
Section titled “vConditionalFunc()”vConditionalFunc():
boolean
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:79
Returns
Section titled “Returns”boolean
Overrides
Section titled “Overrides”Feature.vConditionalFunc
restartNextRenderFrame()
Section titled “restartNextRenderFrame()”restartNextRenderFrame(
character?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:109
Helper function to restart on the next render frame. Useful because it is impossible to restart
the game inside of the POST_NEW_ROOM, POST_NEW_LEVEL, or POST_GAME_STARTED callbacks when
a run is first starting.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”character?
Section titled “character?”PlayerType
Optional. If specified, will restart the game as the specified character.
Returns
Section titled “Returns”void
runInNGameFrames()
Section titled “runInNGameFrames()”runInNGameFrames(
func,numGameFrames,cancelIfRoomChanges?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:134
Supply a function to run N game frames from now in the POST_UPDATE callback.
For a usage example, see the documentation for the runNextGameFrame, which is used in a
similar way.
Note that this function will not handle saving and quitting. If a player saving and quitting before the deferred function fires would cause a bug in your mod, then you should handle deferred functions manually using serializable data.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”() => void
The function to run.
numGameFrames
Section titled “numGameFrames”int
The amount of game frames to wait before running the function.
cancelIfRoomChanges?
Section titled “cancelIfRoomChanges?”boolean = false
Optional. Whether to cancel running the function if a new room is loaded in the interim. Default is false.
Returns
Section titled “Returns”void
runInNRenderFrames()
Section titled “runInNRenderFrames()”runInNRenderFrames(
func,numRenderFrames,cancelIfRoomChanges?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:171
Supply a function to run N render frames from now in the POST_RENDER callback.
For a usage example, see the documentation for the runNextGameFrame, which is used in a
similar way.
Note that this function will not handle saving and quitting. If a player saving and quitting before the deferred function fires would cause a bug in your mod, then you should handle deferred functions manually using serializable data.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”() => void
The function to run.
numRenderFrames
Section titled “numRenderFrames”int
The amount of render frames to wait before running the function.
cancelIfRoomChanges?
Section titled “cancelIfRoomChanges?”boolean = false
Optional. Whether to cancel running the function if a new room is loaded in the interim. Default is false.
Returns
Section titled “Returns”void
runNextGameFrame()
Section titled “runNextGameFrame()”runNextGameFrame(
func,cancelIfRoomChanges?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:225
Supply a function to run on the next POST_UPDATE callback.
For example:
const NUM_EXPLODER_EXPLOSIONS = 5;
function useItemExploder(player: EntityPlayer) { playSound("exploderBegin"); explode(player, NUM_EXPLODER_EXPLOSIONS);}
function explode(player: EntityPlayer, numFramesLeft: int) { Isaac.Explode(player, undefined, 1); numFramesLeft -= 1; if (numFramesLeft === 0) { runNextFrame(() => { explode(player, numFramesLeft); }); }}Note that this function will not handle saving and quitting. If a player saving and quitting before the deferred function fires would cause a bug in your mod, then you should handle deferred functions manually using serializable data.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”() => void
The function to run.
cancelIfRoomChanges?
Section titled “cancelIfRoomChanges?”boolean = false
Optional. Whether to cancel running the function if a new room is loaded in the interim. Default is false.
Returns
Section titled “Returns”void
runNextRenderFrame()
Section titled “runNextRenderFrame()”runNextRenderFrame(
func,cancelIfRoomChanges?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:245
Supply a function to run on the next POST_RENDER callback.
For a usage example, see the documentation for the runNextGameFrame, which is used in a
similar way.
Note that this function will not handle saving and quitting.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”() => void
The function to run.
cancelIfRoomChanges?
Section titled “cancelIfRoomChanges?”boolean = false
Optional. Whether to cancel running the function if a new room is loaded in the interim. Default is false.
Returns
Section titled “Returns”void
setIntervalGameFrames()
Section titled “setIntervalGameFrames()”setIntervalGameFrames(
func,numGameFrames,runImmediately,cancelIfRoomChanges?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:274
Supply a function to be repeatedly run on an interval of N game frames in the POST_UPDATE
callback. The function will continue to be fired until false is returned from the function.
This is similar to the setInterval vanilla JavaScript function, except there is no
corresponding clearInterval function. (Instead, the return value from the supplied function
is used to stop the interval.)
Note that this function will not handle saving and quitting. You must manually restart any intervals if the player saves and quits in the middle of a run.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”() => boolean
The function to repeatedly run on an interval.
numGameFrames
Section titled “numGameFrames”int
The amount of game frames to wait between each run.
runImmediately
Section titled “runImmediately”boolean
Whether to execute the function right now before waiting for the interval.
cancelIfRoomChanges?
Section titled “cancelIfRoomChanges?”boolean = false
Optional. Whether to cancel running the function if a new room is loaded in the interim. Default is false.
Returns
Section titled “Returns”void
setIntervalRenderFrames()
Section titled “setIntervalRenderFrames()”setIntervalRenderFrames(
func,numRenderFrames,runImmediately,cancelIfRoomChanges?):void
Defined in: packages/isaacscript-common/src/classes/features/other/RunInNFrames.ts:322
Supply a function to be repeatedly run on an interval of N render frames in the POST_RENDER
callback. The function will continue to be fired until false is returned from the function.
This is similar to the setInterval vanilla JavaScript function, except there is no
corresponding clearInterval function. (Instead, the return value from the supplied function
is used to stop the interval.)
Note that this function will not handle saving and quitting. You must manually restart any intervals if the player saves and quits in the middle of a run.
In order to use this function, you must upgrade your mod with ISCFeature.RUN_IN_N_FRAMES.
Parameters
Section titled “Parameters”() => boolean
The function to repeatedly run on an interval.
numRenderFrames
Section titled “numRenderFrames”int
The amount of game frames to wait between each run.
runImmediately
Section titled “runImmediately”boolean
Whether to execute the function right now before waiting for the interval.
cancelIfRoomChanges?
Section titled “cancelIfRoomChanges?”boolean = false
Optional. Whether to cancel running the function if a new room is loaded in the interim. Default is false.
Returns
Section titled “Returns”void
