Consider building an LFO in scriptnode instead (there's really helpful example in the tutorial repository that should get you started), you can then set your LFO to one-shot by setting the ramps LoopStart parameter to 1.0.
@xxx Combo boxes start at 1, what does your knob start at? I'm guessing 0 because you are subtracting 1 from the value on line 14 and that's giving you an undefined error - my guess is that it's trying to access the array with index -1 which is invalid.