设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 53|回复: 0

[转载发布] Trilobytes MV #1: Dude, Where's My Autorun?

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    8039

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    30085
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    39018

    灌水之王

    发表于 5 天前 | 显示全部楼层 |阅读模式


    Dude, Where's My Autorun? Version 1.0
    Created by Trihan


    Introduction
    Have you ever been test playing your game when all of a sudden the player couldn't move any more? Ah, crap, looks like you probably have an errant autorun event that's screwing things up. But this is a 500x500 map with 150 events on it, and your autorun could be ANY ONE OF THEM! What to do, what to do...if only there were a plugin that could help. Well, now there is!

    Features
    - Display a list of every autorun page in the game that meets its conditions to run.
    - Tells you how you can activate higher-numbered pages to turn the page off.
    - Tells you whether the autorun page has an "erase event" command that makes it turn itself off.

    Screenshots
    Spoiler: Screenshots




    How to Use
    Install the plugin pretty much anywhere. Its functionality is entirely contained within a new DataManager function, so it won't cause compatibility issues with any other plugin unless for some reason another plugin adds a function to DataManager called locateAutorun, which I can't imagine will happen any time soon.

    In order to use it, there are two commands; due to the utility-based nature of this plugin, you have to run it from the console as you can run it from any point in the game. The volume of potential output is too great to use message boxes or a scene for it. So press F8 to open the console and then enter one of the following:

    DataManager.locateAutorun()

    This will look through every map in the game for events with autorunning pages, and if it finds any will tell you whether they meet their conditions and what you'd have to do to turn them off. It won't give you every single autorun page; if it finds a non-autorun page that's higher than the autorun and has its conditions met, it won't mention that page.

    Note that as this loads up the data for every map in the game, larger games may take a while to process.

    DataManager.locateAutorun(mapId)

    This will cause the output to be limited to the specific map ID you enter.

    Demo
    No demo available at present.

    Script
    Spoiler: Code
                    Code:       
    1. //=============================================================================
    2. // DudeWheresMyAutorun.js v1.0
    3. //=============================================================================
    4. /*:
    5. * @plugindesc Gives you a list of all autorun events in the game with locations.
    6. * Handy if you have a game freeze and don't know where the autoruns are.
    7. * @author John Clifford (Trihan)
    8. *
    9. * @help
    10. *
    11. * Open a console by pressing F8 and type one of the following to call the
    12. * relevant function:
    13. *
    14. * DataManager.locateAutorun();
    15. * The plugin will display a list of all maps detailing events with autorun pages,
    16. * detailing conditions and whether they are met.
    17. *
    18. * NOTE: Due to this function having to load data for every map in the game, it
    19. * may take some time to process for large games.
    20. *
    21. * DataManager.locateAutorun(mapId);
    22. * The plugin will display a list of events on the given map with autorun pages,
    23. * detailing conditions and whether they are met.
    24. *
    25. * ============================================================================
    26. * Changelog
    27. * ============================================================================
    28. * Version 1.0 - Initial release
    29. * ============================================================================
    30. */
    31. (function() {
    32.     DataManager.locateAutorun = function(mapId) {
    33.         if (mapId) {
    34.             if ($dataMapInfos[mapId]) {
    35.                 outputMapData($dataMapInfos[mapId]);
    36.             } else {
    37.                 console.log("ERROR: Invalid map ID.");
    38.             }
    39.         } else {
    40.             $dataMapInfos.forEach(function(mapInfo) {
    41.                 if (mapInfo) {
    42.                     outputMapData(mapInfo);
    43.                 }
    44.             });
    45.         }
    46.     };
    47.   
    48.     function outputMapData(mapInfo) {
    49.         var autorunEvents = [];
    50.                 var xhr = new XMLHttpRequest();
    51.                 xhr.open("GET", 'data/Map%1.json'.format(mapInfo.id.padZero(3)));
    52.                 xhr.overrideMimeType('application/json');
    53.                 xhr.onload = function ()
    54.                 {
    55.                     if(xhr.status < 400)
    56.                     {
    57.                         var mapData = JSON.parse(xhr.responseText);
    58.                         var events = mapData.events;
    59.                         events.forEach(function(ev) {
    60.                             if (ev) {
    61.                                 ev.pages.forEach(function(page, index) {
    62.                                     if (page.trigger === 3 && !autorunEvents.contains(ev)) {
    63.                                         autorunEvents.push(ev);
    64.                                     }
    65.                                 });
    66.                             }
    67.                         });
    68.                         if (autorunEvents.length > 0) {
    69.                             console.log("Map " + mapInfo.id + "("" + mapInfo.name + "") contains " + autorunEvents.length + " autorun event" + (autorunEvents.length > 1 ? "s" : "") + ":");
    70.                             autorunEvents.forEach(function(autoEv) {
    71.                                 console.log("  "" + autoEv.name + "" located at (" + autoEv.x + ", " + autoEv.y + ")");
    72.                                 var requiredConditions = [];
    73.                                 for (var i = autoEv.pages.length - 1; i >= 0; i--) {
    74.                                     var conditionsMet = true;
    75.                                     var page = autoEv.pages[i];
    76.                                     if (page.trigger === 3) {
    77.                                         console.log("    Page " + (i + 1) + ":");
    78.                                     }
    79.                                     var conditions = page.conditions;
    80.                                     var condition;
    81.                                     if (conditions.switch1Valid) {
    82.                                         condition = $gameSwitches.value(conditions.switch1Id);
    83.                                         if (!condition) {
    84.                                             conditionsMet = false;
    85.                                         }
    86.                                         if (page.trigger === 3) console.log("      Requires switch " + conditions.switch1Id + " (" + (condition ? "MET" : "NOT MET") + ")");
    87.                                     }
    88.                                     if (conditions.switch2Valid) {
    89.                                         condition = $gameSwitches.value(conditions.switch2Id);
    90.                                         if (!condition) {
    91.                                             conditionsMet = false;
    92.                                         }
    93.                                         if (page.trigger === 3) console.log("      Requires switch " + conditions.switch2Id + " (" + (condition ? "MET" : "NOT MET") + ")");
    94.                                     }
    95.                                     if (conditions.variableValid) {
    96.                                         condition = $gameVariables.value(conditions.variableId) >= conditions.variableValue;
    97.                                         if (!condition) {
    98.                                             conditionsMet = false;
    99.                                         }
    100.                                         if (page.trigger === 3) console.log("      Requires variable " + conditions.variableId + " >= " + conditions.variableValue + " (" + (condition ? "MET" : "NOT MET") + ")");
    101.                                     }
    102.                                     if (conditions.selfSwitchValid) {
    103.                                         condition = $gameSelfSwitches.value([mapInfo.id, autoEv.id, conditions.selfSwitchCh]);
    104.                                         if (!condition) {
    105.                                             conditionsMet = false;
    106.                                         }
    107.                                         if (page.trigger === 3) console.log("      Requires self switch " + conditions.selfSwitchCh + " (" + (condition ? "MET" : "NOT MET") + ")");
    108.                                     }
    109.                                     if (conditions.itemValid) {
    110.                                         condition = $gameParty.hasItem($dataItems[conditions.itemId]);
    111.                                         if (!condition) {
    112.                                             conditionsMet = false;
    113.                                         }
    114.                                         if (page.trigger === 3) console.log("      Requires item " + conditions.itemId + " (" + (condition ? "MET" : "NOT MET") + ")");
    115.                                     }
    116.                                     if (conditions.actorValid) {
    117.                                         condition = $gameParty.members().contains($gameActors.actor(conditions.actorId));
    118.                                         if (!condition) {
    119.                                             conditionsMet = false;
    120.                                         }
    121.                                         if (page.trigger === 3) console.log("      Requires actor " + conditions.actorId + " (" + (condition ? "MET" : "NOT MET") + ")");
    122.                                     }
    123.                                     if (page.trigger === 3) {
    124.                                         if (conditionsMet) {
    125.                                             console.log("    This page meets all conditions and will run on map entry");
    126.                                             if (!conditions.switch1Valid && !conditions.switch2Valid && !conditions.variableValid && !conditions.selfSwitchValid && !conditions.itemValid && !conditions.actorValid) {
    127.                                                 var eraseEvent = false;
    128.                                                 var eventCommands = autoEv.pages[i].list;
    129.                                                 eventCommands.forEach(function(command) {
    130.                                                     if (command.code === 214) {
    131.                                                         eraseEvent = true;
    132.                                                     }
    133.                                                 });
    134.                                                 if (!eraseEvent) {
    135.                                                     if (i === autoEv.pages.length - 1) {
    136.                                                         console.log("    WARNING: This page has no defined conditions and there are no non-autorun pages higher than it, so it is currently impossible to shut off.");
    137.                                                     } else {
    138.                                                         console.log("    WARNING: This page has no defined conditions. In order to shut it off, you will have to turn on a higher page by meeting the following conditions:");
    139.                                                         requiredConditions.forEach(function(conditionSet) {
    140.                                                             console.log("      Page " + (conditionSet[0] + 1) + ":");
    141.                                                             if (conditionSet[1].switch1Valid) {
    142.                                                                 console.log("      - Turn ON switch " + conditionSet[1].switch1Id);
    143.                                                             }
    144.                                                             if (conditionSet[1].switch2Valid) {
    145.                                                                 console.log("      - Turn ON switch " + conditionSet[1].switch2Id);
    146.                                                             }
    147.                                                             if (conditionSet[1].variableValid) {
    148.                                                                 console.log("      - Set variable " + conditionSet[1].variableId + " to " + conditionSet[1].variableValue + " or higher");
    149.                                                             }
    150.                                                             if (conditionSet[1].selfSwitchValid) {
    151.                                                                 console.log("      - Turn ON self switch " + conditionSet[1].selfSwitchCh);
    152.                                                             }
    153.                                                             if (conditionSet[1].itemValid) {
    154.                                                                 console.log("      - Acquire item " + conditionSet[1].itemId);
    155.                                                             }
    156.                                                             if (conditionSet[1].actorValid) {
    157.                                                                 console.log("      - Add actor " + conditionSet[1].actorId + " to the party");
    158.                                                             }
    159.                                                         });
    160.                                                     }
    161.                                                 } else {
    162.                                                     console.log("    It erases itself so no further action necessary.");
    163.                                                 }
    164.                                             }
    165.                                             break;
    166.                                         }
    167.                                         else {
    168.                                             console.log("    This page does not meet its conditions and will not run");
    169.                                         }
    170.                                     } else {
    171.                                         if (conditionsMet) {
    172.                                             console.log("    A higher non-autorun page (" + (i + 1) + ") meets its conditions, the autorun page will not run");
    173.                                             break;
    174.                                         }
    175.                                         else {
    176.                                             requiredConditions.push([i, conditions]);
    177.                                         }
    178.                                     }
    179.                                 }
    180.                             });
    181.                         } else {
    182.                             console.log("Map " + mapInfo.id + " contains no autorun events.");
    183.                         }
    184.                     }
    185.                 }
    186.                 xhr.send();
    187.     };
    188. })();
    复制代码


    FAQ
    No questions at present.

    Terms of Use
    This plugin can be used freely for both commercial and non-commercial projects. No credit is necessary due to it being strictly for developer utility.

    Credit and Thanks
    - Trihan
    - Thanks to all the newbies who have posted threads where this was their problem, prompting the idea in the first place.


    本贴来自国际rpgmaker官方论坛作者:Trihan处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/trilobytes-mv-1-dude-wheres-my-autorun.77037/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 10:47 , Processed in 0.122300 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表