Noob automation/script question

I’m totally new to HA automations. I understand the IFTTT way of programming, can someone “translate” this for me?
Basically, I want to run a script (randomize WLed lights, I have this script up and running), every X minutes, but only if Switch is off (motion sensor is inactive)
So:
if Switch changes to off
then every X mintues
run Script