Patterns - approach for conditionally resetting Pseq

How can I get

\buf, Pseq([l, h, h, h, h], inf)

to start over when the values of

\dur, Prand([(temp/1), (temp/2), (temp/4), (temp/0.5)], inf),

, over time, all add up to ‘(temp * 8)’?

(
var temp, l, h;
temp = 1;
l = Prand(d[\l], 1);
h = Prand(d[\h], 1);
Pdef(
	\rhythm,
	Pbind(
		\instrument, \bufplay,
		\dur, Prand([(temp/1), (temp/2), (temp/4), (temp/0.5)], inf),
		\buf, Pseq([l, h, h, h, h], inf),
		\rate, 2,
		\amp, 0.5,
	);
).play;
)

Should I abandon this approach? Should I learn more and then come back to it? New to SC.

You can use Pconst for this. I also built my own version of this, where the implementation is slightly different. To be honest, i can’t remember why but I think it was because there were cases where Pconst behaved in unexpected ways? In any case, if you have problems you’re welcome to use mine also: PlimitSum.sc · GitHub

( // PLAY
Pdef(\limit, Pbind(
    \dur, PlimitSum(Pseq([
        Prand( 1 / [1, 3, 5, 8, 12], inf).limitSum(6),
        2
    ], inf), 8),
    \octave, 2,
    \degree, Prand([-1, 2, 6, 8], inf),
    \legato, 1.2,
)).play;
)

Thanks, Pconst seems promising.