Turn off random encounters with a switch

I am sure this has been done, but I can't find the script. I need it so: I can use the maps interface to set up the monsters encountered and the steps before an encounter, BUT set up an event that runs parallel to say if this, turn off random encounters, else, turn on random encounters. its for a "dynamic event" like system I want to implement.
In the event command, you can turn off encounters. Just plug it into a conditional branch or switch.
if SWITCH 1 ON then turn off encounters?
I didnt know you could do that. sorry

Original thread: https://forums.rpgmakerweb.com/threads/turn-off-random-encounters-with-a-switch.15030/