Hello i'm a new scripter and I have looked far and wide for this but had no luck. I am trying to make it so when the select a comand it opens a window then when they back out of the second window it is still selected on that command. I found in the menu and item menu have something in there code called select last but couldn't figure how it works
[Solved]How to select last?
Learning Ruby and RGSSxselect_last simply selects the last index used by that command window..
If you made the command window (first) as a child of Window_Command, it should actually already be staying on that last command, unless you actually destroyed the window when you select a command.
If you made the command window (first) as a child of Window_Command, it should actually already be staying on that last command, unless you actually destroyed the window when you select a command.
If by destory you mean it closes the command window then yes.
Can you show us the exit/cancel code of your second window?
is this what your looking for
Lets get this clear, please correct me if Im wrong:
-Window_Journal is the first window
-Selecting an option (Log, Study etc) transfers you to a new scene
-Because its a new scene, when you cancel, it returns to the scene with Window_Journal but since we transferred thru scenes, it goes back to the first option of Window_Journal
If all those are true, what you need to do is make a class variable for Window_Journal (a variable with @@ before it), we will use this to save the last index selected on any Window_Journal instance. You can also opt to use a global variable or make an instance variable inside Game_System (so that its saved with the save file by default)
When you OK an option in the Window_Journal, you set the class variable to be equal to the index of that option. Then on the initialization method of Window_Journal, you check if the class variable has a value, if yes, call the select method passing that value, else call select on the first index.
PS: Make sure you take care when using the words Window and Scene because on your OP I thought you're just opening various Windows within the same scene but based on your posted code, you're actually opening a new Scene instead. That changes the situation greatly
-Window_Journal is the first window
-Selecting an option (Log, Study etc) transfers you to a new scene
-Because its a new scene, when you cancel, it returns to the scene with Window_Journal but since we transferred thru scenes, it goes back to the first option of Window_Journal
If all those are true, what you need to do is make a class variable for Window_Journal (a variable with @@ before it), we will use this to save the last index selected on any Window_Journal instance. You can also opt to use a global variable or make an instance variable inside Game_System (so that its saved with the save file by default)
When you OK an option in the Window_Journal, you set the class variable to be equal to the index of that option. Then on the initialization method of Window_Journal, you check if the class variable has a value, if yes, call the select method passing that value, else call select on the first index.
PS: Make sure you take care when using the words Window and Scene because on your OP I thought you're just opening various Windows within the same scene but based on your posted code, you're actually opening a new Scene instead. That changes the situation greatly
That is correct. That got it working apparently I had the pieces figured out from looking at some of the base codings I just didn't understand it enough to put the pieces in the right places thank you so much for the help.
PS. oops forgot there was a difference between Window and Scene will keep that in mind next time I ask for help
PS. oops forgot there was a difference between Window and Scene will keep that in mind next time I ask for help
Original thread: https://forums.rpgmakerweb.com/threads/solved-how-to-select-last.109251/