From eecd8bcdb23b793fea68fb3ca707c98d064f5555 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 07:37:24 +0900 Subject: [PATCH 01/56] Add evalRouteScript() --- js/rpg_objects/Game_Character.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Character.js b/js/rpg_objects/Game_Character.js index 85bfed0d..223a8137 100644 --- a/js/rpg_objects/Game_Character.js +++ b/js/rpg_objects/Game_Character.js @@ -262,11 +262,16 @@ Game_Character.prototype.processMoveCommand = function(command) { AudioManager.playSe(params[0]); break; case gc.ROUTE_SCRIPT: - eval(params[0]); + this.evalRouteScript(params[0]); break; } }; +Game_Character.prototype.evalRouteScript = function(script){ + var gc = Game_Character; + eval(script); +}; + Game_Character.prototype.deltaXFrom = function(x) { return $gameMap.deltaX(this.x, x); }; From 5d15e41452c2a20ef5b1b13d3153393aa0eec258 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 07:38:21 +0900 Subject: [PATCH 02/56] add setupEvent() --- js/rpg_objects/Game_CommonEvent.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_CommonEvent.js b/js/rpg_objects/Game_CommonEvent.js index 5a9a707c..8f82963c 100644 --- a/js/rpg_objects/Game_CommonEvent.js +++ b/js/rpg_objects/Game_CommonEvent.js @@ -36,10 +36,13 @@ Game_CommonEvent.prototype.isActive = function() { return event.trigger === 2 && $gameSwitches.value(event.switchId); }; +Game_CommonEvent.prototype.setupEvent =function(){ + this._interpreter.setup(this.list()); +}; Game_CommonEvent.prototype.update = function() { if (this._interpreter) { if (!this._interpreter.isRunning()) { - this._interpreter.setup(this.list()); + this.setupEvent(); } this._interpreter.update(); } From e5736e109a65f5162ce4860051b219f8392dd39a Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 07:40:54 +0900 Subject: [PATCH 03/56] add evalScript() --- js/rpg_objects/Game_Interpreter.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 56b36b83..7ac09e67 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -543,7 +543,7 @@ Game_Interpreter.prototype.command111 = function() { result = Input.isPressed(this._params[1]); break; case 12: // Script - result = !!eval(this._params[1]); + result = !!this.evalScript(this._params[1]); break; case 13: // Vehicle result = ($gamePlayer.vehicle() === $gameMap.vehicle(this._params[1])); @@ -680,7 +680,7 @@ Game_Interpreter.prototype.command122 = function() { value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]); break; case 4: // Script - value = eval(this._params[4]); + value = this.evalScript(this._params[4]); break; } for (var i = this._params[0]; i <= this._params[1]; i++) { @@ -689,6 +689,11 @@ Game_Interpreter.prototype.command122 = function() { return true; }; +Game_Interpreter.prototype.evalScript = function(script){ + return eval(script); +}; + + Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) { switch (type) { case 0: // Item @@ -1736,7 +1741,7 @@ Game_Interpreter.prototype.command355 = function() { this._index++; script += this.currentCommand().parameters[0] + '\n'; } - eval(script); + this.evalScript(script); return true; }; From c2ef6d3256110e4d66cabf3235a1d06f79b7db9e Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 07:45:11 +0900 Subject: [PATCH 04/56] Fixed stack trace display. --- js/rpg_core/Graphics.js | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/js/rpg_core/Graphics.js b/js/rpg_core/Graphics.js index 93a252a0..94496c16 100644 --- a/js/rpg_core/Graphics.js +++ b/js/rpg_core/Graphics.js @@ -411,24 +411,35 @@ Graphics.printError = function(name, message) { this._clearUpperCanvas(); }; -/** - * Shows the stacktrace of error. - * - * @static - * @method printStackTrace - */ -Graphics.printStackTrace = function(stack) { - if (this._errorPrinter) { - stack = (stack || '') - .replace(/file:.*js\//g, '') - .replace(/http:.*js\//g, '') - .replace(/https:.*js\//g, '') - .replace(/chrome-extension:.*js\//g, '') - .replace(/\n/g, '
'); - this._makeStackTrace(decodeURIComponent(stack)); +Graphics._makeErrorStackLog =function(e){ + if(e.stack){ + var log = e.stack.replace(/file:.*js\//g, '') + .replace(/http:.*js\//g, '') + .replace(/https:.*js\//g, '') + .replace(/chrome-extension:.*js\//g, '') + .replace(/\n/g, '
'); + return log; + } + return ''; +}; +Graphics.createErrorHTML =function(error){ + return this._makeErrorStackLog(error); +}; + +Graphics.printErrorDetail =function(e){ + if (this._errorPrinter){ + var html = this.createErrorHTML(e); + var detail = document.createElement('div'); + var style = detail.style; + style.color = 'white'; + style.textAlign = 'left'; + style.fontSize = '18px'; + detail.innerHTML = html + '
' ; + this._errorPrinter.appendChild(detail); } }; + /** * Sets the error message. * From e4a387970dc26d27ff44318516faec4a9ef74380 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 08:24:50 +0900 Subject: [PATCH 05/56] catchException() update --- js/rpg_managers/SceneManager.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/rpg_managers/SceneManager.js b/js/rpg_managers/SceneManager.js index d4c8d804..d0a1a19f 100644 --- a/js/rpg_managers/SceneManager.js +++ b/js/rpg_managers/SceneManager.js @@ -197,11 +197,15 @@ SceneManager.onKeyDown = function(event) { } }; +SceneManager.showErrorLog =function(e){ + console.error(e.stack); +}; + SceneManager.catchException = function(e) { if (e instanceof Error) { Graphics.printError(e.name, e.message); - Graphics.printStackTrace(e.stack); - console.error(e.stack); + Graphics.printErrorDetail(e); + this.showErrorLog(e); } else { Graphics.printError('UnknownError', e); } From e93f73fab88b8dc76cfd5b997a49016db7893838 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 18:35:50 +0900 Subject: [PATCH 06/56] Plug-in part of error log system. --- plugins/Game_Log.js | 408 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 408 insertions(+) create mode 100644 plugins/Game_Log.js diff --git a/plugins/Game_Log.js b/plugins/Game_Log.js new file mode 100644 index 00000000..c98f43ff --- /dev/null +++ b/plugins/Game_Log.js @@ -0,0 +1,408 @@ + + +function Game_LogBase(){ + this.initialize.apply(this,arguments); +} + +Game_LogBase.prototype.createMessage = function(){ + return 'unknow error'; +}; +Game_LogBase.prototype.initialize = function(){ + this._additionalLog =[]; +}; + +Game_LogBase.prototype.createErrorHTML =function(){ + var addError = this.createAdditionalError('
'); + return this.createMessage() +addError+ '

'; +}; +Game_LogBase.prototype.createConsolMessage =function(){ + return this.createMessage() + this.createAdditionalError("\n"); +}; +Game_LogBase.prototype.addLog =function(text){ + if(!this._additionalLog){ + this._additionalLog =[]; + } + this._additionalLog.push(text); +}; +Game_LogBase.prototype.createAdditionalError =function(brStr){ + if(!this._additionalLog){return "";} + var result =brStr; + for(var i=0; i < this._additionalLog.length; ++i){ + result += this._additionalLog[i] + brStr; + } + return result; +}; + +function Game_LogMapEvent(){ + this.initialize.apply(this,arguments); +} + +Game_LogMapEvent.prototype = Object.create(Game_LogBase.prototype); +Game_LogMapEvent.prototype.constructor = Game_LogMapEvent; + +Game_LogMapEvent.prototype.initialize = function(mapId,eventId,page){ + this._mapId = mapId; + this._eventId = eventId; + this._page = page; +}; + +Game_LogMapEvent.prototype.event = function(){ + if($gameMap.mapId() === this._mapId){ + var event = $gameMap.event(this._eventId); + if(event){ + return event; + } + } + return null; +}; + +Game_LogMapEvent.prototype.getEventName = function(){ + var event = this.event(); + if(event){ + return event.debugName(); + } + return ""; +} +Game_LogMapEvent.prototype.createMessage = function(){ + var event = this.event(); + if(event){ + return ( "MapID: %1,%2, page: %3").format(this._mapId,event.debugName(),this._page); + } + return ""; +}; + +function Game_LogEventPgaeMoveRoute(){ + this.initialize.apply(this,arguments); +} + +Game_LogEventPgaeMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); +Game_LogEventPgaeMoveRoute.prototype.constructor = Game_LogEventPgaeMoveRoute; + +Game_LogEventPgaeMoveRoute.prototype.createMessage =function(){ + return "(Move Route)"+ Game_LogMapEvent.prototype.createMessage.call(this) ; +}; + +function Game_LogCommonEvent(){ + this.initialize.apply(this,arguments); +} + +Game_LogCommonEvent.prototype = Object.create(Game_LogBase.prototype); +Game_LogCommonEvent.prototype.constructor = Game_LogCommonEvent; + +Game_LogCommonEvent.prototype.initialize = function(eventId){ + this._eventId = eventId; + this._parent =null; +}; + +Game_LogCommonEvent.prototype.getEventName = function(){ + var event = $dataCommonEvents[this._eventId]; + if(event){ + if(event.name ===''){ + return 'unnamede'; + } + return event.name; + } + return ""; +}; +Game_LogCommonEvent.prototype.createMessage = function(){ + var name = this.getEventName(); + return ("CommonEvent: %1(%2)").format( + this._eventId, + name + ); +}; + +Game_LogCommonEvent.prototype.setParent = function(parent){ + this._parent = parent; +}; + +function Game_LogBattleEvent(){ + this.initialize.apply(this,arguments); +} + +Game_LogBattleEvent.prototype = Object.create(Game_LogBase.prototype); +Game_LogBattleEvent.prototype.constructor = Game_LogBattleEvent; +Game_LogBattleEvent.prototype.initialize = function(troopId,page){ + this._troopId = troopId; + this._page =page; +}; + +Game_LogBattleEvent.prototype.getEventName = function(){ + var troop = $dataTroops[this._troopId]; + if(troop){ + return troop.name; + } + return ""; +}; + +Game_LogBattleEvent.prototype.createMessage = function(){ + var name = this.getEventName(); + return ("TroopID: %1(%2), page: %3").format( + this._troopId, + name, + 1+this._page + ); +}; + +function Game_LogEventTest(){ + this.initialize.apply(this,arguments); +} + +Game_LogEventTest.prototype = Object.create(Game_LogBase.prototype); +Game_LogEventTest.prototype.constructor = Game_LogBattleEvent; +Game_LogEventTest.prototype.initialize = function(){ +}; + +Game_LogEventTest.prototype.createMessage = function(){ + return ('EventTest'); +}; + +(function(){ +Game_CharacterBase.prototype.setMoveRouteLog = function(callLog){ + this._moveRouteLog = callLog; +}; +Game_CharacterBase.prototype.getErrorLog = function(){ + return this._moveRouteLog; +}; + + +Game_Character.prototype.restoreMoveRoute = function() { + this._moveRoute = this._originalMoveRoute; + this._moveRouteIndex = this._originalMoveRouteIndex; + this._originalMoveRoute = null; + this._moveRouteLog = null; +}; + +Game_Character.prototype.evalRouteScript = function(script){ + var gc = Game_Character; + try { + eval(script); + } catch (error) { + if(this._moveRouteLog){ + error.rpgmv = this; + this._moveRouteLog.addLog('moveRouteError'); + this._moveRouteLog.addLog('target:'+this.debugName()); + this._moveRouteLog.addLog("script:"+script); + } + throw(error); + } +}; + +Game_Player.prototype.debugName = function(){ + return "player"; +}; + +Game_Follower.prototype.debugName = function(){ + return "follower[" + this._memberIndex+"]"; +}; + +Game_Vehicle.prototype.debugName = function(){ + return "vehicle("+this._type+")"; +}; + +Game_Event.prototype.debugName = function(){ + var event = this.event(); + if(event){ + return "MapEvent:"+ this._eventId +"("+ event.name+")"; + } + return ""; +}; + +Game_Event.prototype.createLogClass = function(){ + return new Game_LogMapEvent( + this._mapId, + this._eventId, + this._pageIndex + ); +}; + +Game_Event.prototype.setupPageSettings = function() { + var page = this.page(); + var image = page.image; + if (image.tileId > 0) { + this.setTileImage(image.tileId); + } else { + this.setImage(image.characterName, image.characterIndex); + } + if (this._originalDirection !== image.direction) { + this._originalDirection = image.direction; + this._prelockDirection = 0; + this.setDirectionFix(false); + this.setDirection(image.direction); + } + if (this._originalPattern !== image.pattern) { + this._originalPattern = image.pattern; + this.setPattern(image.pattern); + } + this.setMoveSpeed(page.moveSpeed); + this.setMoveFrequency(page.moveFrequency); + this.setPriorityType(page.priorityType); + this.setWalkAnime(page.walkAnime); + this.setStepAnime(page.stepAnime); + this.setDirectionFix(page.directionFix); + this.setThrough(page.through); + this.setMoveRoute(page.moveRoute); + this._moveType = page.moveType; + + if(this._moveType === 3){ + this.setMoveRouteLog( new Game_LogEventPgaeMoveRoute(this._mapId,this._eventId,this._pageIndex)); + } + + this._trigger = page.trigger; + if (this._trigger === 4) { + this._interpreter = new Game_Interpreter(); + } else { + this._interpreter = null; + } +}; + + +Game_Map.prototype.setupStartingMapEvent = function() { + var events = this.events(); + for (var i = 0; i < events.length; i++) { + var event = events[i]; + if (event.isStarting()) { + event.clearStartingFlag(); + this._interpreter.setup(event.list(), event.eventId()); + this._interpreter.setEventCallLog(event.createLogClass()); + return true; + } + } + return false; +}; + + +Game_Map.prototype.setupTestEvent = function() { + if ($testEvent) { + this._interpreter.setup($testEvent, 0); + this._interpreter.setEventCallLog(new Game_LogEventTest()); + $testEvent = null; + return true; + } + return false; +}; + + +Game_CommonEvent.prototype.setupEvent = function(){ + this._interpreter.setup(this.list()); + this._interpreter.setEventCallLog(new Game_LogCommonEvent(this._commonEventId)); +}; +Game_CommonEvent.prototype.update = function() { + if (this._interpreter) { + if (!this._interpreter.isRunning()) { + this.setupEvent(); + } + this._interpreter.update(); + } +}; + +Game_Troop.prototype.setupBattleEvent = function() { + if (!this._interpreter.isRunning()) { + if (this._interpreter.setupReservedCommonEvent()) { + return; + } + var pages = this.troop().pages; + for (var i = 0; i < pages.length; i++) { + var page = pages[i]; + if (this.meetsConditions(page) && !this._eventFlags[i]) { + this._interpreter.setup(page.list); + this._interpreter.setEventCallLog(new Game_LogBattleEvent(this._troopId,i)); + if (page.span <= 1) { + this._eventFlags[i] = true; + } + break; + } + } + } +}; + +Game_Interpreter.prototype.setEventCallLog = function(callLog){ + this._callLog = callLog; +}; + + +Game_Interpreter.prototype.setupChild = function(list, eventId) { + this._childInterpreter = new Game_Interpreter(this._depth + 1); + this._childInterpreter.setup(list, eventId); + this._childInterpreter.setEventCallLog(log); +// log.setParent(this._callLog); +}; + + +Game_Interpreter.prototype.getErrorLog = function(){ + return this._callLog; +}; +Game_Interpreter.prototype.evalScript = function(script){ + try { + return eval(script); + } catch (error) { + if(this._callLog){ + error.rpgmv = this; + this._callLog.addLog("evalError"); + this._callLog.addLog(script); + } + throw(error); + } +}; +// Set Movement Route +Game_Interpreter.prototype.command205 = function() { + $gameMap.refreshIfNeeded(); + this._character = this.character(this._params[0]); + if (this._character) { + this._character.forceMoveRoute(this._params[1]); + if (this._params[1].wait) { + this.setWaitMode('route'); + } + this._character.setMoveRouteLog(this._callLog); + } + return true; +}; + +// Plugin Command +Game_Interpreter.prototype.command356 = function() { + var args = this._params[0].split(" "); + var command = args.shift(); + try { + this.pluginCommand(command, args); + } catch (error) { + if(this._callLog){ + error.rpgmv = this; + this._callLog.addLog("command:"+command); + this._callLog.addLog("args:"+args); + } + throw(error); + } + return true; +}; + + +Graphics.createErrorHTML = function(error){ + return this._makeEventInfo(error)+ this._makeErrorStackLog(error); +}; + +Graphics._makeEventInfo = function(e){ + if(e.rpgmv){ + if(e.rpgmv.getErrorLog){ + var log = e.rpgmv.getErrorLog(); + if(log){ + return log.createErrorHTML(); + } + } + } + return ""; +}; + + +SceneManager.showErrorLog = function(e){ + console.error(e.stack); + if(e.rpgmv){ + if(e.rpgmv.getErrorLog){ + var log = e.rpgmv.getErrorLog(); + if(log){ + console.error(log.createConsolMessage() ); + } + } + } +}; + +})(); From ff55f0b0b13e500ea9b5dda06dd82380123b6395 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 18:53:26 +0900 Subject: [PATCH 07/56] Delete Game_Log.js --- plugins/Game_Log.js | 408 -------------------------------------------- 1 file changed, 408 deletions(-) delete mode 100644 plugins/Game_Log.js diff --git a/plugins/Game_Log.js b/plugins/Game_Log.js deleted file mode 100644 index c98f43ff..00000000 --- a/plugins/Game_Log.js +++ /dev/null @@ -1,408 +0,0 @@ - - -function Game_LogBase(){ - this.initialize.apply(this,arguments); -} - -Game_LogBase.prototype.createMessage = function(){ - return 'unknow error'; -}; -Game_LogBase.prototype.initialize = function(){ - this._additionalLog =[]; -}; - -Game_LogBase.prototype.createErrorHTML =function(){ - var addError = this.createAdditionalError('
'); - return this.createMessage() +addError+ '

'; -}; -Game_LogBase.prototype.createConsolMessage =function(){ - return this.createMessage() + this.createAdditionalError("\n"); -}; -Game_LogBase.prototype.addLog =function(text){ - if(!this._additionalLog){ - this._additionalLog =[]; - } - this._additionalLog.push(text); -}; -Game_LogBase.prototype.createAdditionalError =function(brStr){ - if(!this._additionalLog){return "";} - var result =brStr; - for(var i=0; i < this._additionalLog.length; ++i){ - result += this._additionalLog[i] + brStr; - } - return result; -}; - -function Game_LogMapEvent(){ - this.initialize.apply(this,arguments); -} - -Game_LogMapEvent.prototype = Object.create(Game_LogBase.prototype); -Game_LogMapEvent.prototype.constructor = Game_LogMapEvent; - -Game_LogMapEvent.prototype.initialize = function(mapId,eventId,page){ - this._mapId = mapId; - this._eventId = eventId; - this._page = page; -}; - -Game_LogMapEvent.prototype.event = function(){ - if($gameMap.mapId() === this._mapId){ - var event = $gameMap.event(this._eventId); - if(event){ - return event; - } - } - return null; -}; - -Game_LogMapEvent.prototype.getEventName = function(){ - var event = this.event(); - if(event){ - return event.debugName(); - } - return ""; -} -Game_LogMapEvent.prototype.createMessage = function(){ - var event = this.event(); - if(event){ - return ( "MapID: %1,%2, page: %3").format(this._mapId,event.debugName(),this._page); - } - return ""; -}; - -function Game_LogEventPgaeMoveRoute(){ - this.initialize.apply(this,arguments); -} - -Game_LogEventPgaeMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); -Game_LogEventPgaeMoveRoute.prototype.constructor = Game_LogEventPgaeMoveRoute; - -Game_LogEventPgaeMoveRoute.prototype.createMessage =function(){ - return "(Move Route)"+ Game_LogMapEvent.prototype.createMessage.call(this) ; -}; - -function Game_LogCommonEvent(){ - this.initialize.apply(this,arguments); -} - -Game_LogCommonEvent.prototype = Object.create(Game_LogBase.prototype); -Game_LogCommonEvent.prototype.constructor = Game_LogCommonEvent; - -Game_LogCommonEvent.prototype.initialize = function(eventId){ - this._eventId = eventId; - this._parent =null; -}; - -Game_LogCommonEvent.prototype.getEventName = function(){ - var event = $dataCommonEvents[this._eventId]; - if(event){ - if(event.name ===''){ - return 'unnamede'; - } - return event.name; - } - return ""; -}; -Game_LogCommonEvent.prototype.createMessage = function(){ - var name = this.getEventName(); - return ("CommonEvent: %1(%2)").format( - this._eventId, - name - ); -}; - -Game_LogCommonEvent.prototype.setParent = function(parent){ - this._parent = parent; -}; - -function Game_LogBattleEvent(){ - this.initialize.apply(this,arguments); -} - -Game_LogBattleEvent.prototype = Object.create(Game_LogBase.prototype); -Game_LogBattleEvent.prototype.constructor = Game_LogBattleEvent; -Game_LogBattleEvent.prototype.initialize = function(troopId,page){ - this._troopId = troopId; - this._page =page; -}; - -Game_LogBattleEvent.prototype.getEventName = function(){ - var troop = $dataTroops[this._troopId]; - if(troop){ - return troop.name; - } - return ""; -}; - -Game_LogBattleEvent.prototype.createMessage = function(){ - var name = this.getEventName(); - return ("TroopID: %1(%2), page: %3").format( - this._troopId, - name, - 1+this._page - ); -}; - -function Game_LogEventTest(){ - this.initialize.apply(this,arguments); -} - -Game_LogEventTest.prototype = Object.create(Game_LogBase.prototype); -Game_LogEventTest.prototype.constructor = Game_LogBattleEvent; -Game_LogEventTest.prototype.initialize = function(){ -}; - -Game_LogEventTest.prototype.createMessage = function(){ - return ('EventTest'); -}; - -(function(){ -Game_CharacterBase.prototype.setMoveRouteLog = function(callLog){ - this._moveRouteLog = callLog; -}; -Game_CharacterBase.prototype.getErrorLog = function(){ - return this._moveRouteLog; -}; - - -Game_Character.prototype.restoreMoveRoute = function() { - this._moveRoute = this._originalMoveRoute; - this._moveRouteIndex = this._originalMoveRouteIndex; - this._originalMoveRoute = null; - this._moveRouteLog = null; -}; - -Game_Character.prototype.evalRouteScript = function(script){ - var gc = Game_Character; - try { - eval(script); - } catch (error) { - if(this._moveRouteLog){ - error.rpgmv = this; - this._moveRouteLog.addLog('moveRouteError'); - this._moveRouteLog.addLog('target:'+this.debugName()); - this._moveRouteLog.addLog("script:"+script); - } - throw(error); - } -}; - -Game_Player.prototype.debugName = function(){ - return "player"; -}; - -Game_Follower.prototype.debugName = function(){ - return "follower[" + this._memberIndex+"]"; -}; - -Game_Vehicle.prototype.debugName = function(){ - return "vehicle("+this._type+")"; -}; - -Game_Event.prototype.debugName = function(){ - var event = this.event(); - if(event){ - return "MapEvent:"+ this._eventId +"("+ event.name+")"; - } - return ""; -}; - -Game_Event.prototype.createLogClass = function(){ - return new Game_LogMapEvent( - this._mapId, - this._eventId, - this._pageIndex - ); -}; - -Game_Event.prototype.setupPageSettings = function() { - var page = this.page(); - var image = page.image; - if (image.tileId > 0) { - this.setTileImage(image.tileId); - } else { - this.setImage(image.characterName, image.characterIndex); - } - if (this._originalDirection !== image.direction) { - this._originalDirection = image.direction; - this._prelockDirection = 0; - this.setDirectionFix(false); - this.setDirection(image.direction); - } - if (this._originalPattern !== image.pattern) { - this._originalPattern = image.pattern; - this.setPattern(image.pattern); - } - this.setMoveSpeed(page.moveSpeed); - this.setMoveFrequency(page.moveFrequency); - this.setPriorityType(page.priorityType); - this.setWalkAnime(page.walkAnime); - this.setStepAnime(page.stepAnime); - this.setDirectionFix(page.directionFix); - this.setThrough(page.through); - this.setMoveRoute(page.moveRoute); - this._moveType = page.moveType; - - if(this._moveType === 3){ - this.setMoveRouteLog( new Game_LogEventPgaeMoveRoute(this._mapId,this._eventId,this._pageIndex)); - } - - this._trigger = page.trigger; - if (this._trigger === 4) { - this._interpreter = new Game_Interpreter(); - } else { - this._interpreter = null; - } -}; - - -Game_Map.prototype.setupStartingMapEvent = function() { - var events = this.events(); - for (var i = 0; i < events.length; i++) { - var event = events[i]; - if (event.isStarting()) { - event.clearStartingFlag(); - this._interpreter.setup(event.list(), event.eventId()); - this._interpreter.setEventCallLog(event.createLogClass()); - return true; - } - } - return false; -}; - - -Game_Map.prototype.setupTestEvent = function() { - if ($testEvent) { - this._interpreter.setup($testEvent, 0); - this._interpreter.setEventCallLog(new Game_LogEventTest()); - $testEvent = null; - return true; - } - return false; -}; - - -Game_CommonEvent.prototype.setupEvent = function(){ - this._interpreter.setup(this.list()); - this._interpreter.setEventCallLog(new Game_LogCommonEvent(this._commonEventId)); -}; -Game_CommonEvent.prototype.update = function() { - if (this._interpreter) { - if (!this._interpreter.isRunning()) { - this.setupEvent(); - } - this._interpreter.update(); - } -}; - -Game_Troop.prototype.setupBattleEvent = function() { - if (!this._interpreter.isRunning()) { - if (this._interpreter.setupReservedCommonEvent()) { - return; - } - var pages = this.troop().pages; - for (var i = 0; i < pages.length; i++) { - var page = pages[i]; - if (this.meetsConditions(page) && !this._eventFlags[i]) { - this._interpreter.setup(page.list); - this._interpreter.setEventCallLog(new Game_LogBattleEvent(this._troopId,i)); - if (page.span <= 1) { - this._eventFlags[i] = true; - } - break; - } - } - } -}; - -Game_Interpreter.prototype.setEventCallLog = function(callLog){ - this._callLog = callLog; -}; - - -Game_Interpreter.prototype.setupChild = function(list, eventId) { - this._childInterpreter = new Game_Interpreter(this._depth + 1); - this._childInterpreter.setup(list, eventId); - this._childInterpreter.setEventCallLog(log); -// log.setParent(this._callLog); -}; - - -Game_Interpreter.prototype.getErrorLog = function(){ - return this._callLog; -}; -Game_Interpreter.prototype.evalScript = function(script){ - try { - return eval(script); - } catch (error) { - if(this._callLog){ - error.rpgmv = this; - this._callLog.addLog("evalError"); - this._callLog.addLog(script); - } - throw(error); - } -}; -// Set Movement Route -Game_Interpreter.prototype.command205 = function() { - $gameMap.refreshIfNeeded(); - this._character = this.character(this._params[0]); - if (this._character) { - this._character.forceMoveRoute(this._params[1]); - if (this._params[1].wait) { - this.setWaitMode('route'); - } - this._character.setMoveRouteLog(this._callLog); - } - return true; -}; - -// Plugin Command -Game_Interpreter.prototype.command356 = function() { - var args = this._params[0].split(" "); - var command = args.shift(); - try { - this.pluginCommand(command, args); - } catch (error) { - if(this._callLog){ - error.rpgmv = this; - this._callLog.addLog("command:"+command); - this._callLog.addLog("args:"+args); - } - throw(error); - } - return true; -}; - - -Graphics.createErrorHTML = function(error){ - return this._makeEventInfo(error)+ this._makeErrorStackLog(error); -}; - -Graphics._makeEventInfo = function(e){ - if(e.rpgmv){ - if(e.rpgmv.getErrorLog){ - var log = e.rpgmv.getErrorLog(); - if(log){ - return log.createErrorHTML(); - } - } - } - return ""; -}; - - -SceneManager.showErrorLog = function(e){ - console.error(e.stack); - if(e.rpgmv){ - if(e.rpgmv.getErrorLog){ - var log = e.rpgmv.getErrorLog(); - if(log){ - console.error(log.createConsolMessage() ); - } - } - } -}; - -})(); From eeb68ad7423632fc0fa99b6976018b3d88d24965 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:02:39 +0900 Subject: [PATCH 08/56] add Log Method --- js/rpg_objects/Game_CharacterBase.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/rpg_objects/Game_CharacterBase.js b/js/rpg_objects/Game_CharacterBase.js index a3cda3b9..5c98026e 100644 --- a/js/rpg_objects/Game_CharacterBase.js +++ b/js/rpg_objects/Game_CharacterBase.js @@ -588,3 +588,11 @@ Game_CharacterBase.prototype.endAnimation = function() { Game_CharacterBase.prototype.endBalloon = function() { this._balloonPlaying = false; }; + +Game_CharacterBase.prototype.setMoveRouteLog = function(callLog){ + this._moveRouteLog = callLog; +}; +Game_CharacterBase.prototype.getErrorLog = function(){ + return this._moveRouteLog; +}; + From dd1a32eab8029cf98af8940cdc8b6dbcb5fdfaee Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:04:22 +0900 Subject: [PATCH 09/56] Add Log Method --- js/rpg_objects/Game_Character.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Character.js b/js/rpg_objects/Game_Character.js index 223a8137..04524522 100644 --- a/js/rpg_objects/Game_Character.js +++ b/js/rpg_objects/Game_Character.js @@ -80,6 +80,7 @@ Game_Character.prototype.restoreMoveRoute = function() { this._moveRoute = this._originalMoveRoute; this._moveRouteIndex = this._originalMoveRouteIndex; this._originalMoveRoute = null; + this._moveRouteLog = null; }; Game_Character.prototype.isMoveRouteForcing = function() { @@ -269,7 +270,17 @@ Game_Character.prototype.processMoveCommand = function(command) { Game_Character.prototype.evalRouteScript = function(script){ var gc = Game_Character; - eval(script); + try { + eval(script); + } catch (error) { + if(this._moveRouteLog){ + error.rpgmv = this; + this._moveRouteLog.addLog('moveRouteError'); + this._moveRouteLog.addLog('target:'+this.debugName()); + this._moveRouteLog.addLog("script:"+script); + } + throw(error); + } }; Game_Character.prototype.deltaXFrom = function(x) { From f658e4f4dee713ce4ffc79e5602751faa97d597c Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:06:13 +0900 Subject: [PATCH 10/56] add debugName() --- js/rpg_objects/Game_Player.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/rpg_objects/Game_Player.js b/js/rpg_objects/Game_Player.js index 1af6d352..748d89bd 100644 --- a/js/rpg_objects/Game_Player.js +++ b/js/rpg_objects/Game_Player.js @@ -619,3 +619,7 @@ Game_Player.prototype.areFollowersGathering = function() { Game_Player.prototype.areFollowersGathered = function() { return this._followers.areGathered(); }; + +Game_Player.prototype.debugName = function(){ + return "player"; +}; From 5cc3e632ec91cb100939de582446d5696c7d27e6 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:07:07 +0900 Subject: [PATCH 11/56] add DebugName() --- js/rpg_objects/Game_CharacterBase.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/rpg_objects/Game_CharacterBase.js b/js/rpg_objects/Game_CharacterBase.js index 5c98026e..b1dd591e 100644 --- a/js/rpg_objects/Game_CharacterBase.js +++ b/js/rpg_objects/Game_CharacterBase.js @@ -595,4 +595,7 @@ Game_CharacterBase.prototype.setMoveRouteLog = function(callLog){ Game_CharacterBase.prototype.getErrorLog = function(){ return this._moveRouteLog; }; +Game_CharacterBase.prototype.debugName = function(){ + return "CharacterBase"; +}; From 2f765f7d271016e2a7da13b898e5f8f310918d92 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:07:56 +0900 Subject: [PATCH 12/56] add debugName() --- js/rpg_objects/Game_Follower.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/rpg_objects/Game_Follower.js b/js/rpg_objects/Game_Follower.js index d27a87f2..53108218 100644 --- a/js/rpg_objects/Game_Follower.js +++ b/js/rpg_objects/Game_Follower.js @@ -55,3 +55,8 @@ Game_Follower.prototype.chaseCharacter = function(character) { } this.setMoveSpeed($gamePlayer.realMoveSpeed()); }; + +Game_Follower.prototype.debugName = function(){ + return "follower[" + this._memberIndex+"]"; +}; + From 6d8227f637828e513de761c7423e06e46102e2db Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:08:44 +0900 Subject: [PATCH 13/56] add debugName() --- js/rpg_objects/Game_Vehicle.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/rpg_objects/Game_Vehicle.js b/js/rpg_objects/Game_Vehicle.js index 012961d7..04f72e2f 100644 --- a/js/rpg_objects/Game_Vehicle.js +++ b/js/rpg_objects/Game_Vehicle.js @@ -231,3 +231,7 @@ Game_Vehicle.prototype.isLandOk = function(x, y, d) { } return true; }; + +Game_Vehicle.prototype.debugName = function(){ + return "vehicle("+this._type+")"; +}; From eb52c36e43d7d17bd4f755210f35aed80846344b Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:11:54 +0900 Subject: [PATCH 14/56] Add LogMethod(any) --- js/rpg_objects/Game_Event.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Event.js b/js/rpg_objects/Game_Event.js index e1924ba7..299b6c5f 100644 --- a/js/rpg_objects/Game_Event.js +++ b/js/rpg_objects/Game_Event.js @@ -48,6 +48,22 @@ Game_Event.prototype.list = function() { return this.page().list; }; +Game_Event.prototype.debugName = function(){ + var event = this.event(); + if(event){ + return "MapEvent:"+ this._eventId +"("+ event.name+")"; + } + return ""; +}; + +Game_Event.prototype.createLogClass = function(){ + return new Game_LogMapEvent( + this._mapId, + this._eventId, + this._pageIndex + ); +}; + Game_Event.prototype.isCollidedWithCharacters = function(x, y) { return (Game_Character.prototype.isCollidedWithCharacters.call(this, x, y) || this.isCollidedWithPlayerCharacters(x, y)); @@ -280,6 +296,11 @@ Game_Event.prototype.setupPageSettings = function() { this.setThrough(page.through); this.setMoveRoute(page.moveRoute); this._moveType = page.moveType; + + if(this._moveType === 3){ + this.setMoveRouteLog( new Game_LogEventPgaeMoveRoute(this._mapId,this._eventId,this._pageIndex)); + } + this._trigger = page.trigger; if (this._trigger === 4) { this._interpreter = new Game_Interpreter(); @@ -287,7 +308,6 @@ Game_Event.prototype.setupPageSettings = function() { this._interpreter = null; } }; - Game_Event.prototype.isOriginalPattern = function() { return this.pattern() === this._originalPattern; }; From 8a6dc708a94762306fd58892dcb2a637a3b3f02b Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:15:34 +0900 Subject: [PATCH 15/56] add Log method --- js/rpg_objects/Game_Map.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/rpg_objects/Game_Map.js b/js/rpg_objects/Game_Map.js index 10352822..e3918c4d 100644 --- a/js/rpg_objects/Game_Map.js +++ b/js/rpg_objects/Game_Map.js @@ -756,6 +756,7 @@ Game_Map.prototype.setupStartingEvent = function() { Game_Map.prototype.setupTestEvent = function() { if ($testEvent) { this._interpreter.setup($testEvent, 0); + this._interpreter.setEventCallLog(new Game_LogEventTest()); $testEvent = null; return true; } @@ -769,6 +770,7 @@ Game_Map.prototype.setupStartingMapEvent = function() { if (event.isStarting()) { event.clearStartingFlag(); this._interpreter.setup(event.list(), event.eventId()); + this._interpreter.setEventCallLog(event.createLogClass()); return true; } } From fac955d63ea45be955e10a2074d109045ff4432e Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:16:08 +0900 Subject: [PATCH 16/56] add Log System --- js/rpg_objects/Game_CommonEvent.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_CommonEvent.js b/js/rpg_objects/Game_CommonEvent.js index 8f82963c..044de620 100644 --- a/js/rpg_objects/Game_CommonEvent.js +++ b/js/rpg_objects/Game_CommonEvent.js @@ -36,8 +36,9 @@ Game_CommonEvent.prototype.isActive = function() { return event.trigger === 2 && $gameSwitches.value(event.switchId); }; -Game_CommonEvent.prototype.setupEvent =function(){ +Game_CommonEvent.prototype.setupEvent = function(){ this._interpreter.setup(this.list()); + this._interpreter.setEventCallLog(new Game_LogCommonEvent(this._commonEventId)); }; Game_CommonEvent.prototype.update = function() { if (this._interpreter) { From 140ff65e3a1cefc3b7eca85acd48fab10b6146d5 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:17:01 +0900 Subject: [PATCH 17/56] Add Log System --- js/rpg_objects/Game_Troop.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/rpg_objects/Game_Troop.js b/js/rpg_objects/Game_Troop.js index fb520c5c..7f9718ad 100644 --- a/js/rpg_objects/Game_Troop.js +++ b/js/rpg_objects/Game_Troop.js @@ -159,6 +159,7 @@ Game_Troop.prototype.setupBattleEvent = function() { var page = pages[i]; if (this.meetsConditions(page) && !this._eventFlags[i]) { this._interpreter.setup(page.list); + this._interpreter.setEventCallLog(new Game_LogBattleEvent(this._troopId,i)); if (page.span <= 1) { this._eventFlags[i] = true; } From 3abeacb83204f58a30454d388af66f41af82e305 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:29:42 +0900 Subject: [PATCH 18/56] add LogSystem --- js/rpg_objects/Game_Interpreter.js | 34 ++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 7ac09e67..69d2951c 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -293,6 +293,14 @@ Game_Interpreter.prototype.changeHp = function(target, value, allowDeath) { } }; +Game_Interpreter.prototype.setEventCallLog = function(callLog){ + this._callLog = callLog; +}; + +Game_Interpreter.prototype.getErrorLog = function(){ + return this._callLog; +}; + // Show Text Game_Interpreter.prototype.command101 = function() { if (!$gameMessage.isBusy()) { @@ -616,6 +624,9 @@ Game_Interpreter.prototype.command117 = function() { Game_Interpreter.prototype.setupChild = function(list, eventId) { this._childInterpreter = new Game_Interpreter(this._depth + 1); this._childInterpreter.setup(list, eventId); + var log = new Game_LogCommonEvent(eventId); + log.setParent(this._callLog); + this._childInterpreter.setEventCallLog(log); }; // Label @@ -690,7 +701,16 @@ Game_Interpreter.prototype.command122 = function() { }; Game_Interpreter.prototype.evalScript = function(script){ - return eval(script); + try { + return eval(script); + } catch (error) { + if(this._callLog){ + error.rpgmv = this; + this._callLog.addLog("evalError"); + this._callLog.addLog(script); + } + throw(error); + } }; @@ -1032,6 +1052,7 @@ Game_Interpreter.prototype.command205 = function() { if (this._params[1].wait) { this.setWaitMode('route'); } + this._character.setMoveRouteLog(this._callLog); } return true; }; @@ -1749,7 +1770,16 @@ Game_Interpreter.prototype.command355 = function() { Game_Interpreter.prototype.command356 = function() { var args = this._params[0].split(" "); var command = args.shift(); - this.pluginCommand(command, args); + try { + this.pluginCommand(command, args); + } catch (error) { + if(this._callLog){ + error.rpgmv = this; + this._callLog.addLog("command:"+command); + this._callLog.addLog("args:"+args); + } + throw(error); + } return true; }; From 75d7e4bc577b4afd659e832ab9892c9354e107de Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:31:24 +0900 Subject: [PATCH 19/56] Add LogSystemView --- js/rpg_core/Graphics.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/js/rpg_core/Graphics.js b/js/rpg_core/Graphics.js index 94496c16..01088947 100644 --- a/js/rpg_core/Graphics.js +++ b/js/rpg_core/Graphics.js @@ -422,8 +422,20 @@ Graphics._makeErrorStackLog =function(e){ } return ''; }; -Graphics.createErrorHTML =function(error){ - return this._makeErrorStackLog(error); +Graphics._makeEventInfo = function(e){ + if(e.rpgmv){ + if(e.rpgmv.getErrorLog){ + var log = e.rpgmv.getErrorLog(); + if(log){ + return log.createErrorHTML(); + } + } + } + return ""; +}; + +Graphics.createErrorHTML = function(error){ + return this._makeEventInfo(error)+ this._makeErrorStackLog(error); }; Graphics.printErrorDetail =function(e){ From 5b9514e4b0e4b233ce544aa3712e2130cad4c244 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:32:19 +0900 Subject: [PATCH 20/56] add eventLog view --- js/rpg_managers/SceneManager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/rpg_managers/SceneManager.js b/js/rpg_managers/SceneManager.js index d0a1a19f..9b3a5215 100644 --- a/js/rpg_managers/SceneManager.js +++ b/js/rpg_managers/SceneManager.js @@ -197,8 +197,16 @@ SceneManager.onKeyDown = function(event) { } }; -SceneManager.showErrorLog =function(e){ +SceneManager.showErrorLog = function(e){ console.error(e.stack); + if(e.rpgmv){ + if(e.rpgmv.getErrorLog){ + var log = e.rpgmv.getErrorLog(); + if(log){ + console.error(log.createConsolMessage() ); + } + } + } }; SceneManager.catchException = function(e) { From 3f0eaeedc1b0b5498928a69975b0299861b0a1d5 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:32:59 +0900 Subject: [PATCH 21/56] Add LogSystem Core --- js/rpg_objects/Game_Log.js | 159 +++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 js/rpg_objects/Game_Log.js diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js new file mode 100644 index 00000000..b215fb1e --- /dev/null +++ b/js/rpg_objects/Game_Log.js @@ -0,0 +1,159 @@ + + +function Game_LogBase(){ + this.initialize.apply(this,arguments); +} + +Game_LogBase.prototype.createMessage = function(){ + return 'unknow error'; +}; +Game_LogBase.prototype.initialize = function(){ + this._additionalLog =[]; +}; + +Game_LogBase.prototype.createErrorHTML =function(){ + var addError = this.createAdditionalError('
'); + return this.createMessage() +addError+ '

'; +}; +Game_LogBase.prototype.createConsolMessage =function(){ + return this.createMessage() + this.createAdditionalError("\n"); +}; +Game_LogBase.prototype.addLog =function(text){ + if(!this._additionalLog){ + this._additionalLog =[]; + } + this._additionalLog.push(text); +}; +Game_LogBase.prototype.createAdditionalError =function(brStr){ + if(!this._additionalLog){return "";} + var result =brStr; + for(var i=0; i < this._additionalLog.length; ++i){ + result += this._additionalLog[i] + brStr; + } + return result; +}; + +function Game_LogMapEvent(){ + this.initialize.apply(this,arguments); +} + +Game_LogMapEvent.prototype = Object.create(Game_LogBase.prototype); +Game_LogMapEvent.prototype.constructor = Game_LogMapEvent; + +Game_LogMapEvent.prototype.initialize = function(mapId,eventId,page){ + this._mapId = mapId; + this._eventId = eventId; + this._page = page; +}; + +Game_LogMapEvent.prototype.event = function(){ + if($gameMap.mapId() === this._mapId){ + var event = $gameMap.event(this._eventId); + if(event){ + return event; + } + } + return null; +}; + +Game_LogMapEvent.prototype.getEventName = function(){ + var event = this.event(); + if(event){ + return event.debugName(); + } + return ""; +} +Game_LogMapEvent.prototype.createMessage = function(){ + var event = this.event(); + if(event){ + return ( "MapID: %1,%2, page: %3").format(this._mapId,event.debugName(),this._page); + } + return ""; +}; + +function Game_LogEventPgaeMoveRoute(){ + this.initialize.apply(this,arguments); +} + +Game_LogEventPgaeMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); +Game_LogEventPgaeMoveRoute.prototype.constructor = Game_LogEventPgaeMoveRoute; + +Game_LogEventPgaeMoveRoute.prototype.createMessage =function(){ + return "(Move Route)"+ Game_LogMapEvent.prototype.createMessage.call(this) ; +}; + +function Game_LogCommonEvent(){ + this.initialize.apply(this,arguments); +} + +Game_LogCommonEvent.prototype = Object.create(Game_LogBase.prototype); +Game_LogCommonEvent.prototype.constructor = Game_LogCommonEvent; + +Game_LogCommonEvent.prototype.initialize = function(eventId){ + this._eventId = eventId; + this._parent =null; +}; + +Game_LogCommonEvent.prototype.getEventName = function(){ + var event = $dataCommonEvents[this._eventId]; + if(event){ + if(event.name ===''){ + return 'unnamede'; + } + return event.name; + } + return ""; +}; +Game_LogCommonEvent.prototype.createMessage = function(){ + var name = this.getEventName(); + return ("CommonEvent: %1(%2)").format( + this._eventId, + name + ); +}; + +Game_LogCommonEvent.prototype.setParent = function(parent){ + this._parent = parent; +}; + +function Game_LogBattleEvent(){ + this.initialize.apply(this,arguments); +} + +Game_LogBattleEvent.prototype = Object.create(Game_LogBase.prototype); +Game_LogBattleEvent.prototype.constructor = Game_LogBattleEvent; +Game_LogBattleEvent.prototype.initialize = function(troopId,page){ + this._troopId = troopId; + this._page =page; +}; + +Game_LogBattleEvent.prototype.getEventName = function(){ + var troop = $dataTroops[this._troopId]; + if(troop){ + return troop.name; + } + return ""; +}; + +Game_LogBattleEvent.prototype.createMessage = function(){ + var name = this.getEventName(); + return ("TroopID: %1(%2), page: %3").format( + this._troopId, + name, + 1+this._page + ); +}; + +function Game_LogEventTest(){ + this.initialize.apply(this,arguments); +} + +Game_LogEventTest.prototype = Object.create(Game_LogBase.prototype); +Game_LogEventTest.prototype.constructor = Game_LogBattleEvent; +Game_LogEventTest.prototype.initialize = function(){ +}; + +Game_LogEventTest.prototype.createMessage = function(){ + return ('EventTest'); +}; + From 8fc2eb9f095eb39a747f04f38db3c44648ac972b Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 4 Dec 2018 19:33:40 +0900 Subject: [PATCH 22/56] add Game_Log.js --- rpg_objects.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rpg_objects.json b/rpg_objects.json index 4abf6d91..f55448fb 100644 --- a/rpg_objects.json +++ b/rpg_objects.json @@ -29,5 +29,6 @@ "js/rpg_objects/Game_Followers.js", "js/rpg_objects/Game_Vehicle.js", "js/rpg_objects/Game_Event.js", - "js/rpg_objects/Game_Interpreter.js" -] \ No newline at end of file + "js/rpg_objects/Game_Interpreter.js", + "js/rpg_objects/Game_Log.js" +] From 6d787be182537d6a8ffc0bfd4a1559fd78939ae3 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 5 Dec 2018 11:30:33 +0900 Subject: [PATCH 23/56] swap ( "Game_Log.js","Game_Interpreter.js") --- rpg_objects.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpg_objects.json b/rpg_objects.json index f55448fb..c1aaf48b 100644 --- a/rpg_objects.json +++ b/rpg_objects.json @@ -29,6 +29,6 @@ "js/rpg_objects/Game_Followers.js", "js/rpg_objects/Game_Vehicle.js", "js/rpg_objects/Game_Event.js", - "js/rpg_objects/Game_Interpreter.js", - "js/rpg_objects/Game_Log.js" + "js/rpg_objects/Game_Log.js", + "js/rpg_objects/Game_Interpreter.js" ] From 088215cbdce8063041b9bbb013973f51e74802b2 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 5 Dec 2018 11:35:19 +0900 Subject: [PATCH 24/56] spell miss fix --- js/rpg_objects/Game_Log.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index b215fb1e..37b434ef 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -5,7 +5,7 @@ function Game_LogBase(){ } Game_LogBase.prototype.createMessage = function(){ - return 'unknow error'; + return 'unknown error'; }; Game_LogBase.prototype.initialize = function(){ this._additionalLog =[]; @@ -71,14 +71,14 @@ Game_LogMapEvent.prototype.createMessage = function(){ return ""; }; -function Game_LogEventPgaeMoveRoute(){ +function Game_LogEventPageMoveRoute(){ this.initialize.apply(this,arguments); } -Game_LogEventPgaeMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); -Game_LogEventPgaeMoveRoute.prototype.constructor = Game_LogEventPgaeMoveRoute; +Game_LogEventPageMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); +Game_LogEventPageMoveRoute.prototype.constructor = Game_LogEventPageMoveRoute; -Game_LogEventPgaeMoveRoute.prototype.createMessage =function(){ +Game_LogEventPageMoveRoute.prototype.createMessage =function(){ return "(Move Route)"+ Game_LogMapEvent.prototype.createMessage.call(this) ; }; @@ -98,7 +98,7 @@ Game_LogCommonEvent.prototype.getEventName = function(){ var event = $dataCommonEvents[this._eventId]; if(event){ if(event.name ===''){ - return 'unnamede'; + return 'unnamed'; } return event.name; } From f3faf8de827ac01fdbd23ee05d6e099c46f765da Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 5 Dec 2018 11:36:23 +0900 Subject: [PATCH 25/56] spell miss fix --- js/rpg_objects/Game_Event.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Event.js b/js/rpg_objects/Game_Event.js index 299b6c5f..90df4d26 100644 --- a/js/rpg_objects/Game_Event.js +++ b/js/rpg_objects/Game_Event.js @@ -298,7 +298,7 @@ Game_Event.prototype.setupPageSettings = function() { this._moveType = page.moveType; if(this._moveType === 3){ - this.setMoveRouteLog( new Game_LogEventPgaeMoveRoute(this._mapId,this._eventId,this._pageIndex)); + this.setMoveRouteLog( new Game_LogEventPageMoveRoute(this._mapId,this._eventId,this._pageIndex)); } this._trigger = page.trigger; From 7d9b8ad9f3272d61e388c6d5d51e5d3481c55dff Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 5 Dec 2018 16:38:30 +0900 Subject: [PATCH 26/56] BattleEvent fix & eventPageFix --- js/rpg_objects/Game_Log.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index 37b434ef..cf67388f 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -66,7 +66,7 @@ Game_LogMapEvent.prototype.getEventName = function(){ Game_LogMapEvent.prototype.createMessage = function(){ var event = this.event(); if(event){ - return ( "MapID: %1,%2, page: %3").format(this._mapId,event.debugName(),this._page); + return ( "MapID: %1,%2, page: %3").format(this._mapId,event.debugName(),this._page+1); } return ""; }; @@ -107,7 +107,7 @@ Game_LogCommonEvent.prototype.getEventName = function(){ Game_LogCommonEvent.prototype.createMessage = function(){ var name = this.getEventName(); return ("CommonEvent: %1(%2)").format( - this._eventId, + this._eventId +1, name ); }; @@ -137,7 +137,7 @@ Game_LogBattleEvent.prototype.getEventName = function(){ Game_LogBattleEvent.prototype.createMessage = function(){ var name = this.getEventName(); - return ("TroopID: %1(%2), page: %3").format( + return ("BattleEvent TroopID: %1(%2), page: %3").format( this._troopId, name, 1+this._page From a0a53f799ac8e1b047e7a1cdf8ba318503dcd719 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 5 Dec 2018 22:48:28 +0900 Subject: [PATCH 27/56] clear Fix and message fix --- js/rpg_objects/Game_Interpreter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 69d2951c..9d8b7af9 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -34,6 +34,7 @@ Game_Interpreter.prototype.clear = function() { this._comments = ''; this._character = null; this._childInterpreter = null; + this._callLog = null; }; Game_Interpreter.prototype.setup = function(list, eventId) { @@ -706,7 +707,7 @@ Game_Interpreter.prototype.evalScript = function(script){ } catch (error) { if(this._callLog){ error.rpgmv = this; - this._callLog.addLog("evalError"); + this._callLog.addLog("ScriptError"); this._callLog.addLog(script); } throw(error); From 103452e799927f4136c16a4c868c0ee8089951c9 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Thu, 6 Dec 2018 06:27:34 +0900 Subject: [PATCH 28/56] add show line --- js/rpg_objects/Game_Interpreter.js | 36 ++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 9d8b7af9..5d347f09 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -706,9 +706,12 @@ Game_Interpreter.prototype.evalScript = function(script){ return eval(script); } catch (error) { if(this._callLog){ - error.rpgmv = this; + var command = this.currentCommand(); + var code = command ? command.code :0; + this._callLog.addLog( Game_Interpreter.codeName(code)+" line:"+this._index ); this._callLog.addLog("ScriptError"); this._callLog.addLog(script); + error.rpgmv = this; } throw(error); } @@ -1759,11 +1762,15 @@ Game_Interpreter.prototype.command354 = function() { // Script Game_Interpreter.prototype.command355 = function() { var script = this.currentCommand().parameters[0] + '\n'; - while (this.nextEventCode() === 655) { - this._index++; - script += this.currentCommand().parameters[0] + '\n'; + var index =this._index+1; + + var eventCode = this._list[index]; + while(eventCode && eventCode.code ===655){ + script += eventCode.parameters[0]+'\n'; + ++index; } this.evalScript(script); + this._index =index; return true; }; @@ -1776,6 +1783,7 @@ Game_Interpreter.prototype.command356 = function() { } catch (error) { if(this._callLog){ error.rpgmv = this; + this._callLog.addLog("Plugin Command line:"+this._index); this._callLog.addLog("command:"+command); this._callLog.addLog("args:"+args); } @@ -1788,6 +1796,26 @@ Game_Interpreter.prototype.pluginCommand = function(command, args) { // to be overridden by plugins }; +Game_Interpreter.prototype.lineCodeMessage =function(index){ + return ""; +}; + + +Game_Interpreter.codeName =function(code){ + switch (param.code) { + case 111: + return "Conditional Branch"; + case 122: + return "Control Variables"; + case 355: + return "Plugin Command"; + } + + return ""; + + +}; + Game_Interpreter.requestImagesByPluginCommand = function(command,args){ }; From de7f1f1e142bc0f666222f94247e92f8f7cf1666 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Sun, 9 Dec 2018 04:27:29 +0900 Subject: [PATCH 29/56] remove unused function --- js/rpg_objects/Game_Interpreter.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 5d347f09..e88b59a6 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -700,6 +700,17 @@ Game_Interpreter.prototype.command122 = function() { } return true; }; +Game_Interpreter.codeName = function(code){ + switch (param.code) { + case 111: + return "Conditional Branch"; + case 122: + return "Control Variables"; + case 355: + return "Plugin Command"; + } + return ""; +}; Game_Interpreter.prototype.evalScript = function(script){ try { @@ -1796,25 +1807,7 @@ Game_Interpreter.prototype.pluginCommand = function(command, args) { // to be overridden by plugins }; -Game_Interpreter.prototype.lineCodeMessage =function(index){ - return ""; -}; - -Game_Interpreter.codeName =function(code){ - switch (param.code) { - case 111: - return "Conditional Branch"; - case 122: - return "Control Variables"; - case 355: - return "Plugin Command"; - } - - return ""; - - -}; Game_Interpreter.requestImagesByPluginCommand = function(command,args){ }; From acc3d218fdbbe990cacbc528813e5aaf821c2324 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Sun, 9 Dec 2018 04:59:29 +0900 Subject: [PATCH 30/56] =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=83=86=E3=83=A0?= =?UTF-8?q?=E3=81=8B=E3=82=89=E3=81=AE=E3=82=B3=E3=83=A2=E3=83=B3=E3=82=A4?= =?UTF-8?q?=E3=83=99=E3=83=B3=E3=83=88=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=97?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/rpg_objects/Game_Interpreter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index e88b59a6..84604c3e 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -56,6 +56,7 @@ Game_Interpreter.prototype.isOnCurrentMap = function() { Game_Interpreter.prototype.setupReservedCommonEvent = function() { if ($gameTemp.isCommonEventReserved()) { this.setup($gameTemp.reservedCommonEvent().list); + this.setEventCallLog(new Game_LogCommonEvent($gameTemp._commonEventId) ); $gameTemp.clearCommonEvent(); return true; } else { From 5cb877acc8a54f945f14d85a4bf6e0f5d499063c Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 11 Dec 2018 16:07:49 +0900 Subject: [PATCH 31/56] =?UTF-8?q?=E7=84=A1=E9=99=90=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=97=E3=81=A7=E6=AD=BB=E3=82=93=E3=81=A7=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20=E3=81=9D=E3=81=AE?= =?UTF-8?q?=E4=BB=96=E3=81=84=E3=82=8D=E3=81=84=E3=82=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/rpg_objects/Game_Interpreter.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 84604c3e..efd3fcc8 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -702,12 +702,14 @@ Game_Interpreter.prototype.command122 = function() { return true; }; Game_Interpreter.codeName = function(code){ - switch (param.code) { + switch (code) { case 111: return "Conditional Branch"; case 122: return "Control Variables"; case 355: + return "Script"; + case 356: return "Plugin Command"; } return ""; @@ -720,9 +722,9 @@ Game_Interpreter.prototype.evalScript = function(script){ if(this._callLog){ var command = this.currentCommand(); var code = command ? command.code :0; - this._callLog.addLog( Game_Interpreter.codeName(code)+" line:"+this._index ); + this._callLog.addLog( " line:"+this._index+" "+Game_Interpreter.codeName(code) ); this._callLog.addLog("ScriptError"); - this._callLog.addLog(script); + this._callLog.addLog(script.replace("\n","
")); error.rpgmv = this; } throw(error); @@ -1778,11 +1780,13 @@ Game_Interpreter.prototype.command355 = function() { var eventCode = this._list[index]; while(eventCode && eventCode.code ===655){ - script += eventCode.parameters[0]+'\n'; + + script += eventCode.parameters[0]+"\n"; ++index; + eventCode = this._list[index]; } this.evalScript(script); - this._index =index; + this._index = index; return true; }; @@ -1795,7 +1799,7 @@ Game_Interpreter.prototype.command356 = function() { } catch (error) { if(this._callLog){ error.rpgmv = this; - this._callLog.addLog("Plugin Command line:"+this._index); + this._callLog.addLog("line:"+this._index+" Plugin Command"); this._callLog.addLog("command:"+command); this._callLog.addLog("args:"+args); } From e17d234fa29b66a0c007b421c8583e5f4c0ec368 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 11 Dec 2018 16:57:15 +0900 Subject: [PATCH 32/56] CommonEventLog Fix --- js/rpg_objects/Game_Log.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index cf67388f..f3c6bc50 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -107,7 +107,7 @@ Game_LogCommonEvent.prototype.getEventName = function(){ Game_LogCommonEvent.prototype.createMessage = function(){ var name = this.getEventName(); return ("CommonEvent: %1(%2)").format( - this._eventId +1, + this._eventId , name ); }; From 8d4739dc74528ccb0c73a518acd341872c7482b2 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 11 Dec 2018 16:58:40 +0900 Subject: [PATCH 33/56] LogCommonEvent fix Fixed calling map event number where common event number should be displayed --- js/rpg_objects/Game_Interpreter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index efd3fcc8..c05d769c 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -615,10 +615,13 @@ Game_Interpreter.prototype.command115 = function() { // Common Event Game_Interpreter.prototype.command117 = function() { - var commonEvent = $dataCommonEvents[this._params[0]]; + var commonEventId =this._params[0]; + var commonEvent = $dataCommonEvents[commonEventId]; if (commonEvent) { var eventId = this.isOnCurrentMap() ? this._eventId : 0; this.setupChild(commonEvent.list, eventId); + var log = new Game_LogCommonEvent(commonEventId); + this._childInterpreter.setEventCallLog(log); } return true; }; @@ -626,9 +629,6 @@ Game_Interpreter.prototype.command117 = function() { Game_Interpreter.prototype.setupChild = function(list, eventId) { this._childInterpreter = new Game_Interpreter(this._depth + 1); this._childInterpreter.setup(list, eventId); - var log = new Game_LogCommonEvent(eventId); - log.setParent(this._callLog); - this._childInterpreter.setEventCallLog(log); }; // Label From ae64fe6c1ebd50bb118d0e1b42388106f0f06353 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 11 Dec 2018 17:29:49 +0900 Subject: [PATCH 34/56] remove setParent() Removed the function to display call history of common event. Because the display format can not be determined, postponed to the next update. It may be necessary? Because I saw a story that it would get in the way if I implemented it with. --- js/rpg_objects/Game_Log.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index f3c6bc50..23e1df09 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -91,7 +91,6 @@ Game_LogCommonEvent.prototype.constructor = Game_LogCommonEvent; Game_LogCommonEvent.prototype.initialize = function(eventId){ this._eventId = eventId; - this._parent =null; }; Game_LogCommonEvent.prototype.getEventName = function(){ @@ -112,9 +111,6 @@ Game_LogCommonEvent.prototype.createMessage = function(){ ); }; -Game_LogCommonEvent.prototype.setParent = function(parent){ - this._parent = parent; -}; function Game_LogBattleEvent(){ this.initialize.apply(this,arguments); From db61025e417af838342a64b7549bac88125f434c Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 11 Dec 2018 17:32:07 +0900 Subject: [PATCH 35/56] fix errorLog Scirpt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No line break when displaying with evalScript () · Change to all display. It is easy to change the specification later, and I can not grasp the current optimum solution. Also, I think that the display is faster if you do not edit it. (Because it is error handling, I think it is almost irrelevant) --- js/rpg_objects/Game_Interpreter.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index c05d769c..5f390a3d 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -620,8 +620,8 @@ Game_Interpreter.prototype.command117 = function() { if (commonEvent) { var eventId = this.isOnCurrentMap() ? this._eventId : 0; this.setupChild(commonEvent.list, eventId); - var log = new Game_LogCommonEvent(commonEventId); - this._childInterpreter.setEventCallLog(log); + this._childInterpreter.setEventCallLog(new Game_LogCommonEvent(commonEventId)); + } return true; }; @@ -717,14 +717,14 @@ Game_Interpreter.codeName = function(code){ Game_Interpreter.prototype.evalScript = function(script){ try { - return eval(script); + return eval(script); } catch (error) { if(this._callLog){ var command = this.currentCommand(); var code = command ? command.code :0; - this._callLog.addLog( " line:"+this._index+" "+Game_Interpreter.codeName(code) ); + this._callLog.addLog( " line:"+this._index+" "+Game_Interpreter.codeName(code) ); this._callLog.addLog("ScriptError"); - this._callLog.addLog(script.replace("\n","
")); + this._callLog.addLog(script); error.rpgmv = this; } throw(error); From 82d707c76743f495308ca95421e6e5f5944ef8a7 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Tue, 11 Dec 2018 17:47:19 +0900 Subject: [PATCH 36/56] style fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 関数の並びなどを本家コアスクリプトのスタイルに統一。 (=function()が本家とずれていた) --- js/rpg_objects/Game_Log.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index 23e1df09..a3a43b97 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -1,30 +1,32 @@ - - function Game_LogBase(){ this.initialize.apply(this,arguments); } -Game_LogBase.prototype.createMessage = function(){ - return 'unknown error'; -}; Game_LogBase.prototype.initialize = function(){ this._additionalLog =[]; }; -Game_LogBase.prototype.createErrorHTML =function(){ +Game_LogBase.prototype.createMessage = function(){ + return 'unknown error'; +}; + +Game_LogBase.prototype.createErrorHTML = function(){ var addError = this.createAdditionalError('
'); return this.createMessage() +addError+ '

'; }; -Game_LogBase.prototype.createConsolMessage =function(){ + +Game_LogBase.prototype.createConsolMessage = function(){ return this.createMessage() + this.createAdditionalError("\n"); }; -Game_LogBase.prototype.addLog =function(text){ + +Game_LogBase.prototype.addLog = function(text){ if(!this._additionalLog){ this._additionalLog =[]; } this._additionalLog.push(text); }; -Game_LogBase.prototype.createAdditionalError =function(brStr){ + +Game_LogBase.prototype.createAdditionalError = function(brStr){ if(!this._additionalLog){return "";} var result =brStr; for(var i=0; i < this._additionalLog.length; ++i){ @@ -63,6 +65,7 @@ Game_LogMapEvent.prototype.getEventName = function(){ } return ""; } + Game_LogMapEvent.prototype.createMessage = function(){ var event = this.event(); if(event){ @@ -78,7 +81,7 @@ function Game_LogEventPageMoveRoute(){ Game_LogEventPageMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); Game_LogEventPageMoveRoute.prototype.constructor = Game_LogEventPageMoveRoute; -Game_LogEventPageMoveRoute.prototype.createMessage =function(){ +Game_LogEventPageMoveRoute.prototype.createMessage = function(){ return "(Move Route)"+ Game_LogMapEvent.prototype.createMessage.call(this) ; }; @@ -91,6 +94,7 @@ Game_LogCommonEvent.prototype.constructor = Game_LogCommonEvent; Game_LogCommonEvent.prototype.initialize = function(eventId){ this._eventId = eventId; + this._parent =null; }; Game_LogCommonEvent.prototype.getEventName = function(){ @@ -103,15 +107,15 @@ Game_LogCommonEvent.prototype.getEventName = function(){ } return ""; }; + Game_LogCommonEvent.prototype.createMessage = function(){ var name = this.getEventName(); - return ("CommonEvent: %1(%2)").format( + return("CommonEvent: %1(%2)").format( this._eventId , name ); }; - function Game_LogBattleEvent(){ this.initialize.apply(this,arguments); } @@ -146,6 +150,7 @@ function Game_LogEventTest(){ Game_LogEventTest.prototype = Object.create(Game_LogBase.prototype); Game_LogEventTest.prototype.constructor = Game_LogBattleEvent; + Game_LogEventTest.prototype.initialize = function(){ }; From d77e556408b8d45e30484b059d5f54709a22153a Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 12 Dec 2018 14:23:34 +0900 Subject: [PATCH 37/56] setErrorDetailEnabled() param Among the explanation of parameters, English sentences are based on Google translation. The same is true for this commit log. --- plugins/Community_Basic.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/Community_Basic.js b/plugins/Community_Basic.js index 0a05828f..71191c30 100644 --- a/plugins/Community_Basic.js +++ b/plugins/Community_Basic.js @@ -64,6 +64,13 @@ * @desc The message when error occurred * @default Error occurred. Please ask to the creator of this game. * + * @param showErrorLogDetail + * @type boolean + * @text Detailed error display + * @desc When set to ON, + * details are displayed on the screen when the game stops due to an error. + * @default true + * * @param enableProgressBar * @type boolean * @desc Show progress bar when it takes a long time to load resources @@ -146,6 +153,12 @@ * @text エラーメッセージ * @default エラーが発生しました。ゲームの作者にご連絡ください。 * + * @param showErrorLogDetail + * @type boolean + * @text エラーの詳細表示 + * @desc ONにすると、ゲームがエラーで停止したときに画面に詳細を表示します。 + * @default true + * * @param enableProgressBar * @type boolean * @text ロード進捗バー有効化 @@ -183,6 +196,9 @@ var errorMessage = parameters['errorMessage']; var enableProgressBar = parameters['enableProgressBar'] === 'true'; + var showErrorLogDetail = parameters['showErrorLogDetail']==='true'; + + var windowWidth; var windowHeight; @@ -264,4 +280,5 @@ DataManager.setAutoSaveFileId(autoSaveFileId); Graphics.setErrorMessage(errorMessage); Graphics.setProgressEnabled(enableProgressBar); -})(); \ No newline at end of file + Graphics.setErrorDetailEnabled(showErrorLogDetail); +})(); From 568d4c64bc5691484eef25b7a89ff626977df7b6 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Wed, 12 Dec 2018 14:24:10 +0900 Subject: [PATCH 38/56] EnabledFlag --- js/rpg_core/Graphics.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/rpg_core/Graphics.js b/js/rpg_core/Graphics.js index 01088947..8bd188d1 100644 --- a/js/rpg_core/Graphics.js +++ b/js/rpg_core/Graphics.js @@ -65,6 +65,11 @@ Graphics.initialize = function(width, height, type) { this._setupProgress(); }; +Graphics._setupOptionEnabled = function(){ + this.setErrorDetailEnabled(false); + this.setProgressEnabled(false); + Graphics.setErrorMessage(errorMessage); +}; Graphics._setupCssFontLoading = function(){ if(Graphics._cssFontLoading){ @@ -438,8 +443,12 @@ Graphics.createErrorHTML = function(error){ return this._makeEventInfo(error)+ this._makeErrorStackLog(error); }; +Graphics.setErrorDetailEnabled =function(state){ + this._showErrorDetailEnabled = !!state; +}; + Graphics.printErrorDetail =function(e){ - if (this._errorPrinter){ + if ( this._showErrorDetailEnabled && this._errorPrinter){ var html = this.createErrorHTML(e); var detail = document.createElement('div'); var style = detail.style; From b5b3cf7f6d51d81bc12622b2a561b2603538c433 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Thu, 13 Dec 2018 12:46:22 +0900 Subject: [PATCH 39/56] change style --- js/rpg_core/Graphics.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/js/rpg_core/Graphics.js b/js/rpg_core/Graphics.js index 8bd188d1..8b20562e 100644 --- a/js/rpg_core/Graphics.js +++ b/js/rpg_core/Graphics.js @@ -11,6 +11,9 @@ function Graphics() { Graphics._cssFontLoading = document.fonts && document.fonts.ready && document.fonts.ready.then; Graphics._fontLoaded = null; Graphics._videoVolume = 1; +Graphics._showErrorDetailEnabled = false; +Graphics._progressEnabled = false; +Graphics._errorMessage = ""; /** * Initializes the graphics system. @@ -65,11 +68,6 @@ Graphics.initialize = function(width, height, type) { this._setupProgress(); }; -Graphics._setupOptionEnabled = function(){ - this.setErrorDetailEnabled(false); - this.setProgressEnabled(false); - Graphics.setErrorMessage(errorMessage); -}; Graphics._setupCssFontLoading = function(){ if(Graphics._cssFontLoading){ @@ -428,13 +426,8 @@ Graphics._makeErrorStackLog =function(e){ return ''; }; Graphics._makeEventInfo = function(e){ - if(e.rpgmv){ - if(e.rpgmv.getErrorLog){ - var log = e.rpgmv.getErrorLog(); - if(log){ - return log.createErrorHTML(); - } - } + if(e.rpgmvErrorLog){ + return e.rpgmvErrorLog.createErrorHTML(); } return ""; }; From 55bd7f1b7cb9866872acd376c8956c2cabfea77c Mon Sep 17 00:00:00 2001 From: Sigureya Date: Thu, 13 Dec 2018 12:47:13 +0900 Subject: [PATCH 40/56] save style change --- js/rpg_objects/Game_Character.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Character.js b/js/rpg_objects/Game_Character.js index 04524522..84dea9d5 100644 --- a/js/rpg_objects/Game_Character.js +++ b/js/rpg_objects/Game_Character.js @@ -274,14 +274,17 @@ Game_Character.prototype.evalRouteScript = function(script){ eval(script); } catch (error) { if(this._moveRouteLog){ - error.rpgmv = this; this._moveRouteLog.addLog('moveRouteError'); this._moveRouteLog.addLog('target:'+this.debugName()); this._moveRouteLog.addLog("script:"+script); + this.saveErrorCode(error); } throw(error); } }; +Game_Character.prototype.saveErrorCode =function(exeption){ + exeption.rpgmvErrorLog = this._moveRouteLog; +}; Game_Character.prototype.deltaXFrom = function(x) { return $gameMap.deltaX(this.x, x); From f48f85ae5cc44be6c9d970fe69880fa1b19be767 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Thu, 13 Dec 2018 12:53:57 +0900 Subject: [PATCH 41/56] save style change & massage bulid change --- js/rpg_objects/Game_Interpreter.js | 48 +++++++++++++++++------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 5f390a3d..eaf7a16d 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -701,37 +701,21 @@ Game_Interpreter.prototype.command122 = function() { } return true; }; -Game_Interpreter.codeName = function(code){ - switch (code) { - case 111: - return "Conditional Branch"; - case 122: - return "Control Variables"; - case 355: - return "Script"; - case 356: - return "Plugin Command"; - } - return ""; -}; Game_Interpreter.prototype.evalScript = function(script){ try { return eval(script); } catch (error) { if(this._callLog){ - var command = this.currentCommand(); - var code = command ? command.code :0; - this._callLog.addLog( " line:"+this._index+" "+Game_Interpreter.codeName(code) ); + this._callLog.addLog(this.errorCode(this._index)); this._callLog.addLog("ScriptError"); this._callLog.addLog(script); - error.rpgmv = this; + this.saveErrorCode(error); } throw(error); } }; - Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) { switch (type) { case 0: // Item @@ -1798,10 +1782,10 @@ Game_Interpreter.prototype.command356 = function() { this.pluginCommand(command, args); } catch (error) { if(this._callLog){ - error.rpgmv = this; - this._callLog.addLog("line:"+this._index+" Plugin Command"); + this._callLog.addLog(this.errorCode(this._index)); this._callLog.addLog("command:"+command); this._callLog.addLog("args:"+args); + this.saveErrorCode(error); } throw(error); } @@ -1811,7 +1795,31 @@ Game_Interpreter.prototype.command356 = function() { Game_Interpreter.prototype.pluginCommand = function(command, args) { // to be overridden by plugins }; +Game_Interpreter.codeName = function(code){ + switch (code) { + case 111: + return "Conditional Branch"; + case 122: + return "Control Variables"; + case 355: + return "Script"; + case 356: + return "Plugin Command"; + } + return ""; +}; +Game_Interpreter.prototype.errorCode = function(errorLine){ + var data= this._list[errorLine]; + var lineText = "line:"+(errorLine+1); + if(data){ + return lineText + " " + Game_Interpreter.codeName(data.code); + } + return lineText +" Out of Code range"; +}; +Game_Interpreter.prototype.saveErrorCode =function(exeption){ + exeption.rpgmvErrorLog = this._callLog; +}; Game_Interpreter.requestImagesByPluginCommand = function(command,args){ From ce2cb97aa49c65720afd972dd5f0425c0ee220f6 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Thu, 13 Dec 2018 16:24:32 +0900 Subject: [PATCH 42/56] method name fix --- js/rpg_objects/Game_Log.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index a3a43b97..e2f78264 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -15,7 +15,7 @@ Game_LogBase.prototype.createErrorHTML = function(){ return this.createMessage() +addError+ '

'; }; -Game_LogBase.prototype.createConsolMessage = function(){ +Game_LogBase.prototype.createConsoleMessage = function(){ return this.createMessage() + this.createAdditionalError("\n"); }; From b4ab0016ef127008306ebd156f67df6b8ef3485c Mon Sep 17 00:00:00 2001 From: Sigureya Date: Thu, 13 Dec 2018 16:25:03 +0900 Subject: [PATCH 43/56] method name fix --- js/rpg_managers/SceneManager.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/js/rpg_managers/SceneManager.js b/js/rpg_managers/SceneManager.js index 9b3a5215..6815cda1 100644 --- a/js/rpg_managers/SceneManager.js +++ b/js/rpg_managers/SceneManager.js @@ -199,13 +199,8 @@ SceneManager.onKeyDown = function(event) { SceneManager.showErrorLog = function(e){ console.error(e.stack); - if(e.rpgmv){ - if(e.rpgmv.getErrorLog){ - var log = e.rpgmv.getErrorLog(); - if(log){ - console.error(log.createConsolMessage() ); - } - } + if(e.rpgmvErrorLog){ + console.error(e.rpgmvErrorLog.createConsoleMessage() ); } }; From 12a552ee4501d4cf6e1e1e971e7540f4b05c2450 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 10:18:20 +0900 Subject: [PATCH 44/56] remove unused method --- js/rpg_objects/Game_CharacterBase.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/rpg_objects/Game_CharacterBase.js b/js/rpg_objects/Game_CharacterBase.js index b1dd591e..61300b3b 100644 --- a/js/rpg_objects/Game_CharacterBase.js +++ b/js/rpg_objects/Game_CharacterBase.js @@ -592,9 +592,6 @@ Game_CharacterBase.prototype.endBalloon = function() { Game_CharacterBase.prototype.setMoveRouteLog = function(callLog){ this._moveRouteLog = callLog; }; -Game_CharacterBase.prototype.getErrorLog = function(){ - return this._moveRouteLog; -}; Game_CharacterBase.prototype.debugName = function(){ return "CharacterBase"; }; From 49df2041ca194dda8405dd9207d828ccf998ba8a Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 10:22:10 +0900 Subject: [PATCH 45/56] method move & delete getErrorLog() --- js/rpg_objects/Game_Interpreter.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index eaf7a16d..9ea5014c 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -45,6 +45,10 @@ Game_Interpreter.prototype.setup = function(list, eventId) { Game_Interpreter.requestImages(list); }; +Game_Interpreter.prototype.setEventCallLog = function(callLog){ + this._callLog = callLog; +}; + Game_Interpreter.prototype.eventId = function() { return this._eventId; }; @@ -295,14 +299,6 @@ Game_Interpreter.prototype.changeHp = function(target, value, allowDeath) { } }; -Game_Interpreter.prototype.setEventCallLog = function(callLog){ - this._callLog = callLog; -}; - -Game_Interpreter.prototype.getErrorLog = function(){ - return this._callLog; -}; - // Show Text Game_Interpreter.prototype.command101 = function() { if (!$gameMessage.isBusy()) { From b0279f8aa74c396d79844bc58cf75a075165b62f Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 12:25:22 +0900 Subject: [PATCH 46/56] Critical Bug fix event code skip bug. super Critical bug --- js/rpg_objects/Game_Interpreter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 9ea5014c..5d9afd3f 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -1766,7 +1766,7 @@ Game_Interpreter.prototype.command355 = function() { eventCode = this._list[index]; } this.evalScript(script); - this._index = index; + this._index = index-1; return true; }; From c3b30940ec40268fc48dc7df1cb524de9ee8ba7f Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 12:56:06 +0900 Subject: [PATCH 47/56] Error log lines fix --- js/rpg_objects/Game_Interpreter.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 5d9afd3f..9b8a8024 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -1760,7 +1760,6 @@ Game_Interpreter.prototype.command355 = function() { var eventCode = this._list[index]; while(eventCode && eventCode.code ===655){ - script += eventCode.parameters[0]+"\n"; ++index; eventCode = this._list[index]; @@ -1792,6 +1791,8 @@ Game_Interpreter.prototype.pluginCommand = function(command, args) { // to be overridden by plugins }; Game_Interpreter.codeName = function(code){ + + switch (code) { case 111: return "Conditional Branch"; @@ -1808,6 +1809,16 @@ Game_Interpreter.prototype.errorCode = function(errorLine){ var data= this._list[errorLine]; var lineText = "line:"+(errorLine+1); if(data){ + + if(data.code ===355){ + for(var i = errorLine+1; i< this._list.length;++i){ + var scriptData = this._list[i]; + if(scriptData && scriptData.code !==655){ + lineText +="-"+i-1; + break; + } + } + } return lineText + " " + Game_Interpreter.codeName(data.code); } return lineText +" Out of Code range"; From 9c872027183fd56c752a2c4ad8b9c2540f0bba63 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 13:04:15 +0900 Subject: [PATCH 48/56] RouteError showLines --- js/rpg_objects/Game_Character.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Character.js b/js/rpg_objects/Game_Character.js index 84dea9d5..0217152a 100644 --- a/js/rpg_objects/Game_Character.js +++ b/js/rpg_objects/Game_Character.js @@ -274,7 +274,7 @@ Game_Character.prototype.evalRouteScript = function(script){ eval(script); } catch (error) { if(this._moveRouteLog){ - this._moveRouteLog.addLog('moveRouteError'); + this._moveRouteLog.addLog('moveRouteError line:'+(this._moveRouteIndex+1)); this._moveRouteLog.addLog('target:'+this.debugName()); this._moveRouteLog.addLog("script:"+script); this.saveErrorCode(error); From 16c837f75a34b951bfb481db729e011df513aae0 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 16:49:53 +0900 Subject: [PATCH 49/56] moveroute line --- js/rpg_objects/Game_Log.js | 42 ++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/js/rpg_objects/Game_Log.js b/js/rpg_objects/Game_Log.js index e2f78264..47526eee 100644 --- a/js/rpg_objects/Game_Log.js +++ b/js/rpg_objects/Game_Log.js @@ -74,17 +74,47 @@ Game_LogMapEvent.prototype.createMessage = function(){ return ""; }; -function Game_LogEventPageMoveRoute(){ + +function Game_LogMoveRoute(){ this.initialize.apply(this,arguments); } +Game_LogMoveRoute.prototype = Object.create(Game_LogBase.prototype); +Game_LogMoveRoute.prototype.constructor = Game_LogCommonEvent; +Game_LogMoveRoute.prototype.initialize =function(sorce){ + this._moveRouteSorce =sorce; + this._eventCommandLine =NaN; + this._moveRouteIndex =NaN; +}; +Game_LogMoveRoute.prototype.sorceMessage =function(){ + if(this._moveRouteSorce){ + return this._moveRouteSorce.createMessage(); + } + return 'unknown'; +}; +Game_LogMoveRoute.prototype.createMessage =function(){ + return 'moveRouteError'; +}; +Game_LogMoveRoute.prototype.setEventCommandLine =function(index){ + this._eventCommandLine = index; +}; -Game_LogEventPageMoveRoute.prototype = Object.create(Game_LogMapEvent.prototype); -Game_LogEventPageMoveRoute.prototype.constructor = Game_LogEventPageMoveRoute; - -Game_LogEventPageMoveRoute.prototype.createMessage = function(){ - return "(Move Route)"+ Game_LogMapEvent.prototype.createMessage.call(this) ; +Game_LogMoveRoute.prototype.setMoveRouteIndex = function(index){ + this._moveRouteIndex = index; +}; +Game_LogMoveRoute.prototype.createLineMassage =function(){ + var moveRouteIndex =(this._moveRouteIndex || 0) +1; + if(isNaN(this._eventCommandLine)){ + return '(MoveRouteCostom) line:'+moveRouteIndex; + } + return 'line:'+( this._eventCommandLine+ 1 + moveRouteIndex); }; +Game_LogMoveRoute.prototype.createAdditionalError =function(brStr){ + var origin= Game_LogBase.prototype.createAdditionalError.call(this,brStr); + return (brStr+'sorce:'+this.sorceMessage() + + brStr +this.createLineMassage() + + origin); +}; function Game_LogCommonEvent(){ this.initialize.apply(this,arguments); } From 774fd8db50a75ac96600de9eaff41abf1844d2b0 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 16:50:14 +0900 Subject: [PATCH 50/56] moveroute line --- js/rpg_objects/Game_Interpreter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 9b8a8024..55aa5053 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -1050,7 +1050,9 @@ Game_Interpreter.prototype.command205 = function() { if (this._params[1].wait) { this.setWaitMode('route'); } - this._character.setMoveRouteLog(this._callLog); + var log =new Game_LogMoveRoute(this._callLog); + log.setEventCommandLine(this._index); + this._character.setMoveRouteLog(log); } return true; }; From ffc463c5309693263a3ec2f2a546ac7d35f00c08 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 16:50:47 +0900 Subject: [PATCH 51/56] memberInit --- js/rpg_objects/Game_CharacterBase.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/rpg_objects/Game_CharacterBase.js b/js/rpg_objects/Game_CharacterBase.js index 61300b3b..84211be4 100644 --- a/js/rpg_objects/Game_CharacterBase.js +++ b/js/rpg_objects/Game_CharacterBase.js @@ -48,6 +48,7 @@ Game_CharacterBase.prototype.initMembers = function() { this._jumpCount = 0; this._jumpPeak = 0; this._movementSuccess = true; + this._moveRouteLog =null; }; Game_CharacterBase.prototype.pos = function(x, y) { From 70fb3a96180a4f6a7d0bf658dbfe43ad23f82c7b Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 16:55:13 +0900 Subject: [PATCH 52/56] more better pattern --- js/rpg_objects/Game_Character.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/rpg_objects/Game_Character.js b/js/rpg_objects/Game_Character.js index 0217152a..67718352 100644 --- a/js/rpg_objects/Game_Character.js +++ b/js/rpg_objects/Game_Character.js @@ -267,14 +267,14 @@ Game_Character.prototype.processMoveCommand = function(command) { break; } }; - Game_Character.prototype.evalRouteScript = function(script){ var gc = Game_Character; try { - eval(script); + eval(script); } catch (error) { + if(this._moveRouteLog){ - this._moveRouteLog.addLog('moveRouteError line:'+(this._moveRouteIndex+1)); + this._moveRouteLog.setMoveRouteIndex(this._moveRouteIndex); this._moveRouteLog.addLog('target:'+this.debugName()); this._moveRouteLog.addLog("script:"+script); this.saveErrorCode(error); From 13410b074aaf7016088b35ce158443e5e0662246 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 17:00:16 +0900 Subject: [PATCH 53/56] log fix --- js/rpg_objects/Game_Event.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/rpg_objects/Game_Event.js b/js/rpg_objects/Game_Event.js index 90df4d26..c8bdbfe9 100644 --- a/js/rpg_objects/Game_Event.js +++ b/js/rpg_objects/Game_Event.js @@ -298,7 +298,8 @@ Game_Event.prototype.setupPageSettings = function() { this._moveType = page.moveType; if(this._moveType === 3){ - this.setMoveRouteLog( new Game_LogEventPageMoveRoute(this._mapId,this._eventId,this._pageIndex)); + var log =new Game_LogMoveRoute(this.createLogClass()); + this.setMoveRouteLog( log); } this._trigger = page.trigger; From 9c6e1bfa1ea3d0a01457520ed1aba6eaea118d85 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 17:17:53 +0900 Subject: [PATCH 54/56] Add Log --- js/rpg_objects/Game_Map.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/rpg_objects/Game_Map.js b/js/rpg_objects/Game_Map.js index e3918c4d..309219f8 100644 --- a/js/rpg_objects/Game_Map.js +++ b/js/rpg_objects/Game_Map.js @@ -782,6 +782,7 @@ Game_Map.prototype.setupAutorunCommonEvent = function() { var event = $dataCommonEvents[i]; if (event && event.trigger === 1 && $gameSwitches.value(event.switchId)) { this._interpreter.setup(event.list); + this._interpreter.setEventCallLog( new Game_LogCommonEvent(i)); return true; } } From 746c41327d4cc80e743ca1f79824cc85e0856852 Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 17:25:02 +0900 Subject: [PATCH 55/56] parallel fix --- js/rpg_objects/Game_Event.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/rpg_objects/Game_Event.js b/js/rpg_objects/Game_Event.js index c8bdbfe9..597f49e1 100644 --- a/js/rpg_objects/Game_Event.js +++ b/js/rpg_objects/Game_Event.js @@ -343,6 +343,7 @@ Game_Event.prototype.updateParallel = function() { if (this._interpreter) { if (!this._interpreter.isRunning()) { this._interpreter.setup(this.list(), this._eventId); + this._interpreter.setEventCallLog(this.createLogClass()); } this._interpreter.update(); } From 3eeaf2934eb241868aca76232c8e9faf7a0ec33f Mon Sep 17 00:00:00 2001 From: Sigureya Date: Fri, 14 Dec 2018 17:50:18 +0900 Subject: [PATCH 56/56] error lines fix --- js/rpg_objects/Game_Interpreter.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/rpg_objects/Game_Interpreter.js b/js/rpg_objects/Game_Interpreter.js index 55aa5053..0d825aea 100644 --- a/js/rpg_objects/Game_Interpreter.js +++ b/js/rpg_objects/Game_Interpreter.js @@ -1810,20 +1810,22 @@ Game_Interpreter.codeName = function(code){ Game_Interpreter.prototype.errorCode = function(errorLine){ var data= this._list[errorLine]; var lineText = "line:"+(errorLine+1); - if(data){ + if(!data){ + return lineText +" Out of Code range" + } - if(data.code ===355){ - for(var i = errorLine+1; i< this._list.length;++i){ - var scriptData = this._list[i]; - if(scriptData && scriptData.code !==655){ - lineText +="-"+i-1; - break; + if(data.code ===355){ + for(var i = errorLine+1; i< this._list.length;++i){ + var scriptData = this._list[i]; + if(scriptData && scriptData.code !==655){ + if( errorLine < (i-1) ){ + lineText +="-"+i; } + break; } } - return lineText + " " + Game_Interpreter.codeName(data.code); } - return lineText +" Out of Code range"; + return lineText + " " + Game_Interpreter.codeName(data.code); }; Game_Interpreter.prototype.saveErrorCode =function(exeption){