The RPG Maker Resource Kit

RMRK RPG Maker Creation => MV => MV Scripts Database => Topic started by: DoubleX on October 27, 2015, 03:07:24 PM

Title: DoubleX RMMV Object Properties
Post by: DoubleX on October 27, 2015, 03:07:24 PM
Changelog
Code: [Select]
*      v1.00d(GMT 1500 27-1-2016):                                           
 *      1. Fixed enumerating this plugin's functions via for in loops bug     
 *      v1.00c(GMT 0100 13-11-2015):                                         
 *      1. Fixed tracing properties from null or non object object bug       
 *      v1.00b(GMT 1100 11-11-2015):                                         
 *      1. Added descriptions that will be shown in the plugin manager       
 *      v1.00a(GMT 1500 27-10-2015):                                         
 *      1. 1st version of this plugin finished                               

Authors
DoubleX

Credits
DoubleX(Optional)

Purpose
Traces all object properties meeting some conditions linked to the queried object
Designed as a bug diagnosis tool used by Javascript coders with debug experience

Plugin Calls
Code: [Select]
*============================================================================
 *    ## Plugin Call Info                                                     
 *       A path in the object property trace will stop if it'd be cyclic     
 *----------------------------------------------------------------------------
 *    # Object manipulations                                                 
 *      1. trace_obj_prop(cond, label)                                       
 *         - Traces all object properties satisfying function cond linked to 
 *           this object                                                     
 *         - Labels all traced object properties with function label         
 *         - cond and label are functions written in                         
 *           Object Property Tracing Condition Function and                   
 *           Object Property Tracing Label Function respectively             
 *      2. _obj_prop_log[cond]                                               
 *         - Returns the log of all traced object properties satisfying       
 *           function cond linked to this object                             
 *============================================================================

Configuration
Code: [Select]
    /*------------------------------------------------------------------------
     *    Object Property Tracing Condition Function                         
     *    - Setups cond used by trace_obj_prop(cond, label)                   
     *------------------------------------------------------------------------*/
    /* cond must be a function taking the object property as the only argument
       The below examples are added to help you setup your own cond functions */

    // Checks if the currently traced object's indeed an object
    cond_obj: function(obj) {
        return typeof obj === "object";
    }, // substitute cond with "cond_obj" to use this function

    // Checks if the currently traced object's an array
    cond_array: function(obj) {
        return Array.isArray(obj);
    }, // substitute cond with "cond_array" to use this function

    // Add your own cond functions here
   

    /*------------------------------------------------------------------------
     *    Object Property Tracing Label Function                             
     *    - Setups label used by trace_obj_prop(cond, label)                 
     *------------------------------------------------------------------------*/
    /* label must be a function taking the object property as the only argument
       All label functions must return a string
       The below examples are added to help you setup your own label functions */

    // Always returns the entire object
    label_obj: function(obj) {
        return obj;
    }, // substitute label with "label_obj" to use this function

    // Always returns the type(including Array) of each traced object property
    label_array: function(obj) {
        if (Array.isArray(obj)) {
            return "array";
        }
        return typeof obj;
    } // substitute label with "label_array" to use this function

    // Add your own label functions here
   

Prerequisites
Abilities:
1. Basic knowledge of inspecting object properties in Javascript
2. Some Javascript coding proficiency to fully utilize this plugin

Terms Of Use
You shall keep this plugin's Plugin Info part's contents intact
You shalln't claim that this plugin's written by anyone other than DoubleX or his aliases
None of the above applies to DoubleX or his/her aliases
Title: Re: DoubleX RMMV Object Properties
Post by: DoubleX on November 11, 2015, 11:19:41 AM
Updates
Code: [Select]
*      v1.00b(GMT 1100 11-11-2015):                                         
 *      1. Added descriptions that will be shown in the plugin manager       
Title: Re: DoubleX RMMV Object Properties
Post by: DoubleX on November 16, 2015, 10:33:06 AM
Updates
Code: [Select]
*      v1.00c(GMT 0100 13-11-2015):                                         
 *      1. Fixed tracing properties from null or non object object bug       
Title: Re: DoubleX RMMV Object Properties
Post by: DoubleX on January 29, 2016, 12:58:25 PM
Updates
Code: [Select]
*      v1.00d(GMT 1500 27-1-2016):                                           
 *      1. Fixed enumerating this plugin's functions via for in loops bug