Awesome Arrays - Deep Arrays
I thought I'd make a more user friendly breakdown on what the additional plugin AwesomeArrays let's you do since the info in the plugin text itself is rather technical. I'll breakdown what each object type is & the important functions/methods you need to know to use them correctly. This time it's DeepArrays.
DeepArrays:
These are multi-dimensional arrays with built in utility. Think of them as specialized boxes for scripted objects. Beyond that, I give you access to two types of boxes, 2D & 3D. Keep in mind that this object is still technically a JS Array as well so all standard array functions apply to it.
2D DeepArrays
Think of these as flat boxes. Objects inside are contained in rows & columns.
You create one like this: var inventory = new DeepArray(maxColumns, maxRows)
So... var inventory = new DeepArray(4, 4) creates a box that can hold 16 objects with up to 4 objects per row.
Meanwhile... var inventory = new DeepArray(4) also works & alternatively creates a box that can hold infinite objects with up to 4 objects per row. The rows will simply increase as necessary as they fill. The first argument is the only hard requirement.
3D DeepArrays
Think of these as tall boxes or for a clearer reference think of beehives. Like beehives, they store multiple pages(think palettes of honey/bees) further arranged in another dimension(front to back beehives). The great part is you don't have to specify anything extra to create them. DeepArrays process overflow objects into additional "pages" for you as long as you specify both a max column value & max row value so the above example is all you need to know.
The next important thing to know is how to add to these arrays.
Add Function
This is pretty simple. Syntax: DeepArray.add(object/objectArray)
The only thing worth noting specifically is that I set it up to process arrays of objects for you as well so both of the following uses are valid:
Well be using the 4x4 DeepArray from earlier we called "inventory" for this example.
var object1 = new Car();
var object2 = new Boat();
var object3 = new Plane();
var object4 = [object1, object2, object3];
inventory.add(object1);
inventory.add(object4)
Like I said, all the hard lifting is done for you here when it comes to arrays of objects. Keep in mind that this function also does the equivalent of Array.push() so Array.prototype functions such as Array.pop() will still function with DeepArrays. The next important thing to know is that once created they can then be referenced by multiple functions.
Search Function
The "search" function will let you find objects by row, column, & optionally page. Syntax: DeepArray.search(row, column, page)
So using the DeepArray from earlier we called "inventory" we can write... var myItem = inventory,search(2, 4) to access object the object stored at row 2, column 4 (object #8). The search function uses indexes starting at 1 for ease of use.
Additionally, let's say you've put 64 objects into that 4x4 box turning it into a 3D DeepArray automatically...
It would have 4 complete pages of objects at that point. Still, if we wanted to find object #24 we know that it should be beyond page 1 since each page holds 16 objects max. We also know that it shouldn't be on page 3 then(33-48). Subtracting the 16 page 1 objects we know it's not with we can determine that it should be object #8 on page 2. We should know that object #8 should be at row 2, column 4 already. Knowing this we can search for it on page 2 like so... var myItem = inventory,search(2, 4, 2) => Object #24.
Find Function
The "find" function will let you find objects by passing a reference to that object. This requires the knowledge that once you assign a value to a variable in js it's gonna remain that value until changed. With this in mind:
Well be using the 4x4 DeepArray from earlier we called "inventory" for this example as well. Assuming it contains the car, boat, & plane added earlier, we can then access one with this function using the variables defined earlier.
var myItem1 = inventory.find(object1) => The car we added.
var myItem2 = inventory.find(object3) => The plane we added.
It's there but I don't anyone would use this much tbh. Lastly, I'll make note of the last function worth knowing.
Clear Function
As you would imagine this just effectively clears this complex object.
Get Hover Display Plugin for RPG Maker MV
Hover Display Plugin for RPG Maker MV
Display formatted text on hover
Status | Released |
Category | Assets |
Author | Kingpin RBD |
Tags | hover, hover-display, hover-text, plugin, rmmv, RPG Maker, RPG Maker MV |
More posts
- Updated Hover Display v1.1.3Dec 16, 2022
- Updated Awesome Arrays v1.3.3Dec 16, 2022
- Awesome Arrays - TextBuffersAug 08, 2022
- Updated Awesome Arrays v1.3.2Aug 08, 2022
- Awesome Arrays - Container ArraysJul 31, 2022
Leave a comment
Log in with itch.io to leave a comment.