I'm trying to use Yanfly's Enhanced TP for a project. It runs just fine with every other plugin I'm using. Until I activate SSG Item Sort. If I go to my TP Mode menu option, I get the error "Cannot read property "0" of undefined". I'm not sure what it means. Anyone know how I can fix this?
Yanfly's Enh TP Vs SSG Item Sort
Javascript/Plugin Support
Code:
//Save as anything js.
(function () {
if (SSG_Heartbreak !== undefined) {
var parameters = $plugins.filter(function (plugin) {
return plugin.description.indexOf('<SSG_ItemSort>') != -1;
})[0].parameters;
var sM = String(parameters['Sort Mode'] || 'descending');
SSG_Heartbreak.itemSort = function (list) {
list.sort(function (a, b) {
var result;
if (sM.toLowerCase() === 'ascending') {
if (a.sortValue !== undefined && b.sortValue !== undefined)
result = a.sortValue[0] - b.sortValue[0];
if (result === 0) {
if (a.sortValue !== undefined && b.sortValue !== undefined)
result = a.sortValue[1] - b.sortValue[1];
}
} else {
if (a.sortValue !== undefined && b.sortValue !== undefined)
result = b.sortValue[0] - a.sortValue[0];
if (result === 0) {
if (a.sortValue !== undefined && b.sortValue !== undefined)
result = b.sortValue[1] - a.sortValue[1];
}
}
if (result === 0) {
if (a.sortValue !== undefined && b.sortValue !== undefined)
result = a.id - b.id;
}
return result;
})
};
}
})();
Thank you so much! Works perfectly.
Original thread: https://forums.rpgmakerweb.com/threads/yanflys-enh-tp-vs-ssg-item-sort.58034/