Sound List - Item List - ISInstrumenter

Interruption Safety Instrumenter (Experimental)

Information

What

This tool instruments a JS code to make it "interruption-safe" which simply means repeating some actions in the next tick if there was an interruption, detected by incomplete data. It tries to do this efficiently so that already completed actions are not repeated. E.g. if a loop died at 4th iteration, first 3 aren't repeated, and caches result of functions, etc. Its code is mostly written by AI.

It will mess up your code, it is not to replace your dev code.

It is very experimental, expect issues! It likely needs to handle more stuff, but seems to actually work in most cases. Also note that it is not possible to have 100% interruption safe code in Bloxd.

Make sure to follow the steps in the Setup section below.

Interruption What

Interruptions limit the execution time in Bloxd scripting, they are uncatchable errors that can appear pretty much anywhere anytime. Unfortunately they are affected by everything on the server, even other lobbies, so they are very unreliable.

Safe Functions

Define functions that are ok to repeat if the section is re-executed. Don't list heavy functions for performance. Comma-separated. Use * wildcards e.g. Math.*

Blacklisted Functions

Define functions whose callbacks should not be instrumented. This especially matters if the callback needs to return a value. Comma-separated. Use * wildcards e.g. *.filter

Callback Parameter Mode

Since this makes a function async (may not complete in current tick), this feature adds a callback parameter that will be called when the function is completed. Ignores known event (callback) functions. If the function has returns with value, they are converted to cb(value).

Async Wrapper Functions

Define functions that should be guarded from repeating their callbacks.
E.g. if you use a setTimeout implementation, it should be specified here like "setTimeout" or "Timers.setTimeout". This prevents the callbacks from repeating. Comma-separated.

Comment Mode

Enabled: Only instrument functions marked with //isi comments above or in same line (affects any inner stuff). Disabled: Instrument every function.

Protected Assignments

Assigments that should not be repeated. E.g. "player.kills" if you have a "player.kills = 5". Should be a rare need. Comma-separated.

Comment Options

//isi cbmode=conditional/always/never - Overides callback parameter mode.
Setup
  1. Declare in global scope: var _r={},_i=0
  2. Put this at top of the tick callback: for(let e in _r)_r[e](),delete _r[e];

Safe Functions
Blacklisted Functions
Async Wrapper Functions
Callback Parameter Mode
Comment Mode
Protected Assignments

Input

Output