Js-event for MV
by SaphirAngel
Version
Alpha
About:
Hi, during test game development with RPG Maker MV.
I had the idea to write the events in pure js.
But, the RPG Maker Engine have a particular update loop who run step by step.
So, the purpose of this plugin is to offer the possibility of using a JavaScript interpreter that can run step by step : JS-Interpreter.
Features:
- js only events !!
- Write js in script command which will be run step by step
- Load external script file with plugin command : JSI filename
- JS-Interperter run in sandbox, so the commands must be rewritten but it offers the possibility to personalize and simplify their use.
Valid commands :
Transfered objects
- console
- $gameVariables, $gameSwitches, $gameMessage, $gameScreen
Variables
- __v(variableName) get a variable from $gameVariables
- __v(variableName, value) set a variable with value from $gameVariables
- __v(variableId) get a variable from $gameVariables
- __v(variableId, value) set a variable with value from $gameVariables
Switches
- __s(switchName) get a switch from $gameSwitches
- __s(switchName), value) set a switch with value from $gameSwitches
- __s(switchId) get a switch from $gameSwitches
- __s(switchId, value) set a switch with value from $gameSwitches
Dialog
- say("text", [position]) which will show text (position can be "top", "bottom", "middle")
- choice("text", ["choice_a", "choice_b", "choice_c"]) Show choice to user. Return an int which represent the selected choice position in array
Picture
- show({name: "yourpicturename"}) which will just show a picture (as show picture command).
- showWithDissolve({name: "yourpicturename"}) which will show a picture with 0.5s Dissolve
Additional Planned Features
- Add other commands
Update
2019-08-05
- Yeah ! I managed to wrap the rpg maker mv objects to the sandbox. Not big code but a little research (I'm not familiar with js-interpreter). So, i add code for wrap $gameVariables, $gameSwitches, $gameMessage and $gameScreen. (thanks to BrownBear2)
- I add console object too, debug is life.
License
Apache License 2.0
Terms of use and Credits
Commercial use allowed with a copy of license. (Free to use in any project)
Thanks to Neil Fraser for JS-Interpreter
No credit needed, just have fun.
Script exemple
Installation:
Add acorn_interpreter.js in libs folder
Add ScriptInterpreter.js in plugins folder
Include acorn_interpreter.js in index.html
Add ScriptInterpreter in Plugin Manager
Add script command with on first line, this comment : //@jsi
I do not know if it can be useful to others but as it is for me. Why not !
Enjoy
by SaphirAngel
Version
Alpha
About:
Hi, during test game development with RPG Maker MV.
I had the idea to write the events in pure js.
But, the RPG Maker Engine have a particular update loop who run step by step.
So, the purpose of this plugin is to offer the possibility of using a JavaScript interpreter that can run step by step : JS-Interpreter.
Features:
- js only events !!
- Write js in script command which will be run step by step
- Load external script file with plugin command : JSI filename
- JS-Interperter run in sandbox, so the commands must be rewritten but it offers the possibility to personalize and simplify their use.
Valid commands :
Transfered objects
- console
- $gameVariables, $gameSwitches, $gameMessage, $gameScreen
Variables
- __v(variableName) get a variable from $gameVariables
- __v(variableName, value) set a variable with value from $gameVariables
- __v(variableId) get a variable from $gameVariables
- __v(variableId, value) set a variable with value from $gameVariables
Switches
- __s(switchName) get a switch from $gameSwitches
- __s(switchName), value) set a switch with value from $gameSwitches
- __s(switchId) get a switch from $gameSwitches
- __s(switchId, value) set a switch with value from $gameSwitches
Dialog
- say("text", [position]) which will show text (position can be "top", "bottom", "middle")
- choice("text", ["choice_a", "choice_b", "choice_c"]) Show choice to user. Return an int which represent the selected choice position in array
Picture
- show({name: "yourpicturename"}) which will just show a picture (as show picture command).
- showWithDissolve({name: "yourpicturename"}) which will show a picture with 0.5s Dissolve
Additional Planned Features
- Add other commands
Update
2019-08-05
- Yeah ! I managed to wrap the rpg maker mv objects to the sandbox. Not big code but a little research (I'm not familiar with js-interpreter). So, i add code for wrap $gameVariables, $gameSwitches, $gameMessage and $gameScreen. (thanks to BrownBear2)
- I add console object too, debug is life.
License
Apache License 2.0
Terms of use and Credits
Commercial use allowed with a copy of license. (Free to use in any project)
Thanks to Neil Fraser for JS-Interpreter
No credit needed, just have fun.
Script exemple
Code:
//@jsi
var name = "Saphir";
// Set variable named Day to 12 (need to exist for test)
__v('Day', 12);
// Set switch 1 to false
__s(1, false);
// Print switch 1 value in console
debug(__s(1));
// Get variable named Day (need to exist for test)
var aGameVar = parseInt(__v('Day'));
// Show text at the bottom
say("Hello " + name);
// Show picture with 0.5s dissolve
showWithDissolve({name: "a_picture_name"});
// Show a choice for the player
var c = choice('Hi, what do you want ?', ['A candy', 'A water bottle', 'Nothing']);
switch (c) {
case 0: say("A candy, okay !"); break;
case 1: say("Sorry we don't have this :("); break;
default: say("Oooooh");
}
say("Thanks for this");
// Show picture with 0.5s dissolve
showWithDissolve({name: "a_other_picture_name"});
Installation:
Add acorn_interpreter.js in libs folder
Add ScriptInterpreter.js in plugins folder
Include acorn_interpreter.js in index.html
Add ScriptInterpreter in Plugin Manager
Add script command with on first line, this comment : //@jsi
I do not know if it can be useful to others but as it is for me. Why not !
Enjoy