dict.get returns an object where I would expect a string.

James Bradbury's icon

I am making a modified version of the helpdetails.js file for a package. I want similar functionality, except my version of helpdetails.js would look at another section and not just the content between tags the tags <digest> and <description>. The original code looks simple. You take the text between two tags using dict.get("tags"). You then do any necessary drawing parameters and then call show_text(nameOfVar) where nameOfVar is the data assigned from dict.get(). My problem is that no matter what I do, dict.get will return an object and not a string. It will always return a string if dict.get() is pointed to 'digest' or 'description' but anything else fails.

Here is a boiled down version of the code where I have removed extraneous stuff for testing.

autowatch = 1;
inlets=1;
outlets=1;
this.box.message("border", 0);
this.box.message("ignoreclick", 1);
mgraphics.init();
mgraphics.relative_coords = 0;
mgraphics.autofill = 0;
var alpha = 1.0;
var name = jsarguments[1];
var dict;
var paramDesc = "";
var desc = "";
function init()
{
    dict = max.getrefdict(name);
    if (typeof(dict) == "object") {
        paramDesc = dict.get("params");
        dict.freepeer();
    }
}
init();
function paint()
{
    if(name){
        with(mgraphics) 
        {
            var bgcolor = this.patcher.getattr("locked_bgcolor");
            set_source_rgba(bgcolor);
            paint();
            select_font_face("Lato");
             var textcolor = this.patcher.getattr("textcolor");
            set_source_rgba(textcolor);
               set_font_size(13);
            move_to(4, 100);
            show_text(name);
            move_to(4, 200);
            // Parameters
            show_text(paramDesc);
            fill();
        }
    }
}
function wordwrap(str, width, brk, cut) 
{
     if(jsarguments[2]==null){jsarguments[2]=95};
    brk = brk || '\\cr';
    width = width || jsarguments[2];
    cut = cut || false;
    if (!str) { return str; }
    var regex = '.{1,' +width+ '}(\\s|$)' + (cut ? '|.{' +width+ '}|.+$' : '|\\S+?(\\s|$)');
    var v=str.match( RegExp(regex, 'g') );
    for(i=0;i<=v.length;i++)
        {    
            mgraphics.show_text(v[i], 1);
            mgraphics.move_to(4, 105+15*i);
        }
    return;
}

The start of the .maxref.xml file is here.

<c74object category="fl_Generators" module="FrameLib" name="fl.ramp~">

<digest>
Generates frames that consist of linear ramps from [0-x].
</digest>

<description>
dafiodsafidfoafioaiodaoisdf x depends on the scaling parameter. The size of the output is dependent on the mode. The output size may either be set as a parameter, or be set to match that of the triggering input.
</description>

<params>
This should be displayed!
</params>