# Expected vars: # * RGRAPH_PREFIX (str) e.g. "switch_", "switch_oneway_" # * ONEWAY (bool) # Expected vars at runtime: # * key (str) $SET_INT DELAY 2 collmap "hitbox": ;; + ;; * ;; (.)- . state "init": if: expr: mapvar(myvar("key")) then: goto immediate: "switch_on" if: then: goto immediate: "switch_off" state "switch_off": rgraph: $PREFIX RGRAPH_PREFIX "off" hitbox: collmap("hitbox") on "spit": set mapvar(myvar("key")): T goto: "switching_on" delay: $GET_INT DELAY state "switching_on": rgraph: $PREFIX RGRAPH_PREFIX "on" hitbox: collmap("hitbox") if: then: goto: "switch_on" state "switch_on": rgraph: $PREFIX RGRAPH_PREFIX "on" hitbox: collmap("hitbox") $IF !ONEWAY: on "spit": set mapvar(myvar("key")): F goto: "switching_off" delay: $GET_INT DELAY state "switching_off": rgraph: $PREFIX RGRAPH_PREFIX "off" hitbox: collmap("hitbox") if: then: goto: "switch_off"