Well basically I wanted to know if there is a script that allows me to change the default option where the selection is positioned in an election window
Change the default option of a choice window via script?
RPG Maker MZ SupportCan you explain what your use case is for needing to change the default that was set when creating the choice in the event?
You can basically copy-paste your Show Choices, in one case option 1 is pre-selected, in the other case option 2 is pre-selected.
The labels help to mitigate copy-pasting, however, there should be many alternative ways to achieve the same:
The labels help to mitigate copy-pasting, however, there should be many alternative ways to achieve the same:
Code:
Conditional Branch: If Switch X is OFF
Show Choices (default is 1)
when 1
Jump to Label: Action 1
when 2
Jump to Label: Action 2
when Esc is pressed
Exit Event
Else
Show Choices (default is 2)
when 1
Jump to Label: Action 1
when 2
Jump to Label: Action 2
when Esc is pressed
Exit Event
Label Action 1:
whatever
Exit Event
Label Action 2:
whatever
Exit Event
I basically made my own screen to adjust the game volume using choices. So my idea is that when the player enters that volume window, the default position is the last one that the player selected.
I was thinking something like this:
choice 1 = set volume variable to 1
choice 2 = set volume variable to 2
So before the elections I imagined something like:
if the volume variable is 1 = (and here would be a script that sets the default position to 1)
if the volume variable is 2 = (and here would be a script that sets the default position to 2)
I hope I have explained myself well!
Original thread: https://forums.rpgmakerweb.com/threads/change-the-default-option-of-a-choice-window-via-script.162732/