So I now have an issue with a value that is persisting between sessions, even though it should not. General.GetOrCreateHandout = function(handoutName){
var handout = findObjs({ type: 'handout', name : handoutName })[0];
log(handoutName+ ':' + JSON.stringify(handout));
if(!handout){
handout = createObj('handout', { name: handoutName });
}
return handout;
}
Initializer.Initialize = function(){
var LoadItems = [];
var installedListHandout = General.GetOrCreateHandout('Installed Modules');
installedListHandout.get('notes',function(installedTable){
var installedArray = [];
if(installedTable){
installedArray = General.TableToJSONArray(installedTable);
}
var installList = _.reject(Initializer.Installer.ToDoList,function(rejectItem){
return _.filter(installedArray,function(filterItem){
return filterItem.Name == rejectItem.Name && parseInt(filterItem.Version) == parseInt(rejectItem.Version);
}).length > 0;
});
log(installList);
LoadItems.concat(installList);
installedTable = '';
});
_.each(Initializer.ToDoList,function(pendingModule){
pendingModule.LoadOrder = parseFloat(pendingModule.LoadOrder) + parseFloat(0.1);
LoadItems.push(pendingModule);
});
var tableString = '<table><tbody><tr><td>Name</td><td>Version</td></tr>';
_.each(Initializer.Installer.ToDoList,function(item){
tableString += '<tr><td>' + item.Name + '</td><td>' + item.Version + '</td></tr>';
});
tableString +='</tbody></table>';
installedListHandout.set('notes',tableString);
LoadItems.sort(function(a,b){ return a.LoadOrder - b.LoadOrder; });
_.each(LoadItems,function(item){
item.Execute();
});
sendChat(Initializer.Key,"The API has completed the initialization process and is ready to use.");
}
function KillAllTheEffingHandouts(){
_.each(findObjs({ type: 'handout' }),function(item){
item.remove();
});
} It seems no matter what I try, even if there are no handouts in the campaign, var installedListHandout = General.GetOrCreateHandout('Installed Modules');
=> "{\"name\":\"Installed Modules\",\"notes\":\"\",\"gmnotes\":\"\",\"inplayerjournals\":\"\",\"archived\":false,\"controlledby\":\"\",\"_type\":\"handout\",\"_id\":\"-JpUSB0YIw7W2QlUJOZE\",\"avatar\":\"\"}"
installedListHandout.get('notes',function(installedTable){
=> "<table><tbody><tr><td>Name</td><td>Version</td></tr><tr><td>CurriculumVitae</td><td>1</td></tr></tbody></table>" I have no idea how this is happening. That string should not be there. It should be empty. And since it IS there, it's filtering the module out of the installer's ToDoList, preventing it from creating the necessary handouts.