futarina-x-explorer/debug_variables.js
2025-07-23 07:00:32 -05:00

93 lines
4.3 KiB
JavaScript

// Debug script to find all available global variables
// Paste this into the developer console first to see what's available
(function() {
console.log('=== DEBUGGING AVAILABLE VARIABLES ===');
// Check all global variables starting with $
console.log('\n🔍 All $data* variables:');
Object.keys(window).filter(key => key.startsWith('$data')).forEach(key => {
const data = window[key];
const type = Array.isArray(data) ? 'Array' : typeof data;
const size = Array.isArray(data) ? data.length : (typeof data === 'object' && data !== null ? Object.keys(data).length : 'N/A');
console.log(` ${key}: ${type} (${size} items)`);
});
// Check $gameSystem for custom data
console.log('\n🔍 $gameSystem properties:');
if (window.$gameSystem) {
Object.keys($gameSystem).forEach(key => {
const data = $gameSystem[key];
const type = Array.isArray(data) ? 'Array' : typeof data;
const size = Array.isArray(data) ? data.length : (typeof data === 'object' && data !== null ? Object.keys(data).length : 'N/A');
console.log(` $gameSystem.${key}: ${type} (${size} items)`);
});
} else {
console.log(' $gameSystem not available');
}
// Check $gameTemp for custom data
console.log('\n🔍 $gameTemp properties:');
if (window.$gameTemp) {
Object.keys($gameTemp).forEach(key => {
const data = $gameTemp[key];
const type = Array.isArray(data) ? 'Array' : typeof data;
const size = Array.isArray(data) ? data.length : (typeof data === 'object' && data !== null ? Object.keys(data).length : 'N/A');
console.log(` $gameTemp.${key}: ${type} (${size} items)`);
});
} else {
console.log(' $gameTemp not available');
}
// Look for custom properties directly on window
console.log('\n🔍 Custom variables on window:');
const customKeys = ['gallery', 'db_1', 'msg_1', 'testScenario', 'areaName', 'scnText', 'credits', 'frames', 'destinations'];
customKeys.forEach(key => {
if (window[key] !== undefined) {
const data = window[key];
const type = Array.isArray(data) ? 'Array' : typeof data;
const size = Array.isArray(data) ? data.length : (typeof data === 'object' && data !== null ? Object.keys(data).length : 'N/A');
console.log(` window.${key}: ${type} (${size} items)`);
} else {
console.log(` window.${key}: not found`);
}
});
// Check DataManager for custom data methods
console.log('\n🔍 DataManager methods and properties:');
if (window.DataManager) {
Object.keys(DataManager).forEach(key => {
const prop = DataManager[key];
if (typeof prop === 'function') {
console.log(` DataManager.${key}(): function`);
} else if (typeof prop === 'object' && prop !== null) {
const size = Array.isArray(prop) ? prop.length : Object.keys(prop).length;
console.log(` DataManager.${key}: object (${size} items)`);
} else {
console.log(` DataManager.${key}: ${typeof prop}`);
}
});
} else {
console.log(' DataManager not available');
}
// Look for any variables containing "Gallery", "Area", etc.
console.log('\n🔍 Variables containing key terms:');
const searchTerms = ['gallery', 'area', 'destination', 'frame', 'credit', 'particle'];
searchTerms.forEach(term => {
console.log(`\n Variables containing "${term}":`);
Object.keys(window).forEach(key => {
if (key.toLowerCase().includes(term.toLowerCase())) {
const data = window[key];
const type = Array.isArray(data) ? 'Array' : typeof data;
const size = Array.isArray(data) ? data.length : (typeof data === 'object' && data !== null ? Object.keys(data).length : 'N/A');
console.log(` window.${key}: ${type} (${size} items)`);
}
});
});
console.log('\n=== END DEBUG INFO ===');
console.log('\nNow run the main extraction script to see what it can find!');
return 'Debug complete - check console output above';
})();