Hi I've been twerking TSR_Save.js for a day now and I cant seem to solve it. I have no programming backgrounds, even so I have no choice but to to check it anyway. I am thinking of using Bgs_MenusCancelCommand.js for mobile phone use.
So, basically, all I want is to go back to main menu after pressing "Cancel" when at save scene.
I ended up with 3 ideas but nothing is impressive enough:
1.SceneManager.push(Scene_Menu) - is wrong it will loop back to the save scene I do not know whats making this
2.SceneManager.goto(Scene_Menu) - answers my problem but has an issue that I have to click the return button twice to exit the menu which is annoying, but better
3.SceneManager.goto(Scene_Map) - alternative but it is not realistic to send the player directly from save scene back to map without passing main menu
Here is the part where I made changes, at line 2928 if I am not mistaken:
Scene_File.prototype.onConfirmCancel = function() {
if (TSR.Save.singleSlot && this.mode() === 'save') {
//SceneManager.push(Scene_Menu);
SceneManager.goto(Scene_Menu);
//SceneManager.goto(Scene_Map);
} else {
this._CommandWindow.close();
this._listWindow.activate();
this._listWindow.help.updatePosition(TSR.Save.help_x, TSR.Save.help_y);
this._listWindow.help.setText(this.HelpText());
this._listWindow.help.open();
if (this._listWindow._bitmapCursor) this._listWindow._bitmapCursorFixed = false;
}
};
Thank you for helping.
Keep in mind, if you cancel it from the save scene, you will go
to the map though, so why modification there?
what exactly is what you want to achieve as it already does it by default?
you could also apply to the thread as I modify and help people for their scene.
Now here is the thing:
I dont know how well it works on mobile, and cancel the scene probably require
a touch button "cancel/back" on scene load/scene save, as this is not needed
for pc users or maybe web users?
I dont know how mobile exactly works, but there is a plugin to add a "back button"
on each scene which might help you out, depending how cancel exactly work
on mobile, so I cannot really help you on that part.
I could however check out how it can work, but instead of "SceneManager.goto(Scene_Map);"
you can rather check if they are on "mobile device" like android, than add an option else
the default thing happens.
but while I cannot check if it does work on android, I cannot help you.
Here is what I am trying to achieve bro.
1. A clean menu where it contains stuffs including the TSR_Save.
2.What I want is make it to go back to main menu where I originaly came from before activating TSR_Save (for manual saving purposes if the player wants to) and not to send the player to the map directly
3.I haven't tried it yet with mobile, just saying I am planning to do it.
1) if you want to use a plugin for a different savefunction, you'll give us a link to the website of the plugin to check for options.
2) you're coming at it from the wrong direction.
instead of modifying the cancel/return function, you should try to change the calling function into a gosub functionality.
that way the cancel would autoreturn to the previous menu, but unfortunately I don't know enough of javascript to tell you how to do that.
JS is harder, do you have a link to bgs_menucancelcommand?
so I can see what can mess with the scene and or add images
to what you want to achieve?
than I can try look into it and help you when able too.
it's easier for me to work on to modify the plugin if required.
through the code, it should work, but based on its name and function,
you should place this plugin on the bottom (utility section) as it alias
function from menu, save, load, status, skill, etc.
if this is placed on top, it does not work, I can test later to confirm this
if you want me too, else I can try to impliment it for you.
but it should work on the bottom of your plugin list while TSR_Save needs to be
below YEP_CoreEngine.
if this plugin is higher than your save plugin, it does not work which why you
have trouble to make this work.
if it is below and you have this error, show a screenshot and I try to fix this
for you to read that function inside TSR_Save (this is no big trouble),
just give me a few days by than please.
Sad to say I am not using any Yanfly Plugins, I am not even sure anymore if this is fixable, I already made changes from rpg_managers.js rpg_scenes.js rpg_windows.js so it is a bit complicated now, and I can no longer track what is causing this to happen. I already did put the plugin up and down the plugin list, top most, bottom most, below or above suspected plugins. But nothing worked. So it is okay. Let's just give up on it.
if you directly change things inside rpg_manager, rpg_scenes etc,
than you are in bigger trouble than it should be.
YEP plugins are optional, no must, but if you made changes to its
core without knowing, it can break more stuff than you realize, which
why they "overwrite" or "alias" the function with the changes.
those plugins addings to your list = 10x safer and you wont break
anything to the core as well, so its an easier fix if you made change
on its core.
some people does that because they know what they do, specially
more advance coders does this.
but if you dont know what you do, its really bad, so its harder to track
down the cause and fix it (but its still fixable).
but to make sure the plugin does work, create a new project,
add TSR_Save and Bgs_MenuCancelCommand.
another very important note which I forgot to ask, is it called
"Bgs_MenusCancelCommand" (without quotes) because, if you
change the name, it wont read any parameters as well.
but the clean project can confirm it is added or not, if its not added,
than we can try to pinpoint where you went wrong.
Thanks for your help shadow dragon, I sincerely feel that you wanted to help. I made another solution for this and that is I made a map button that opens TSR_Save that way incase the player moves out of the save scene it will now go back to map scene directly.
Yes, I am so dumb and now regretting touching main core. But it can't be helped, I don't have any coding backgrounds and that time it was the best and fastest solution I can think of. Sad...
What about 'SceneManager.pop()'
thats because this.popScene() exit the stack by 1, not 2.
so if you have Map => Main menu => Save Scene, than this.popScene exit the
save scene to Main Menu, pressing cancel use this.popScene() again to go
back to the map.
if you want from Save to Map while the Bgs_MenuCancelButton is added
to the save scene, than you need to modify that plugin, than on line
427 and 438, you can set of this.popScene() to SceneManager.goto(Scene_Map);
which than works if that plugin is installed, because that this.popScene is than
changed (if true) go to scene map), not in TSR_Save.
try that and see if that works 🙂
if Scene_Map does not work, I need to get the corresponding call to go there.
Thank you shadow dragon, I happen to solve it already by placing a map button for TSR_Save. Thanks a lot.