Familiar territory. Utils keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.
The static class that defines utility methods.
function Utils()
Quick Reference
Setup & Creation 1
| loadWebFileIndex() | Loads the web file index. |
Getting Information 2
| resolveFileCase() | Resolve file case. |
| resolveAudioExtension() | Resolves an audio URL's extension against what actually exists on disk. |
Checks (True / False) 15
| isOptionValid() | Checks whether the option is in the query string. |
| isNwjs() | Checks whether the platform is NW.js. |
| isMobileDevice() | Checks whether the platform is a mobile device. |
| isMobileSafari() | Checks whether the browser is Mobile Safari. |
| isAndroidChrome() | Checks whether the browser is Android Chrome. |
| isLocal() | Checks whether the browser is accessing local files. |
| canUseWebGL() | Checks whether the browser supports WebGL. |
| canUseWebAudioAPI() | Checks whether the browser supports Web Audio API. |
| canUseCssFontLoading() | Checks whether the browser supports CSS Font Loading. |
| canUseIndexedDB() | Checks whether the browser supports IndexedDB. |
| canPlayOgg() | Checks whether the browser can play ogg files. |
| canPlayWebm() | Checks whether the browser can play webm files. |
| containsArabic() | Checks whether the string contains any Arabic characters. |
| hasEncryptedImages() | Checks whether the image files in the game are encrypted. |
| hasEncryptedAudio() | Checks whether the audio files in the game are encrypted. |
Actions 4
| setEncryptionInfo() | Sets information related to encryption. |
| setWebFileIndex() | Sets the web file index. |
| startAssetUseRecord() | Starts the asset use record. |
| saveAssetUse() | Saves the asset use. |
Other 10
| checkRMVersion() | Checks whether the current RPG Reactor version is greater than or equal to the given version. |
| encodeURI() | Encodes a URI component without escaping slash characters. |
| extractFileName() | Gets the filename that does not include subfolders. |
| escapeHtml() | Escapes special characters for HTML. |
| existsOnDisk() | Exists on disk. |
| correctFileCase() | Correct file case. |
| correctFileCaseFromIndex() | Correct file case from index. |
| localAssetExists() | Whether a relative asset file is on disk, in any letter case. |
| noteAssetUse() | Note asset use. |
| decryptArrayBuffer() | Decrypts encrypted data. |
Setup & Creation
loadWebFileIndex
static sourceUtils.loadWebFileIndex()
Loads the web file index. (Same as the RPG Maker MZ method of this name.)
Getting Information
resolveFileCase
static sourceUtils.resolveFileCase(url, suffix)
Resolve file case. (Same as the RPG Maker MZ method of this name.)
resolveAudioExtension
static sourceUtils.resolveAudioExtension(url, suffix)
Resolves an audio URL's extension against what actually exists on disk.
Details
Resolves an audio URL's extension against what actually exists on disk.
Audio references are stored extensionless and requested as ".ogg", but a project may ship the track as .mp3, .wav or .m4a instead. With the filesystem at hand the real extension is found before the request; on the web the load-error fallback chain covers the same ground.
Checks (True / False)
isOptionValid
static sourceUtils.isOptionValid(name)
Checks whether the option is in the query string.
Details
Checks whether the option is in the query string.
isNwjs
static sourceUtils.isNwjs()
Checks whether the platform is NW.js.
Details
Checks whether the platform is NW.js.
isMobileDevice
static sourceUtils.isMobileDevice()
Checks whether the platform is a mobile device.
Details
Checks whether the platform is a mobile device.
isMobileSafari
static sourceUtils.isMobileSafari()
Checks whether the browser is Mobile Safari.
Details
Checks whether the browser is Mobile Safari.
isAndroidChrome
static sourceUtils.isAndroidChrome()
Checks whether the browser is Android Chrome.
Details
Checks whether the browser is Android Chrome.
isLocal
static sourceUtils.isLocal()
Checks whether the browser is accessing local files.
Details
Checks whether the browser is accessing local files.
canUseWebGL
static sourceUtils.canUseWebGL()
Checks whether the browser supports WebGL.
Details
Checks whether the browser supports WebGL.
canUseWebAudioAPI
static sourceUtils.canUseWebAudioAPI()
Checks whether the browser supports Web Audio API.
Details
Checks whether the browser supports Web Audio API.
canUseCssFontLoading
static sourceUtils.canUseCssFontLoading()
Checks whether the browser supports CSS Font Loading.
Details
Checks whether the browser supports CSS Font Loading.
canUseIndexedDB
static sourceUtils.canUseIndexedDB()
Checks whether the browser supports IndexedDB.
Details
Checks whether the browser supports IndexedDB.
canPlayOgg
static sourceUtils.canPlayOgg()
Checks whether the browser can play ogg files.
Details
Checks whether the browser can play ogg files.
canPlayWebm
static sourceUtils.canPlayWebm()
Checks whether the browser can play webm files.
Details
Checks whether the browser can play webm files.
containsArabic
static sourceUtils.containsArabic(str)
Checks whether the string contains any Arabic characters.
Details
Checks whether the string contains any Arabic characters.
hasEncryptedImages
static sourceUtils.hasEncryptedImages()
Checks whether the image files in the game are encrypted.
Details
Checks whether the image files in the game are encrypted.
hasEncryptedAudio
static sourceUtils.hasEncryptedAudio()
Checks whether the audio files in the game are encrypted.
Details
Checks whether the audio files in the game are encrypted.
Actions
setEncryptionInfo
static sourceUtils.setEncryptionInfo(hasImages, hasAudio, key)
Sets information related to encryption.
Details
Sets information related to encryption.
setWebFileIndex
static sourceUtils.setWebFileIndex(files)
Details
startAssetUseRecord
static sourceUtils.startAssetUseRecord(force)
Starts the asset use record. (Same as the RPG Maker MZ method of this name.)
saveAssetUse
static sourceUtils.saveAssetUse()
Saves the asset use. (Same as the RPG Maker MZ method of this name.)
Other
checkRMVersion
static sourceUtils.checkRMVersion(version)
Checks whether the current RPG Reactor version is greater than or equal to the given version.
Details
Checks whether the current RPG Reactor version is greater than or equal to the given version.
encodeURI
static sourceUtils.encodeURI(str)
Encodes a URI component without escaping slash characters.
Details
Encodes a URI component without escaping slash characters.
extractFileName
static sourceUtils.extractFileName(filename)
Gets the filename that does not include subfolders.
Details
Gets the filename that does not include subfolders.
escapeHtml
static sourceUtils.escapeHtml(str)
Escapes special characters for HTML.
Details
Escapes special characters for HTML.
existsOnDisk
static sourceUtils.existsOnDisk(file)
Exists on disk. (Same as the RPG Maker MZ method of this name.)
correctFileCase
static sourceUtils.correctFileCase(url)
Correct file case. (Same as the RPG Maker MZ method of this name.)
correctFileCaseFromIndex
static sourceUtils.correctFileCaseFromIndex(url)
Details
localAssetExists
static sourceUtils.localAssetExists(url)
Whether a relative asset file is on disk, in any letter case.
Details
Whether a relative asset file is on disk, in any letter case. Known only with the filesystem at hand (NW.js): null elsewhere, where a request finds out.
noteAssetUse
static sourceUtils.noteAssetUse(url)
Note asset use. (Same as the RPG Maker MZ method of this name.)
decryptArrayBuffer
static sourceUtils.decryptArrayBuffer(source)
Decrypts encrypted data.
Details
Decrypts encrypted data.