Ack, thank you, I keep making that mistake! Too used to using a template for my own plugins...
😔
Yes, whoops.
😅 You'd need to define the function on a global object (defined outside the IIFE, as
@Aloe Guvner mentions). You can create a "namespace" object globally (i.e. outside the main function) to store the required plugin pieces. Something like this (I tested it this time!):
Code:
var Poppie = Poppie || {}; // namespace for your plugins, equal to itself if already defined or an empty object otherwise
Poppie.eleCalc = {}; // namespace for persistent properties of this plugin
(function($) { // add parameter $ to represent the plugin namespace (see final line)
"use strict";
// Stuff here will run on game start, when index.html loads.
var params = PluginManager.parameters('ReFraction Battle Index and element calculations');
// define persistent stuff as properties of the namespace, e.g.
$.test = params['test number to display'];
// Other parameter stuff here...
// Define a function on your global namespace.
$.calculateVariables = function() {
// the code in here will run when this function is called
$gameVariables.setValue(5, 1);
console.log('Variable 5 =', $gameVariables.value(5));
};
})(Poppie.eleCalc); // pass the plugin's namespace in as the first parameter, $
Then to invoke by script call you just need to include the namespaces:
Code:
◆Script:Poppie.eleCalc.calculateVariables();
You can use whatever names you like for the namespaces etc, of course, this is just for an example.
😅
Also, beware of setting values for variable IDs that you haven't "defined" in the editor, seems it doesn't assign the value in that case. Just view the variable list in the editor, make sure you've changed the maximum to accommodate all the variables you want to use, and I think it should be OK.
😴