Reset autoswitches?

Hi! I'm trying to make some sort of a "Choose your own adventure" game, which requires the player to go for more than only one playthrough.


To do so, it would be necessary to reset all the autoswitches the player has activated during the previous playthrough. Is there any way to do so? Maybe there's another way to approach this problem? 
Have you tried making an event at the end of the playthrough which turns off all switches in general? 
What is an auto Switch?


I just know regular "Switches" and "Self Switches".


Regular Switches:


You use the Eventcommand Control switches and choose "Batch" that allows to turn of a range of switches at once.


Self Switches:


You use Eventcommand Script on Page3


Here a simple script snippet made by a starter. Just execute it 1Time and all the self switches off all map events  on every map should be off.

Code:
for a in (1..999) 
if $game_map.map_id != nil
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end ; end
end
end
do you mean like a new game plus? because else switches are remade at every time you start a new game...
Sorry! With autoswitches I meant Self Switches.

Have you tried making an event at the end of the playthrough which turns off all switches in general? 



That would work fine, but you can't turn off self switches from other maps or events, right?

What is an auto Switch?


I just know regular "Switches" and "Self Switches".


Regular Switches:


You use the Eventcommand Control switches and choose "Batch" that allows to turn of a range of switches at once.


Self Switches:


You use Eventcommand Script on Page3


Here a simple script snippet made by a starter. Just execute it 1Time and all the self switches off all map events  on every map should be off.




for a in (1..999)
if $game_map.map_id != nil
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end ; end
end
end


So this script will turn off all self switches? Sweet! I'll give it a try and post the results, thank you!
I made an error with the map id stuff, and i dont find the correct command i need.


But i see that it doesnt crash if the map id isnt existing, so it works without that line, also decreases the lag spike for that 1 seccond.

Code:
for a in (1..999) 
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end
end
end
I made an error with the map id stuff, and i dont find the correct command i need.


But i see that it doesnt crash if the map id isnt existing, so it works without that line, also decreases the lag spike for that 1 seccond.



for a in (1..999)
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end
end
end





Thanks for your help, I'm truly amazed with your kindness! 


Both script snippets you've provided me do crash the game, though. SyntaxError: Unexpected Identifier. I'm not very experienced with script managing so maybe it's my fault. I just copied the script and pasted it in the line where I wanted to turn off all self switches.
Where exactly did you add it??? This is ment for use in Eventcommand on page 3 "Script".


LOL its my fault, mine is for Ruby VX-Ace, i oversaw that this is for MV. Sorry me casa no Java Script  thingy 🙂.


Someone else will need to help.
@Jogabba...


I got this to work, based on the above (which is not for MV, I think...)...


◆Script:for (var a = 1; a < 999; ++a)
:      :{  
:      :for (var b = 1; b < $gameMap.events().length+1; ++b)
:      :{
:      :$gameSelfSwitches.setValue([a, b, 'A'], false)
:      :$gameSelfSwitches.setValue([a, b, 'B'], false)
:      :$gameSelfSwitches.setValue([a, b, 'C'], false)
:      :$gameSelfSwitches.setValue([a, b, 'D'], false)
:      :}}


It may not be perfect (suggestions for improvement welcome...), but I tried it out on a couple of Test Maps and it worked just fine. No guarantees, however.


Hope this helps.
I found an incredible simple solution. 


$gameSelfSwitches.clear();


This line seems to do the trick all by itself!


Thank you guys for your help anyways, you're the best!

Original thread: https://forums.rpgmakerweb.com/threads/reset-autoswitches.70301/