EvalScript 1.0
Monyarm
Introduction
This is a plugin that lets you run .js files through the Script Call Event. It also supports GZipped .js files.
Features
Exactly what it says on the tin (and in the previous segment)
How to Use
Extract and place MONY_EvalScript.js in js/plugins. Use evalScript(url), where url is the path/url to the .js file you want to run.
Script
Make sure that you place your script using the code feature, do not use quotes. Again, if spoiler tag is available in the future then use the spoiler tag together with the code tag.
Spoiler: MONY_EvalScript.js
Code: - // Script
- function endsWith(suffix) {
- return this.indexOf(suffix, this.length - suffix.length) !== -1;
- }
- function evalScript(url) {
- var xhr = new XMLHttpRequest();
- if (url.endsWith(".gz")) {
- xhr.setRequestHeader("Content-Encoding", "deflate");
- //console.log(url);
- } else {
- //console.log(url);
- }
- xhr.open('GET', url);
- xhr.onload = function() {
- if (xhr.status < 400) {
- console.log(xhr.responseText);
- eval(xhr.responseText);
- }
- };
- xhr.send();
- }
复制代码
If you wish to support me, use the following download link:
https://userscloud.com/ntrww2ilhels (Also includes MONY_Merchant script which was used for a scrapped personal project)
FAQ
Post question and answers to common question here in the following format:
Q: The game crashes/gives an error.
A: That would be cause of the code in your .js file, my script runs the code the same way the game runs script calls.
Q: GZipped files don't work.
A: Ya, that part is a bit finnicy, it works when it wants to, sometimes it works, sometimes it doesn't.
Credit and Thanks
- Me
- Myself
- I
Author's Notes
If you want to use the script for a commercial project, go right ahead, just remember to credit me, also contact me beforehand.
本贴来自国际rpgmaker官方论坛作者:monyarm处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/evalscript-plugin.82856/