Script calls inside a plugin

Hello people! ^^

I'm testing something prety simple to make a plugin.

here is the code
Code:
(function() {
    
    if ($gamePlayer.regionId() == 252) {
        return SceneManager.push(Scene_Load);
    }

})();

But this don't work. Inside a conditional branch script call in the game the check for the player in the region 252 works.
How can i do that inside a plugin? Script calls don't work like that in plugins?
Code:
function callLoad () {
if ($gamePlayer.regionId() == 252) SceneManager.push (Scene_Load);
}
Then call callLoad () whenever you need to call that function.
If you're making a plugin, I recommend you to learn how javascript works before anything. Makes stuff easier in the long run.
Code:
function callLoad () {
if ($gamePlayer.regionId() == 252) SceneManager.push (Scene_Load);
}
Then call callLoad () whenever you need to call that function.
If you're making a plugin, I recommend you to learn how javascript works before anything. Makes stuff easier in the long run.
Ohh.. ok! i'm on the road to learn ^^
Thanks a lot @Poryg!

Original thread: https://forums.rpgmakerweb.com/threads/script-calls-inside-a-plugin.106907/