I've noticed a lot common expressions and the like that come somewhat normally to me, being something of a bother to others that I work with regularly. We spend a lot of time in noteboxes and script commands writing evals to do crazy custom things. I've seen how a ton of inspiration can quickly be halted by a lack of knowledge of scripting... also, I hate repeating my own code.

As such, I've written "Utilities". It's a humble start to what I hope to be an expansive collection of JavaScript functions that will make writing those notetags and script commands a breeze.

Please keep in mind that documentation will probably be limited for some time, as this plugin will be growing rather rapidly, and I may simply need to get it out before it gets written up. Hang in there. I'll get it all documented one day.

Happy scripting!

Download NeMV - Utilities

Utilities post on RM Forums (n/a)

Utilities entry on MV Plugins

NeMV on Github


Introduction

This is a set of JavaScript helper methods for various aspects of RMMV. Some items will only be available with the proper plugins installed, but no extra plugins are required in order to use it.

Usage

Various utility methods are presented here to assist you in your development of notetag evals, event script commands, or even plugins. Here they are, and a couple of examples of their use. Please note that the method prefixes ("NeMV" and "nemv") are interchangeable for your typing convenience.

! IMPORTANT !

Not everything in this plugin is documented. Some methods have yet to get write-ups, so don't be afraid to dig in and see what everything does. I will be updating this and its documentation as often as I am able, but this will more than likely grow in function faster than I can write entries for it. As such it will probably remain in an alpha-state (doesn't mean "scary", just not "feature-complete") for quite some time.

Array.random(skipOne?) [returns a random value from the array]

This helper is actually added to the JavaScript [Array] object itself. It allows you to easily pick a value out of a set without having to worry about the [Math]. The optional skipOne parameter is a convenience for you to easily skip the zeroth index (useful for looking at $data[Type] arrays) from RMMV's database.

$dataSkills.random(true) // returns a random skill
["Hey!","Hello!","Hi!"].random() // returns a random greeting

NeMV.chance(ratio|percent) [returns true|false]

Simply an easy access to random chance. Calling the method with a string (text) will attempt to turn it into a ratio check (e.g. "1:15", "2/30", "3 out of 45", and "4 in 60" will all return the same), and will compare the result of that ratio against a random number, returning success or failure.

nemv.chance(20) // returns true 20% of the time
nemv.chance("37 out of 42") // returns true ~88% of the time

Support

Should this plugin not work for you for any reason, please notify me by creating a GitHub issue, emailing me at lance@nekoyoubi.com, or message me in any social convention you happen to see me in.

Thanks, and happy scripting!